General cleaning of Ubuntu. Cleaning ubuntu from everything unnecessary How to clean linux mint from garbage

How to free up disk space in Ubuntu? What do we do in this situation in Linux?

Wanted to clean up junk in Ubuntu, but were afraid to use the terminal? In the material below you will find a detailed description of several applications with a graphical interface with the help of which you can clean up garbage and not be afraid that you are executing a command in the terminal and do not understand what it is responsible for.

Let's imagine a task, we need to clean up the garbage. How to free up disk space in Ubuntu? What will we do in this situation?

Unlike Windows, where all the necessary tools are built into defragmentation and garbage cleaning occurs almost automatically, Ubuntu does not have such tools, but later in the material we will look at 4 ways in which you can free up free disk space that is occupied by hundreds of meters of files cache from the browser and apt cache and other garbage.

1. Clear APT cache (do this regularly and your system will breathe freely)

It sounds so obvious, and yet there's a good chance you haven't done it yet.

By default, in the Ubuntu distribution and the entire family of Debian relatives, files from each update are saved in the cache, that’s right, when updating, the files are downloaded, installed and then stored in the cache on the hard drive, just in case, in case you ever need these files again again. Alternatively, you deleted a certain application, but did not clear the cache, then you will want to install it again, but the application will no longer be downloaded from Canonical's servers again, but will be installed from the cache.

This is only useful if you very often (regularly) install and uninstall applications, it can be useful if you installed the application, but some bug arose and you again needed to reconfigure / reinstall a certain package, or you have a slow Internet (poor connection) in such situations this is very useful because you don’t have to re-load the network, which is already very weak.

But the other side of the coin is that the APT package cache can quickly increase from several tens to several hundred megabytes; when I clear it, sometimes it reaches up to 500 meters, this is the maximum I had.

To determine how many megabytes of APT cache we have collected, let’s run several commands in the terminal:

Du -sh /var/cache/apt/archives

As an example, I executed the command above and we have the following output:

147M /var/cache/apt/archives

As you can see, I now have almost 150 meters of APT cache.

To clear the APT cache, run the command in the terminal:

Sudo apt clean

after that the entire cache will be automatically deleted.

APT CLEAN is a command that removes all apt cache (packages), regardless of age or need, all clean. As I said above, if you have a slow internet connection, you may want to consider skipping this step and check out the next ones.

2. Uninstall unused applications

Most likely, you, like me, work without noticing that you have many installed applications on your system that you never use. Perhaps you installed it to see what the application is like, perhaps to write a review if you are a blogger, perhaps for a specific task and after that the application remained hanging in the system, taking up disk space.

Whatever the excuse, if an application is no longer needed and takes up free disk space, do not be afraid to get rid of such garbage and delete it.

Typical applications that you may want to remove, such as web browsers (which you have used several times and are still hanging around as unnecessary ballast Opera, Epiphany, Midori and Min), music players, the same Libre Office, standard system games, if you don’t use, get rid of and remove all this garbage. I use WPS Office as an alternative office, so I don’t need Libre Office, it takes up more than a hundred meters, everything needs to be deleted.

To remove you can use the following command:

Sudo apt remove package1 package2

like this, separated by a space, you can list a large number of applications in one command and delete them at once, don’t be friends with the terminal, use the Ubuntu Application Center/Ubuntu Software.

To remove packages and dependencies that are no longer needed (because you removed the application or other packages or newer versions were installed that replaced older ones), run the following command:

Sudo apt autoremove

removing unused packages from cache:

Sudo apt autoclean

If you have deleted an application, it will be good if you immediately clear the cache behind it by running the command:

Sudo apt autoremove application_name

installing dependency packages that were not fully installed:

Sudo apt -f install

if such dependencies exist, you will see a proposal in the console to install certain packages.

3. How to remove old kernels (if you no longer need them)

By frequently installing updates and installing the latest versions of kernels using the built-in system Ubuntu Software, you accumulate a decent list of kernels, which you see when you boot the system in the Grub menu. Of course, a list of several versions of kernels always has its advantages. Let’s imagine a situation where you installed a new kernel, but it encountered problems that prevent it from working normally (bugs and other shortcomings), in this case another version of the kernel will save you.

