How to Clean Linux Mint Safely


Back to the homepage


As the Victorians used to say: cleanliness is next to godliness. So here are some tips to make your Linux Mint 19.2 even more divine.

Contents of this page:

First of all: never use cleaning applications like BleachBit! Those software wrecking balls are very risky and may damage your system beyond repair. There are a few safe cleaning actions, which I'll describe below.

Linux Mint doesn't get polluted much over time. It doesn't even need defragmentation. The only cleansing actions you might want to do in Linux Mint, are the following:

Empty the trash bin

1. Maybe too obvious to mention, but still: don't forget to empty the trash bin from time to time. Right-click mouse on the Trash folder in your file manager - Empty trash. Repeat this in each user account.

Clear the updates cache

2. Launch Synaptic Package Manager.

Panel of Synaptic: Settings - Preferences - Files

Select: Delete downloaded packages after installation

Press the button: Delete Cached Package Files

Clear the thumbnail cache

3. For each displayed picture, Mint automatically creates a thumbnail, for viewing in the file manager. It stores those thumbnails in a hidden directory in your user account (names of hidden directories and hidden files start with a dot, like .cache or .bash_history. The dot makes them hidden).

Over time, the number of thumbnails can increase a lot, up to 512 MB. Moreover, the thumbnail cache will eventually contain many superfluous thumbnails of pictures that don't exist anymore. By default, only thumbnails older than six months will be deleted.

The quickest way to get rid of all the thumbnails is to use the terminal for deleting the folder in which they reside. No worries: the system will re-create that folder and its subfolders automatically, the next time that thumbnails will be generated. Proceed like this:

Launch a terminal window.
(You can launch a terminal window like this: *Click*)

Copy/paste the following command line into the terminal, in order to avoid typing errors:

rm -rfv ~/.cache/thumbnails

Press Enter.

Note: this will probably affect the thumbnails on your desktop as well; in that case it should suffice to simply log out and in again (or reboot your computer), which will create them anew.

Repeat the above in each user account.

Do you wish to change the settings for thumbnails, so that their maximum size and age are reduced? Then proceed like this (only tested in Cinnamon yet):

First install dconf-editor. In the terminal:

sudo apt-get install dconf-editor

Press Enter. Type your password when prompted. In Ubuntu this remains entirely invisible, not even dots will show when you type it, that's normal. In Mint this has changed: you'll see asterisks when you type. Press Enter again.

Then in the terminal:

dconf-editor

Press Enter.

Expanding the subitems can be done by clicking on the little triangle before an item. In Cinnamon, click your way to: org - cinnamon - desktop - thumbnail-cache
(in MATE: org - mate - desktop - thumbnail-cache)

Click once on maximum-age and then once on 180, and change it to 30 (for example, if you want 30 days as maximum age).

Then click once on maximum-size and then once on 512, and change it to 50 (for example, if you want 50 MB as maximum size). Repeat this in each user account. That way, you won't have to pay attention to the disk space of the thumbnails anymore.

The registry

4. There's no need to clean the registry of Linux, as it can't get polluted in the first place. For the following reasons:

- Only the operating system itself has a central registry. The configurations of the applications aren't in there, because they don't have access to it. So they can't mess it up. They place their own default settings in their own folders in the system.

- Applications place upon installation a hidden settings file in the personal folder of each user. That's the only settings file that a user has access to. More or less like MS-DOS did, when each application only created its own .ini file with its settings.

- Each user has his own hidden copy of the central registry in his personal folder. That copy is the only thing that he can mess up, not the registry of another user account.

Make Firefox cleanse itself automatically upon quitting

5. Improve your privacy: you can configure Firefox to cleanse itself automatically, upon quitting. All cookies and history are being deleted then. Furthermore, you can limit the tracking that some websites do to follow you.

The price you pay is a small decrease in user friendliness, but it's not much. The privacy gain is huge, and outweighs this price by far.

You can do it like this:

Firefox menu button (with the three horizontal dashes on it) - Preferences - tab Privacy & Security

a. Item History: change the setting to:
Firefox will: Use custom settings for history

b. Now tick the following setting:
Clear history when Firefox closes

c. Then, click the button Settings... (on the right of "Clear history when Firefox closes") and tick everything, except for Site Preferences. Click OK.

d. Item Cookies and Site Data:

Change the "Accept cookies (...)" setting to:
Keep until: I close Firefox

e. Item Address Bar: remove the tick for: Browsing history

f. Item Tracking protection: leave those settings at their defaults, because otherwise some websites might function less well.

You've just set all cookies to be thrown away automatically upon closing Firefox (in the previous steps), so this tracking doesn't impact your privacy by much anyway!

g. Close the Preferences tab and you're done with optimizing the settings for privacy.

Tip: sometimes it may come in handy to force a cleansing during your web browsing. Simply by closing Firefox and launching it anew.

Consider removing Flatpaks and the Flatpak infrastructure

