I just noticed that in /usr/share/help
I have the ubuntu help files in 70 different languages. I only speak 2, and I only really compute in one. I also noticed that it is full of broken symbolic links to /usr/share/help-langpack.
I want just want to get rid of all the languages I don't need. How can I do this without getting all rm -r
happy? I'm preferably looking for a way to do this without installing any new packages, as my main goal is to get rid of excess stuff on my machine. I'd like to find a way to do this preferably with dpkg, or apt.
You can check which locales are generated and configured on your system using the locale command:
The last command from above makes you see that all generated locales are located in
/usr/lib/locale/
, you may remove any of them if unneeded. Each pack of locale information is a directory containing text files and other directories.All locales that you want your system to support are listed in the text files in
/var/lib/locales/supported.d/
. These files have two columns, language tag and character map.I want my system to know US-English only, so I have only one file there, called en, which contains just a single line:
Error messages
If error messages are displayed when issuing the locale command, e.g:
make sure the file
/etc/default/locale
exists and has proper content, such as:Get rid of unneeded locale data - Step by step
Now we know all the necessary details to get started with cleaning up our system's locale information:
/var/lib/locales/supported.d/
, and remove all unneeded locales (one locale per line)/etc/default/locale
(see above for an example)rm -rfv /usr/lib/locale/*
locale-gen
That's all! Reboot your machine to make your changes take effect. Then run one or more of the locale command examples from above to ensure yourself that the result is as expected.
There is a package for Debian/Ubuntu that can take care of removing locales and locale related files (e.g. man pages):
localepurge
. You can install/run it issueing:once installed, you should run this:
to ensure your language settings are set correctly.
to run it manually once installed (although you shouldn't really need to as it should run after every
dpkg
run automagically) you can just do:Read the man page before using it, though. If you can get your stuff done without it it's probably safer to let go.
from this forums
ref:
1. LocaleConf on official documentation
2. Linux man page
3. Locale on wikipeadia
4. man localepurge
As regards actually installed languages, go to System Settings -> Language Support and click the Install / Remove Languages... button. Then uncheck the languages you don't need.
As regards the symlinks in
/usr/share/help
, please see my comment on your question.An easy way to do this is by using BleachBit. 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.
In the screenshot, you can see BleachBit deleting localization files from gedit text editor.
BleachBit screenshot