And if there is no other version of the kernel, this is of course an emergency situation, the only way to save the situation is by installing one of the versions using the console, this happens rarely, I didn’t have to save myself through the console by installing a new version of the kernel, what saved me was that there was at least one nearby Another version of the kernels, two were enough for me.

Now I have two versions installed:

  • 4.4.0.31
  • 4.4.0-34 - the main one used on an ongoing basis

I would advise you to do the same and always keep a spare site for work since there is never a guarantee that everything will be stable. If you have more than two versions of the kernel side by side, you can remove the unnecessary ones by running the following command in a terminal window:

Sudo apt autoremove --purge

Please note that this command will only remove kernels that a) are no longer needed, and b) were installed from the Ubuntu archive via system updates. If you install the kernel manually or using third-party PPAs, you will have to remove it manually. If no Old kernels are detected, this command will check the system for packages that remained on the system after removing applications and offer to remove if anything is found.

As an example, let's look at what kernel we are currently using:

Sudo uname -a

I see the following output after running the command:

Linux linuxsoid 4.4.0-34-generic #53-Ubuntu SMP Wed Jul 27 16:06:39 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

Let's think logically, our version is 4.4.0-34, everything below can be demolished.

Let's look at what kernel versions we still have in the list, run the commands:

Dpkg --list | grep linux-image dpkg --list | grep linux-headers

we have the following output:

Ii linux-image-4.4.0-31-generic 4.4.0-31.50 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP ii linux-image-4.4.0-34-generic 4.4.0-34.53 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP ii linux-image-extra-4.4.0-31-generic 4.4.0-31.50 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP ii linux-image -extra-4.4.0-34-generic 4.4.0-34.53 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP ii linux-image-generic 4.4.0.34.36 amd64 Generic Linux kernel image ii linux-headers -4.4.0-31 4.4.0-31.50 all Header files related to Linux kernel version 4.4.0 ii linux-headers-4.4.0-31-generic 4.4.0-31.50 amd64 Linux kernel headers for version 4.4.0 on 64 bit x86 SMP ii linux-headers-4.4.0-34 4.4.0-34.53 all Header files related to Linux kernel version 4.4.0 ii linux-headers-4.4.0-34-generic 4.4.0-34.53 amd64 Linux kernel headers for version 4.4.0 on 64 bit x86 SMP ii linux-headers-generic 4.4.0.34.36 amd64 Generic Linux kernel headers

Based on this list, we understand that you can remove version 4.4.0-31; to do this, run the commands:

Sudo apt-get purge linux-image-4.4.0-31 sudo apt-get purge linux-headers-4.4.0-31

In terms of cores, that’s probably all. Although there is another command that will allow you to remove kernels of several versions in a row if they are in order, that is:

  • 4.4.0-31
  • 4.4.0-32
  • 4.4.0-33
  • 4.4.0-34
  • 4.4.0-35

I hope the principle is clear, in this case, in order for us to remove all these 5 versions of kernels, we just need to run the commands in the terminal:

Sudo apt-get purge linux-image-4.4.0-(31,32,33,34,35) sudo apt-get purge linux-headers-4.4.0-(31,32,33,34,35)

Be very careful when removing kernels so as not to accidentally ruin the system. After executing these commands above, the kernels will be removed, the grub loader should be automatically updated and the list of current kernels that are available when the system boots will be reduced, sometimes incidents happen due to which the grub loader may not be updated, then this must be done manually by running the commands:

Sudo update-grub sudo update-grub2

this should help and the bootloader will be updated.

Removing old kernels via GUI

The console option for removing Ubuntu kernels is described above, but there is also a graphical option, I know that beginners are afraid of the terminal like fire, in this case it is possible to remove using the Software Center application manager, which still needs to be installed if you have Ubuntu 16.04.

To install, open a terminal (Press Ctrl+Alt+T) and run the command in the terminal:

Sudo apt-get install software-center

As you probably know (have heard), in the Ubuntu 16.04 LTS distribution, the developers replaced the old application center with the Gnomish Ubuntu Software, in which they turned on foolproof protection and now you cannot delete kernels using the search as was available from the old application manager.

Removing kernels and cache, both browser and APT, and thumbnail cache via Ubuntu Tweak

Yes, the Ubuntu Tweak application handles removing old kernels, clearing thumbnail cache, browser cache, email clients, system cache (APT, unused packages/package settings) and all this is available by checking the box and confirming the removal by entering the administrator password when prompted. Instructions for installing Ubuntu Tweak are available in the material -.

