How to clean Linux Mint safely

Back to the homepage

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 even doesn't 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.

Clear the updates cache

2. Launch Synaptic Package Manager.

Panel of Synaptic: Settings - Preferences - Files

Put the dot at: Delete downloaded packages after installation

Press the button: Delete cached package files

Clear the thumbnail cache

3. For each shown 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 them is to use the terminal:

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 -v -f ~/.cache/thumbnails/*/*.png ~/.thumbnails/*/*.png

Press Enter.

Followed by (this is one line, use copy/paste to avoid typo's):

rm -v -f ~/.cache/thumbnails/*/*/*.png ~/.thumbnails/*/*/*.png

Press Enter.

Note: this will probably affect the thumbnails on your desktop as well; in that case it should suffice to simply refresh your desktop (or log out and in again), 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. Your password will remain entirely invisible, not even dots will show when you type it, that's normal. Press Enter again.

Then in the terminal:


Press Enter.

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

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

Then click once on maximum-size and set 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:
Panel of Firefox - Edit - Preferences - tab Privacy

a. Item Tracking: set it to:
Tell sites that I do not want to be tracked

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

c. Item Cookies: change the setting to:
Keep until: I close Firefox

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

e. Finally, click the button "Settings..." and tick everything, except for Saved Passwords and Site Preferences. Click OK.

Click Close and you're done.

Tip: sometimes it may come in handy to force a cleansing during your web browsing. Simply close Firefox and launch 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 all of its supporting files and shares nothing.

This use of disk space can also increase quickly, because many Flatpaks are being updated very regularly.

So if you don't have much disk space, 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

Press Enter. Your password will remain entirely invisible, not even dots will show when you type it, that's normal. Press Enter again.

This will also remove two useless meta packages (mint-meta-cinnamon and mint-meta-core) and mintinstall (Software Manager).

Meta packages are just shopping lists for shopping that has already been done, so those can be missed in all cases.

To -partially- replace mintinstall (Software Manager) you can install Lubuntu Software Center, which pulls in only one extra supporting python package when you install it. For that, proceed like this:

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

sudo apt-get install lubuntu-software-center

Press Enter. Your password will remain entirely invisible, not even dots will show when you type it, that's normal. Press Enter again.

(continued in the column on the right)

This website is being sponsored by Google Ads.

Are you using an ad blocker? Then you're also blocking my earnings from advertisements....

If you wish to support my website, you can configure your ad blocker to make an exception for this website. Or you can make a donation (and get free goodies).

Thanks in advance....

Remove old kernels

7. You may have installed new kernels, even though the Update Manager of Mint doesn't offer those for all update policies. 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 Previous Linux versions. 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 how you can remove old kernels and thereby clean up the Grub boot loader menu as well.

First this, however: a Linux Mint version should preferably stick to the kernel series it had on release date, because with that it'll function optimally. Kernel updates should preferably only be minor newer versions within that particular kernel series. With the notable exception of very new hardware, which often needs a newer kernel series in order to work well.

For example: Linux Mint 18.1 was first released with kernel 4.4.x. It should preferably remain 4.4, but for the minor version number you might have applied updates.

I repeat, because it's important: when you apply kernel updates: stay preferably within the kernel series for which your Linux version has been primarily designed. So in the case of Linux Mint 18.1: select 4.4.x, but preferably not higher numbers (unless you need such a newer kernel for your hardware).

Now let's get started (based on the example of Linux Mint 18.1):

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. Click on the kernel that you want to throw away, and then click on the "Remove" button. See the screenshot below (click on it to enlarge it):

Tip: 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.

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

Many old redundant kernels? Remove them all in one stroke

7.1. Is the amount of old kernels so big, that removing them one by one is annoying? This is how you can remove all old redundant kernels quickly, in one stroke:

a. First download a script that I've forked from a script in the byobu package called "purge-old-kernels": purge-old-kernels-2 (note for the gurus: I've also hosted it on GitHub).

If you wish, you can inspect what it does by opening it with your text editor. But it's important that you leave it in the folder Downloads.

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

c. For moving the script into the right system folder, copy/paste the following command line into the terminal, in order to avoid typing errors:

sudo mv -v ~/Downloads/ /opt

Press Enter. Type your password when required: your password will remain entirely invisible, not even dots will show when you type it, this is normal. Press Enter again.

d. Then copy/paste this line into the terminal, which will set the correct permissions for the script:

sudo chmod -v 755 /opt/

Press Enter.

e. Launching the script will remove all kernels except your current active kernel and the latest old one (it's a good idea to keep one spare kernel, so that's OK). Launch it with this terminal command (use copy/paste to transfer it into the terminal):

sudo sh /opt/

Press Enter.

Simply wait until the job has finished, and then you're done!

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

8. 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 green 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 Bookmarks button (the one on the right of the little star) - Show All Bookmarks

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 dashes - Bookmarks - Bookmark manager

Click on Organize - 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.

d. Copy/paste the following green 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?

9. Do you want more tips and tweaks for Linux Mint? There's a lot more of them on this website! For example: 10 fatal mistakes that you'll want to avoid in Linux Mint.

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