How can I uninstall a locale via command-line?

23,082

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.

Share:
23,082
Eonil
Author by

Eonil

Current tools. OSX, iOS, FreeBSD. C/C++/Objective-C, Cocoa, Xcode. PostgreSQL. Feel free to fix my grammar if it's wrong. I always appreciate!

Updated on September 18, 2022

Comments

  • Eonil
    Eonil almost 2 years

    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.

  • Gopal Venu
    Gopal Venu over 12 years
    Nice. Is there a way to remove just the locales that I don't need? I am not sure whichever of en_US locales are used - I prefer to leave them all and remove only the ones that I am absolutely sure have no use on my system, like de_*.
  • Michele
    Michele over 10 years
    On bash the exclamation mark in the "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.
  • Loenix
    Loenix almost 4 years
    --purge is not working in my case and is not documented...
  • Ramon Suarez
    Ramon Suarez over 3 years
    It did not work for me either