I have 5 unused locales on my system. How can I remove them via command line? I have use localepurge
but it didn't work.
Asked
Active
Viewed 2.5k times
28

Eonil
- 2,051
1 Answers
30
You can list locales with
localedef --list-archive
or with
locale -a
Corresponding file size is given by
ls -lh /usr/lib/locale/locale-archive
To remove unused locales you can do
sudo locale-gen --purge it_IT.UTF-8 en_US.UTF-8 && echo 'Success!'
where it_IT.UTF-8
and en_US.UTF-8
are the only two locales I want. The && echo 'Success!'
at end is useful because locale-gen
does not report errors if an unavailable or wrong locale is passed on command line.

Artur Meinild
- 26,018

enzotib
- 93,831
localedef --list-archive
withouts
– anatoly techtonik Mar 24 '12 at 08:22"Succes!"
string triggers the bash history expansion. To avoid this problem you have to include'Success!'
into single quotes or (strangely!) remove the quotes. From bash manual: History expansions are introduced by the appearance of the history expansion character, which is ‘!’ by default. Only\
and'
may be used to escape the history expansion character. – Michele Feb 10 '14 at 10:26localedef --list-archive
) - one Czechcs_CZ.utf8
and the rest are just variants of English, e.g.en_CA.utf8
,en_GB.utf8
,en_US.utf8
, etc. But when I ran BleachBit (a GUI file cleaning tool), it has found various locale and localization files in various locations (e.g./usr/share/man/
,/usr/share/help/
) in dozens of languages not listed bylocaledef
, the total of about 500 MB of data. I'm not sure why they're even installed, maybe installations that don't check what locales are enabled? – David Ferenczy Rogožan Nov 10 '23 at 22:42