6. Flatpak is a cool way of always having the latest stable version of certain applications. But it also has disadvantages: Flatpaks take up much more disk space than ordinary applications from the normal software sources. That's because each Flatpak contains most of its supporting files and shares much less with the system.

This use of disk space can also increase quickly, because many Flatpaks are being updated very regularly. This frequent updating also causes a lot of data traffic.

So if you don't have much disk space or have to limit your data traffic, you might want to remove all installed Flatpaks and even the Flatpak infrastructure. Like this:

a. First launch Software Manager. Then click the Flatpak button (bottom right) and see which applications have a green circle with a white checkmark in it, after their name. Those are the installed Flatpaks. Remove them all.

b. After you've removed all installed Flatpaks, close Software Manager.

c. You might wish to remove the Flatpak infrastructure as well, in order to prevent installing new Flatpaks by accident. Because Software Manager isn't very clear in showing the distinction between ordinary applications and Flatpaks....

For removing the Flatpak plumbing you can proceed as follows:

d. Launch a terminal window.
(You can launch a terminal window like this: *Click*)

e. Copy/paste the following command line into the terminal, in order to avoid typing errors:

sudo apt-get purge "*flatpak*" "xdg-desktop-portal*"

Press Enter. Type your password when prompted. Press Enter again.

The following is not relevant for Linux Mint 19.2 Tina, but only for the older 19 and 19.1.
In Linux Mint 19 and 19.1 (fortunately not in 19.2) this will also remove two useless meta packages (mint-meta-cinnamon and mint-meta-core) and one useful application, namely mintinstall (Software Manager).

Those meta packages are just shopping lists for shopping that has already been done, so they can be deleted in all cases.

To replace mintinstall (Software Manager) almost completely in Mint 19 or 19.1, you can install Gnome Software, which pulls in only a few extra supporting packages when you install it. For that, proceed like this:

f. Copy/paste the following command line into the terminal:

sudo apt-get install --no-install-recommends gnome-software

Press Enter. Type your password when prompted. Press Enter again.

Prevent pollution: use an external disk for storing snapshots from Timeshift

7. Your hard disk can fill up rapidly, if you use Timeshift for making snapshots of your system. Timeshift is notorious for gobbling up free space: it eats gigabytes like they're nothing.

So make sure that Timeshift stores its snapshots on an external hard drive. That way, your system won't ever run out of disk space because of Timeshift.

Proceed as follows:

a. Connect your external hard drive to your computer.

b. Then from the menu, launch Timeshift. In the panel of Timeshift: Settings - Location

c. Finally, select a storage partition on your external hard drive.
Note: the partition you select needs to be formatted as a Linux partition, so FAT32 or NTFS won't do. A partition formatted as EXT4 is the best option.

Remove most Asian fonts

8. If you're not a user of Asian fonts, you might remove a couple of those. That should free up several hundred MB's of disk space, but more importantly: the font selection box in Libre Office will become much less cluttered.

Note: sometimes, removing fonts may have unwanted side effects! Although I haven't experienced those on my machines yet after the removal of the Asian fonts described below, it's something to keep in mind....

This is how to remove most Asian fonts:

a. Launch a terminal window.
(You can launch a terminal window like this: *Click*)

b. Copy/paste the following command line into the terminal, in order to avoid typing errors. It's one huge line:

sudo apt-get remove "fonts-kacst*" "fonts-khmeros*" fonts-lklug-sinhala fonts-guru-extra "fonts-nanum*" fonts-noto-cjk "fonts-takao*" fonts-tibetan-machine fonts-lao fonts-sil-padauk fonts-sil-abyssinica "fonts-tlwg-*" "fonts-lohit-*" fonts-beng-extra fonts-gargi fonts-gubbi fonts-gujr-extra fonts-kalapi "fonts-samyak*" fonts-navilu fonts-nakula fonts-orya-extra fonts-pagul fonts-sarai "fonts-telu*" "fonts-wqy*" "fonts-smc*" fonts-deva-extra fonts-sahadeva

Press Enter. Type your password when prompted. In Ubuntu this remains entirely invisible, not even dots will show when you type it, that's normal. In Mint this has changed: you'll see asterisks when you type. Press Enter again.

c. Just to make sure, follow it up with this terminal command (use copy/paste to transfer it to the terminal):

sudo dpkg-reconfigure fontconfig

Press Enter.

d. Reboot your machine.

Finally: I strongly advise to leave it at that. Don't remove any other fonts, because of the aforementioned risk of negative side effects!

How to undo: re-install removed Asian fonts

8.1. Regrets? If you want to re-install the Asian fonts that you've removed by applying the how-to in item 8, simply replace the word "remove" by "install" in its removal command line. Run dpkg-reconfigure fontconfig again, reboot and all should be like it was before.

Remove old kernels

9. You probably have installed new kernels from time to time. If so, you may want to clean up a bit, after a while.

After a kernel update, the old kernel still shows in the Grub boot menu, under the header Advanced options for Linux Mint. Because you might want to start your machine with the old kernel, if the new kernel doesn't function well....