4. Use the BleachBit application to clean up garbage in the system

BleachBit- it's something like CCleaner on Linux, which is similar to the same thing, I assure you that it is used in Windows for global garbage cleaning and, most importantly, without harm to the system, as this is possible in applications like GTKOrphan, due to inability to use such applications, you can ruin the system very easily. The application can remove almost all the garbage for most applications that are used in the system and have a cache, temporary files that accumulate and accumulate every day of work in the system, gaining hundreds of megabytes of disk space that can be used for more popular purposes than for storing system garbage.

The BleachBit utility can destroy the caches of more than 70 popular applications (including those for most web browsers); outdated packages, application files, bash history; which significantly simplifies the operation of the system.

Not surprisingly, I recommend installing this application as one of the main tools along with Ubuntu Tweak, for regular cleaning of garbage in the system.

You can install BleachBit on Ubuntu 16.04 LTS directly from Ubuntu Software by using the search where by entering the appropriate query, you can install this application in 2 clicks. Launch the BleachBit as Root option, check the boxes next to the applications, cache and temporary files that you want to clear. In the upper left corner, click the "Preview" button to get an estimate and visual visibility of how much space certain files (cache, temporary files, etc.) take up, look, click on the "Clear" button to delete them, that's all , now the system will breathe deeply)).

Installing an analogue of CCleaner, BleachBit on Ubuntu Linux

To install the BleachBit application on Ubuntu, open a terminal (Press Ctrl+Alt+T) and run the following command:

Sudo apt install bleachbit

After installation, you can find the application either in Dash using search or in the Ubuntu menu - System Utilities - BleachBit as Root.

conclusions

Slightly crazy title, isn't it? 🙂 Experienced users will definitely chuckle, and newbies will be happy. And all because, while using Windows, it was constantly necessary to clean and optimize the OS so that it would not simply slow down due to “cluttering” with old files, unnecessary keys in the registry, and so on. It’s just that when I just switched from Windows to Ubuntu I tried to find mana on optimization and I understand beginners perfectly well.

However, in Ubuntu you still need to sometimes clean the system from the cache with old packages (I use it for this), with which the program BleachBit, described below, does an excellent job. It is also capable of cleaning up many other temporary files, application caches and other “junk” places. I liked the file cleaning feature Thumbs.db, which Windows creates anywhere and everywhere. An overview of the program is below.

When the operating system is running, garbage inevitably accumulates in its various dark corners. These could be remnants of deleted programs, temporary files, logs, browser caches and other unnecessary things. Not all of this garbage can be collected and thrown away manually, so special cleaning programs are used for this. The topic of cleaning in Windows is pretty well covered, so let's talk about cleaning in Ubuntu.

Through the efforts of some open source preachers, the opinion has been created that Linux is a super reliable and perfect system that does not even need maintenance, unlike “that Windows of yours.” However, this is not at all true, and dirt, for example, accumulates in Ubuntu no less, and maybe more, than in Windows. Therefore, to clean up disk space, speed up the system, and safely delete data, it is better to use the utility BleachBit.

BleachBit is a convenient free system cleaning program that has versions for both Linux and Windows. The utility has a simple and intuitive interface in Russian. All points are provided with detailed tips, so its use will not raise any questions even for novice users.

The principle of working with the program is very simple and boils down to selecting cleaning options using the checkboxes in the middle column. After that, you can click the "Preview" button to search for garbage and then "Delete" to remove it. My program literally found more than a gigabyte of unnecessary files in just a few seconds.

In addition to the usual search and removal of garbage, BleachBit can perform a number of special operations:

  • Linux memory and swap cleanup
  • Removing faulty shortcuts
  • Removing unused localizations
  • Cleaning APT for Debian, Ubuntu, Kubuntu, Xubuntu and Linux Mint
  • Overwrite clean space to prevent previously deleted files from being recovered
  • Compresses databases of many programs to save space

Please note that some program functions require elevated rights, so you should run the program with administrator rights, for which there is a special shortcut in the main menu.

Generally, BleachBit is an indispensable assistant for keeping your system clean and freeing up additional space on your hard drive.

You can install the program from the Ubuntu Application Center or by downloading the installation file from the program website. There is also a version available for download for Windows, which can clean up traces of work in more than 500 programs and is a worthy competitor to Ccleaner.

Linux is a wonderful operating system. But it also needs care, cleaning, cleaning, since it also gradually accumulates unnecessary garbage in the form of old packages, no longer needed configuration files, temporary files, and so on. There are many special utilities for Windows, for example, the well-known ccleaner.

The program cleans Windows well of everything unnecessary; I have used it myself more than once. Is there something similar for Linux? about all the unnecessary junk?

1. How to clean Linux using Bleachbit?

The first thing you can start with is to install the right program, which brings everything together. This is the Bleachbit program.

Sudo apt-get install bleachbit

In the menu - system utilities, the bleachbit program will appear, or rather even two shortcuts. One can be run as normal users, the second with administrator rights. It is clear that in the second case you can clean much more than in the first. Launch bleachbit (root):

What do we see?

autoclean: for removes only "incomplete" packages from the cache.

autoremove: Removes uninstalled dependencies from already removed packages.

clean: This is when you need to free up as much space as possible and delete the entire cache.

Bash: Delete command history. These are small things, and it’s not at all clear why it’s needed - unless you want to hide the commands that you typed.

Now just check the boxes next to the items you want to clean. After that, click the “Clear” button. That's all, you can clean up Linux in this way very simply! But there are other ways.

3. How to clean Linux using Mundus?

But garbage accumulates not only in system files, but also in the home directory. We install programs, then delete them, but the settings files from these programs remain in the home directory. How to clean the system from this garbage?


There is also a special program for this, called Mundus, which can be downloaded from the developers’ website - launchpad.net/mundus. Download the .deb or .rpm package and install it as usual. The output is the following program:

After launching the program, it immediately starts scanning the home folder, after which it produces all configuration files.

After this, you can manually clean unnecessary configs using the "Clean" button. I just started using this program myself, so I haven’t learned the intricacies yet, but I think there’s nothing complicated.

Undoubtedly, there are other programs and ways to clean up Linux, but these two programs are basically enough. If you know other ways to clean Linux, please write in the comments.


Did not find an answer to your question? Use the search...

11 comments

11 comments to the article “How to clean Linux?”

    good utility - replaces cd /var/cache/apt/archives and then sudo rm *.deb - less clicking on the keyboard))) interesting, but there are ways to find out (besides direct viewing) which configs in /home are no longer needed, etc. are the “tails” of deleted applications and, in general, where else do the “tails” remain after uninstallations?

    I've never seen one like this. And is it necessary? We deleted the program, but your individual settings remained in it. And then they decided to install it again - and oops, everything was set up again right away. And in general, it’s probably easy to remove it manually. And this does not affect performance, not to mention free space.

    Although if I meet, I’ll write here.

    I found a program that can clean up my home folder and finished the article.

    Ubuntu Tweak does not clear thumbnail cache in ubuntu 14-04. In ubuntu 12-04 everything was fine.

    Yes, the program has completely deteriorated, the first versions were wonderful, and then somehow everything went wrong, I personally stopped using it.

    Thank you, I’ll insert a phrase into the article that you need to act CAREFULLY!

Today I would like to touch on the topic of cleaning the system from garbage. Let's look at the example of Ubuntu.

No matter what they write about how good Linux is and how well everything is thought out in it, after a long time working with the system: installing/uninstalling programs, updates, working in applications, a sufficient amount of garbage accumulates in the OS. This includes package manager cache, browser cache, various unused packages, program settings, etc. In most cases, you don’t need all this and only takes up space on your hard drive.

Naturally, all the garbage can be cleaned using the terminal, or you can use a convenient program that will do everything itself. This is the Ubuntu Tweak program. In addition to cleaning the system, it has a large number of other functions for configuring Ubuntu, but in today’s article we will not touch on them.

Installing Ubuntu Tweak (Tested on Ubuntu 14.04)

Let's first install the program. Despite the fact that Ubuntu Tweak is a fairly popular system tweaking utility and has been around for almost nine years, it is still not in the standard repository and therefore we need to first add the developers' repository:

Sudo add-apt-repository ppa:tualatrix/ppa

We update the cache:

Sudo apt-get update

And install Ubuntu Tweak:

Sudo apt-get install ubuntu-tweak

Now we can use the program.

Cleaning Ubuntu with Ubuntu Tweak

We launch the program through the Dash menu and go to the “Cleaning” tab

The working window is divided into two parts. On the left there is a tree with items, this is what can be cleared using Ubuntu Twek. We mark what is needed, I recommend marking everything. After that, click “Scan” in the lower right corner of the window.

After scanning, a list of found garbage will appear on the right side of the window.

It also needs to be ticked and now, to start cleaning the system, click the “Clean” button, which is also located in the lower right corner.

The program will ask for the administrator password. Enter and wait for the cleaning to complete.

BleachBit is an open source program that is designed to clean up free space and increase productivity, it is written in Python. The program is intended for Windows And Linux operating systems and is capable of erasing thousands of applications, including Firefox, Internet Explorer, Adobe Flash, Google Chrome, Opera, Safari etc. By using BleachBit you can clear the cache, delete cookies, clear Internet history, open temporary files, delete logs and throw out garbage. BleachBit not only cleans the system of garbage, but is able to shred files in order to prevent their recovery, ensuring confidentiality, and also cleans Firefox to make it faster.

Developer's website BleachBit: https://www.bleachbit.org/

For installation BleachBit V Ubuntu use the command:

$ sudo apt-get install bleachbit

or package manager Synaptic

BleachBit will help you clear potentially unwanted browser caches, old kernels, etc., and handle other system maintenance work.

BleachBit very powerful and its advanced features can be challenging for beginners.

Stacer - system optimization utility for Ubuntu

Stacer is an open source application that allows you to monitor the resource consumption of the operating system. The program is written using Framework Electron. The utility allows you to clear the cache, remove unwanted applications, and even stop and start system processes running in the background. The only negative is the lack of a Russian-language interface. But the program is intuitive.

To start installation Stacer, please download the installation package first. It is available at: https://github.com/oguzhaninan/Stacer/releases

Ubuntu Cleaner

Ubuntu Cleaner- a program designed to clear browser caches and remove unnecessary applications. Ubuntu Cleaner based on program developments Ubuntu Tweak created by a Chinese developer Ding Zhou(Ding Zhou) specially for Ubuntu OS.

Author of the project Ubuntu Tweak suspended its development since 2014 and switched to developing a paid analogue for MacOS. But be that as it may, Ubuntu Tweak is alive and can still be used for customization Ubuntu 16.04.

At its core Ubuntu Cleaner- a convenient alternative BleachBit. Ubuntu Cleaner is aimed at novice users who are little familiar with the structure of GNU Linux systems.

In order to install Ubuntu Cleaner from your own allocation PPA run the commands:

$ sudo add-apt-repository ppa:gerardpuig/ppa $ sudo apt-get update $ sudo apt-get install ubuntu-cleaner

Possible installation option .deb package.

Program Ubuntu Cleaner available at: http://ubuntu-cleaner.blogspot.ru/2016/06/ppa.html

DupeGuru

DupeGuru is a tool for finding and removing duplicate files. The program will scan a folder or disk, check all files by name, content, weight and display the result in the form of a visual table. Detected duplicates will be deleted, optionally moved or replaced with hard links (with the latter maintaining the directory structure, space must be freed up). In addition, there are two more versions of the program, specialized in each application: service Music Edition for sound files and service Picture - edition for images. These specialized versions are now part of the main program, but are still found in the package name.

The program is currently being developed for Mac And Linux. Version for Windows is no longer supported by the developer, but it can be downloaded from the official website and is fully functional.

To install the latest stable version DupeGuru V Ubuntu, you can use PPA repository. To do this, run the following commands in the terminal:

$ sudo add-apt-repository ppa:hsoft/ppa $ sudo apt-get update $ sudo apt-get install dupeguru-se

Search version duplicate music:

$ sudo apt-get install dupeguru-me

Search version duplicate images:

$ sudo apt-get install dupeguru-pe

Selecting an object in DupeGuru

DupeGuru settings panel

Results panel in DupeGuru

Developer DupeGuru coined the term for his software " goods fair " This means that sometimes there is a call for donations at launch. Those who do not donate will use the license program BSD only limited.

Great alternative DupeGuru is Flint.

Continuing the topic:
Apple

Operators / 10/24/2017 MTS phone firmware (Smart Race, Sprint, Surf, Run 4G) MTS, like any other operator, offers its customers various models of smartphones for...