I noticed I have several unneeded locales installed, for example, firefox-locale-. I only need one locale.

How to remove all the rest?

  • 3
    Same here. I don't need 50 languages worth of clutter taking up precious SSD space, not to mention filling up the backup drive.
    – SDsolar
    Aug 16, 2017 at 22:15
  • this answer did the trick without installing new packages Jun 30, 2022 at 14:19
  • also this answer, I keep trying to re-find it again and again
    – ulidtko
    Feb 28 at 15:02

6 Answers 6


First type the locale command to print out your current locale configuration. Also, you can use locale -a to display a list of all available locales.

Cleaning up unused locales

Install localepurge to remove any unwanted languages, while choosing the ones you want to keep. Note that this method will not change the locales settings on your system. It will just purge the locales you have not selected. Use at your own risk.

sudo apt-get install localepurge

After that, you could reboot or try to run source /etc/default/locale.

To reconfigure this, simply enter the following in terminal:

sudo dpkg-reconfigure localepurge

Another way answered here is to

sudo locale-gen --purge <locales YOU WANT TO KEEP>


  • 4
    Quoting localepurge man page: "Please note, that this tool is a hack which is not integrated with Debian's package management system [...]"
    – sevo
    Sep 23, 2017 at 17:39
  • 5
    none of these things seem to actually remove any files. /usr/share/man still has all the languages. /usr/share/locale still has all the directories. Aug 27, 2018 at 6:55
  • localepurge only "prevents future packages from generate unwanted locales". see my answer.
    – alchemy
    Feb 2, 2022 at 4:33

Unless you have a need to switch to various locales all the time, you can uninstall the unused locales and free up some amount of the storage space in your system.

Install Localepurge via the terminal:

sudo apt-get install localepurge

Once the installation is done, it will remove all locale files from your system that you have no need for.

  • 1
    This might break your system, localpurge on Debian is not supported by the package manager. This is a pretty ugly hack, sadly. I wish it was otherwise. Oct 21, 2020 at 8:36
  • localepurge only "prevents future packages from generate unwanted locales". see my answer.
    – alchemy
    Feb 2, 2022 at 4:33

Note: Some of the commands below require root privileges, consider the use of sudo.

Basic info

According to man locale-gen, locales are set in several files.


The main configuration file, which has a simple format: every line that is not empty and does not begin with a # is treated as a locale definition that is to be built.


A directory containing locale.gen snippets provided by language-pack packages. Do not edit these manually, they will be overwritten on package upgrades.

Locales are compiled (generated) into a single file.


Usual default locale archive location.

Comprehensive details on locales at the Arch Wiki.

Checking locales and the locale

To list available (known) locales, run any of the following commands (with minor output differences).

locale -a
localectl list-locales

To check the (already) generated locales, run the following command.

localedef --list-archive

To check the currently used locale, run any of the following commands (with minor output differences).


Setting and generating (new) locales

Locales are typically set by uncommenting lines in /etc/locale.gen, after which running locale-gen is required.

nano /etc/locale.gen # uncomment desired lines (locales)

This will compile (generate) locales into /usr/lib/locale/locale-archive for each uncommented line in /etc/locale.gen and under /var/lib/locales/supported.d/, whether they were previously compiled or not.

Alternatively, the command

locale-gen <locale>

will uncomment the corresponding line in locale-gen while generating the desired locale and only this one.

Note: The implementation of locale-gen is distro dependent. For instance, the command above is valid in Ubuntu/Debian but not in ArchLinux.

Removing locales

When issuing locale-gen, the compiled archive is erased and all locales in /etc/locale.gen and under /usr/lib/locale/locale-archive are regenerated anew. The command locale-gen --purge <locale> doesn't do what the modifier suggests but the opposite: It removes all compiled locales except those indicated. To make sure only specific locales are generated when locale-gen is issued or and update is performed both /etc/locale.gen and /usr/lib/locale/locale-archive must be considered.

To remove locales in /etc/locale.gen, simply comment the desired lines and regenerate the locales using locale-gen.

To remove locales under /var/lib/locales/supported.d/ is trickier. Since any file /var/lib/locales/supported.d/<code> depends on the package language-pack-<code>-base, any change on the former will be restored when the latter is updated. To solve this, simply hold the packages that update files under /var/lib/locales/supported.d/. The command that achieves this in Ubuntu/Debian is the following.

apt-mark language-pack-<code>-base

To update a held package, you must unmark it or simply --ignore-hold.

Workaround. A more intrusive but general solution that prevents changes under /var/lib/locales/supported.d/ is to set files in it with the "immutable (i)" attribute. So instead of removing files, empty them. For instance:

cd /var/lib/locales/supported.d/
rm <code> && touch <code> # <code> has been emptied
lsattr <code>    # regular attributes
chattr +i <code> # adding (+) immutable
lsattr <code>    # checking attributes

Setting the locale

Setting and generating locales does not set the system locale. Any of the following commands achieves this.

echo LANG=<code> | sudo tee /etc/locale.conf # reboot (might be ignored in Ubuntu)
localectl set-locale LANG=<code>

Use apt install localepurge, but this only stops new packages from installing locales files. "This option will become active for packages unpacked after localepurge has been (re)configured. Packages installed or upgraded together with localepurge may (or may not) be subject to the previous configuration of localepurge."

Then rm -rI /usr/share/locale/!(en).

Then possibly reinstall packages if they have locales files in their own directories.

Careful, apparently rm /dir !() removes files in your current dir (pwd).

How to delete all files except one named file from a specific folder

https://askubuntu.com/a/624445/795299 (relevant top answer from above link)

Use apt install --reinstall locales if you accidentally delete a dir.


Install BleachBit, amongst other things it's able to remove locales from any linux OS.

When you launch BleachBit, it may show you the preferences dialog where you can tick which locales you want to keep.

If it doesn't show you this automatically, then you can open it from the triple dot menu up in the top right of the window.

enter image description here


This is my first answer on this site. BleachBit is able to remove files for unwanted languages in your system and applications.

Install BleachBit from your Ubuntu Software or terminal (sudo apt install bleachbit) and open it as root (sudo bleachbit). Go to Preferences and under Languages check all the languages you want to keep. Now on the left panel, under System, check Localizations. If you want to know how much space these localization files are taking up in your system, click the Preview button. Use the Clean button to actually free up the space. Hope this helps.

BleachBit screenshot

In the screenshot, you can see BleachBit deleting localization files from gedit text editor.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .