[Toolkit] LinuxCleaner: complete cleaning of your distro, designed for newbie

[UPDATE]: 1.2 version - Automatic kernel compilation, GRUB configuration update, system shell access, PKGBUILD with MakePKG, some changes ... Run

$ git pull

in the linuxCleaner-tools folder to download the latest version.

In recent years the GNU / Linux operating system has become increasingly common among home workstations (i Desktop), many people find themselves in difficulty at first glance with GNU / Linux (coming from Winzo ... ehm Windows), it is a system operational that still requires the knowledge of textual commands (command line), for this GNU / Linux has been defined as "for Advanced Users or Skilled Users, Programmers, Experts". It must be said that GNU / Linux has made a lot of progress with various distributions like Mint or Ubuntu, which make everything simpler (just look at the software center, which allows the user to install packages easily and not by writing in a prompt: sudo apt-get install package, but sometimes you need to use dpkg or rpm which are "manual" tools to install packages manually that are not available in the repositories.

The things to be described would be many, let's move on; today I wanted to present you my shellscript (Bash) that will help you keep the operating system up to date and clean, with various functions that we're going to see.

Now let's see how to install it:

to clarify:


I mean your user must be non-root


I mean your user must be root

from Terminal (preferably in directory ~ (ie your home))

$ git clone https://github.com/StefanoBelli/linuxCleaner-tools/

if you don't have git installed:

# apt-get install git

or, for RedHat-based systems (Fedora, openSUSE)

# yum install git

for Arch-based Linux systems (Antergos, Manjaro etc ...)

# pacman -S git

to download new versions
browse in


with cd (ChangeDirectory)

$ cd linuxCleaner-tools

and we execute

$ git pull

now you have a directory called


we browse in that folder with

$ cd linuxCleaner-tools

then we execute

$ ls

and we will see that there are 2 files (LinuxCleaner and README.md), we do not delete either the first or the second, rather we have to see that the first has executions permissions, if


returns "LinuxCleaner" with the color Green we are OK


chmod + x LinuxCleaner

to assign permissions.

we run LinuxCleaner (in the linuxCleaner-tools directory)

# ./LinuxCleaner

Let's look at the functions of LinuxCleaner:


-> Show tip:

is a "trick" that allows you to execute the script simply by executing on the terminal "LinuxCleaner", to do this it is sufficient to execute the following commands

$ nano ~ / .bashrc

in nano add the following line at the end:

export PATH = ~ / linuxCleaner-tools: $ PATH

which serves to define the value of the Bash PATH variable, 'PATH' serves to define the directories where Bash will go to draw the executables and are separated by: (try to run

$ echo $ PATH

, those are the folders where Bash goes to look for the programs that you call from the prompt).
then execute


to save everything.


to exit nano, exit the terminal with

$ exit


now you just need to run

$ LinuxCleaner

to get the script without running too many commands.

-> Update & check if there are useless packages

In reality this function updates the repositories, checks for updates of all system packages, checks for updates of the distribution, removes obsolete packages, fixes "broken" packages and dependencies, cleans the repository cache and packages.

-> Clean temporary files / tmp

This function allows you to delete the contents of the / tmp folder

If an error like: rm * is returned it is impossible to delete non-existing file, Files were not cleaned means that there are only directories in / tmp

-> Clear Trash

It allows you to delete the contents of the trash

-> Update kernel

Verify kernel updates

-> Add repositories

It allows you to add repsository to the ones you have: it works with apt, yum and pacman

-> Install package by your package manager

Detect your package manager, ask which package you want to install and install it through the pkg manager.

-> Search packages by your package manager

Same function as the previous one, but asks for a package to look for. It does not require root

-> Remove package by your package manager

Same function as Install by pkg manager, but asks for a package to be removed

-> Install packages by file / Remove packages by file

Install / remove packages via dpkg / rpm

-> About your system

Show system information

-> About Developer / About Script

How to contact me / Information on the status of the script

-> Quit


(The package manager, and the manual tool are automatically detected)

it is possible to view the source code from

GitHub: repository StefanoBelli / linuxCleaner-tools

you can contribute using the Git commands (see

$ man git


$ git --help

for more info)

Follow i commits

GitHub: repository StefanoBelli / linuxCleaner-tools, branch master :: Commits

Click here to see all my repositories

Share the tool and maybe if you enjoyed sharing the article, follow me on GitHub.

Receive the latest posts by email

Enter the email and choose the inscriptions on the new page

Added devices
  • Compare Smartphone (0)
  • Compare Notebook (0)