By default, Linux Mint comes with a number of extra locales which you most likely do not need. When updating system components like libc or kernel, the operating system rebuilds them. This operation takes a notable amount of time and in fact is completely redundant. Let's see how to get rid of these extra locales.
Advertisеment
I am happy with just a two locales, en_US.UTF-8 and ru_RU.UTF-8. However, my fresh install of Mint 18.1 has a number of extra locales. Let's see which locales are installed by default.
Open your favorite terminal emulator app and type the following command:
locale -a
This will populate the list of installed locales. This is how it looks.
As you can see, there are lots of installed locales besides the required one. Let's see how to get rid of them.
To remove a locale in Linux Mint, do the following.
Open a new root terminal. Please refer to the following article:
How to Open Root Terminal in Linux Mint
Locales are defined in text files under /var/lib/locales/supported.d/. There can be more than one file depending on your OS configuration. Every file can contain one or more locales which will be installed. You can edit these files and re-generate your locale list.
In my case, I need to modify only one file, /var/lib/locales/supported.d/en. Let's edit it to change the configuration.
Open the file with your favorite text editor, e.g.
nano /var/lib/locales/supported.d/en
or
vim /var/lib/locales/supported.d/en
In my case, I need to remove all the lines in this file and keep only the item en_US.UTF-8.
Remove the unnecessary lines and save the file.
Now, execute the following command as root:
locale-gen
This will create only the required locales. The other locales won't be generated any more.
Also, you can purge all the locales which were left from the previous setup.
Execute the following command as root to remove them
locale-gen --purge ru_RU.UTF-8 en_US.UTF-8
This will keep only two locales ru_RU.UTF-8 and en_US.UTF-8. All the rest will be removed.
You are done.
Support us
Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:
If you like this article, please share it using the buttons below. It won't take a lot from you, but it will help us grow. Thanks for your support!
Advertisеment
In the case of Ubuntu 20.04, locale-gen seems to generate locales from two sources:
1. /etc/locale.gen
2. files in /var/lib/locales/supported.d/
Most importantly, the –purge flag seems NOT overriding these files. As a result, you may keep seeing the same locales by running locale -a.
Steps for a solution are:
1. Manually uncomment the unwanted locales in the files in the two sources.
2. sudo locale-gen
To confirm, run locale -a