So far, so good. But having more than one redundant kernel is superfluous and a waste of disk space, because each kernel uses up more than 200 MB (headers included). Below I describe various ways how you can remove old kernels and thereby clean up the Grub boot loader menu as well.

Note: don't use cleaning applications like Bleachbit or Computer Janitor for this job! They are dangerous and at best superfluous.

Now let's get started:

Automatic removal of old redundant kernels

9.1. The easiest and recommended way to get rid of old redundant kernels, is to enable the automatic feature for removing obsolete kernels in Update Manager.

It's a safe tool to use and smart as well, because it leaves the latest redundant old kernel in your system, just to be on the safe side. It's wise to have one spare kernel that's known to work well...

You can enable this automatic feature as follows:

Update Manager - panel: Edit - Preferences

Tab Automation - section Automatic Maintenance - Remove obsolete kernels and dependencies: switch it to ON. See the screenshot below (click on it to enlarge it):


Important warning: Do NOT enable Apply updates automatically! Updates should never be installed automatically, because there's always a risk (however small) that they'll disrupt your work on the computer. That's why you should at all times install them yourself, at a time that suits you, when there's no risk of disruption of your computer jobs.

Many old redundant kernels? Remove them all in one stroke

9.2. Is the amount of old kernels huge? This is how you can remove all old redundant kernels quickly, in one stroke:

a. Launch Update Manager. In the toolbar of Update Manager: View - Linux kernels

This may take some time. Then a warning window pops up. Click "Continue" in order to proceed.

b. Press the button Remove old kernels... You should then get to see a list of all removable old kernels, all of them already preselected for removal. See the screenshot below (click on it to enlarge it):

Note: I strongly recommend not to throw away all of them: leave at least one spare kernel installed. You never know when such a spare kernel might come in handy, for example when your currently active newer kernel suddenly starts misbehaving....

Removal of specific redundant kernels

9.3. You can also remove specific redundant kernels. Like this:

a. Launch Update Manager. In the toolbar of Update Manager: View - Linux kernels

This may take some time. Then a warning window pops up. Click "Continue" in order to proceed.

b. Ignore the button labeled Remove Kernels... , because that button is meant for mass removal. Just click on the kernel that you want to throw away. Then click on the "Remove" button. See the screenshot below (click on it to enlarge it):

Note: I strongly recommend to leave the latest redundant old kernel in your system, just to be on the safe side! It never hurts to have a spare kernel that's known to work well....

c. Now reboot your computer.

Finished! That's all you ever need to do. Doing more is risky and not advisable.

Want to get rid of polluted settings in your web browser?

10. Do you have polluted settings in Firefox, Chrome or Chromium (sometimes caused by rotten, shady or rogue add-ons), and do you wish to start anew with a clean browser? Then proceed like this:

a. First make a backup of your current web browser settings (because you never know why you might need them sometime):

- Launch a terminal window (this is how to launch a terminal window: *Click*).

- Use copy/paste to transfer the following blue command line to the terminal:

For Firefox:
cp -r -v ~/.mozilla ~/.mozillabackup

Press Enter.

For Chrome:
cp -r -v ~/.config/google-chrome ~/.config/google-chromebackup

Press Enter.

For Chromium:
cp -r -v ~/.config/chromium ~/.config/chromiumbackup

Press Enter.

b. Now export your bookmarks to a backup file:

For Firefox:
Click the "Library" button (the one with the four bars) - Bookmarks - Show All Bookmarks (down below)

Import and Backup - Backup...

Save the bookmarks-xxx.json file to the location you prefer.

Later on, you can import your bookmarks again in a clean Firefox.

For Chrome / Chromium:
On the upper right in your browser window, click on the three dots - Bookmarks - Bookmark manager

Click on the three white dots - Export bookmarks to HTML file...

Later on, you can import them again in your clean Chrome / Chromium.

c. You will also lose all of your stored login passwords for websites! Make sure you know them all.

d. Close the web browser you wish to clean.

e. Launch a terminal window.

f. Copy/paste the following blue command line into the terminal, in order to avoid typing errors:

For Firefox:
rm -r -v ~/.mozilla && rm -r -v ~/.cache/mozilla

Press Enter.

For Chrome:
rm -r -v ~/.config/google-chrome && rm -r -v ~/.cache/google-chrome

Press Enter.

For Chromium:
rm -r -v ~/.config/chromium && rm -r -v ~/.cache/chromium

Press Enter.

g. Launch your web browser again. It should be clean.

h. Import your old bookmarks from the backup you've created. Importing can be done by means of the same feature as the one you've used for exporting.

You're done! From now on, avoid all shady add-ons and extensions, and install only those that you really need and trust.

Want more tips?

Do you want more tips and tweaks? There's a lot more of them on this website!

For example:

Speed up your Linux Mint!

Avoid 10 fatal mistakes


To the content of this website applies a Creative Commons license.

Back to the home page

Disclaimer