BleachBit is a free and open source application available on Linux and Windows, which can be used, among the other things, to remove unnecessary files and directories from a filesystem. BleachBit can be used to free the caches of many applications, remove cookies and browsers history, but also to shred (secure delete) files and directories.
In this tutorial we see how to install and use BleachBit on the major Linux distributions.
In this tutorial you will learn:
- How to install BleachBit on some of the most used Linux distributions
- How to use BleachBit to delete unnecessary files and directories
- How to use BleachBit to shred files and folders

Category | Requirements, Conventions or Software Version Used |
---|---|
System | Distribution-independent |
Software | BleachBit |
Other | Administrative privileges if used globally |
Conventions | # – requires given linux-commands to be executed with root privileges either directly as a root user or by use of sudo command $ – requires given linux-commands to be executed as a regular non-privileged user |
Installing BleachBit
BleachBit is free and open source software, mainly written in Python, and is available in the software repositories of all the major Linux distributions, on which it can be installed via their corresponding package managers. On Fedora, for example, we can install it by using dnf
:
$ sudo dnf install bleachbit
On Debian, Ubuntu and other distributions of the Debian family, we can install the “bleachbit” package by using apt-get
or the friendly apt wrapper. To use the former, classic, method, we need to run:
$ sudo apt-get update && sudo apt-get install bleachbit
The higher-level apt
wrapper is meant to provide a more friendly user interface. We can use it to install the same package by running:
$ sudo apt install bleachbit
If you are an Archlinux user and want to install bleachbit you can use pacman
, the distribution native package manager (the package is part of the “community” repository):
$ sudo pacman -Sy bleachbit
Once BleachBit is installed in our system, we can use it to perform various “cleaning” operations, let’s see how.
Using BleachBit to clean unnecessary files
Let’s take a look at the BleachBit main window:

In the left section of the application window we can see a list of the application which can be cleaned by using BleachBit. BleachBit knows how to delete files related to many applications, but, by default, only the applications currently installed on our systems are displayed in the menu (this behavior can be changed in the application settings).
Once we click on the name of an application, the actions which can be performed on it are displayed in the right part of the interface. In the screenshot above, for example, we can see the “Bash” entry is selected in the menu, and the History action is described as consisting in the deletion of the Bash shell command history. To get a list of the steps involved in a certain operation, and a summary of how they would impact on filesystem space, we just have to mark the corresponding checkbox, then click on the “preview” button in the application main menu:

In the example above, we selected “Bash -> History”, than clicked on the preview button. BleachBit displayed the list of the actions that would be performed as part of the cleaning operation. In this case we can see that the /home/egdoc/.bash_history
file would be deleted; this would free 8.2KB of disk space. For the operation to actually be performed, all we have to do is to click on the “clean” button, than confirm our choice.
One thing to notice is that, although certain operations appear in the list, they can only be performed if BleachBit is launched with administrative privileges. One example are the operations relative to DNF, the Fedora package manager. The actions we select in the list, will be remembered the next time we launch the application.
Deleting custom files
BleachBit allow us to remove arbitrary files not related to any of the applications in the menu. To provide a list of the files which should be deleted, we just click on the application “hamburger” menu and than on the “Preferences” entry. In the window that will be opened we than click on the “Custom” tab:

To add (or remove) a file or an entire folder to the list, we can simply click on the appropriate button, select the file/folder in the file picker window and confirm our choice. In the example below we included the /home/egdoc/custom.txt
file to the list:

It goes by itself that for a file to be removed successfully we need to have the necessary permissions on it.
Preserve files from deletion
In some cases we may want to avoid the deletion of specific files which would otherwise be removed as part of an action. In order to do that, we can just navigate again to the application “Preferences” menu. This time we need to click on the “Whitelist” tab. Here, just like we did in the previous example, we can add or remove files and folders to the application whitelist:

Shredding files and folders
As we know, when a file or a directory is delete, either from a graphical file manager or from the command line, the actual is not immediately lost; what happens is that the system is informed that “space” is available to store new data. Only when the old data is replaced by the new one, the information are definitely lost. To safely remove some files immediately, we want to “shred” them, so to delete and overwrite them right away. BleachBit can perform those operations for us.
To shred a file or a directory with BleachBit we just have to click on the application “hamburger” menu, and click on the appropriate entry. To shred one or more files, for example we would click on “Shred Files”, than select the files we want to shred in the file picker.

Once we select one or more files or directories, we will be prompted to confirm we want to shred them:

Conclusions
In this tutorial we learned how to install and use BleachBit on some of the major Linux distributions. We learned how to clean files related to the applications supported by BleachBit, how to delete “custom” files, and how to preserve some files from deletion by adding them to a whitelist; we also learned how to securely wipe (shred) files and directories. BleachBit is free and open source software which can be customized in multiple ways. To know more about it, please take a look at the official documentation.