Computer lessons

Cleaning Ubuntu of everything unnecessary. Ubuntu system cleanup Program for system cleanup in linux

Many users Windows, switched to Linux, know a program like CCleaner, which provides users with a powerful and easy-to-use tool for cleaning and optimizing 32-bit and 64-bit operating systems Microsoft Windows.
The utility is designed to clean up unwanted or non-working files, temporary Internet files created by popular browsers or programs, as well as to clean up incorrect file type extensions, missing applications and other “garbage” that has accumulated on the system during its operation.

OS Linux clogs much less Windows. They do not have a registry and the system architecture is designed in such a way as to leave as little “garbage” as possible. But in addition to system flaws, unnecessary program files, user files and unused kernels can accumulate in the file system. Therefore, with prolonged use, cleaning the system may be necessary in order to free up space for more necessary programs and files on the hard disk partition with the installed system.

There are different points of view on this matter. Some say clean the systems Linux not necessarily, they say it’s not Windows, and someone, on the contrary, suggests cleaning regularly/periodically, citing the fact that no one has ever suffered from cleanliness. But be that as it may, you need to know about such programs (I think).

IN Linux there are also similar programs CCleaner, this is first of all BleachBit, which is available in the program repositories of almost any distribution Linux. But it is most likely intended for advanced users, because... when used inappropriately BleachBit you can "clean up" to such an extent that the system will not boot anymore.

You can use safer terminal commands to clean up, like: clean, autoclean And autoremove.

Until recently, there was such a program as Ubuntu Tweak. Along with desktop settings Ubuntu, it offered a safe cleaning system that did its job properly, even for a novice user. Linux. But the Chinese developer, offended that the developers Ubuntu do not include the program in the official repositories, abandoned its development and now enthusiasts Linux offer installation of the latest developed version in user repositories.

But since development Ubuntu Tweak stopped, the most useful function in it remained System cleaning.
Developer Gerard Puig brought out of Ubuntu Tweak System Cleanup and created a program based on it Ubuntu Cleaner, while maintaining all the necessary functions.


Although Ubuntu Cleaner, was created for Ubuntu, the program installs and runs in distributions based on a package base Ubuntu: Linux Mint; Ubuntu MATE; Xubuntu, and also tested by me in the debian distribution - MX-16.

Installation Ubuntu Cleaner V Ubuntu 16.04/14.04 and derivatives

Open a terminal, copy and run the following commands:

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

For other distributions you can install Ubuntu Cleaner deb package from the repository ppa:gerardpuig/ppa .

After installation is complete, open the system menu and run the program:


Using the program is easy. Open the items you want to clear in the left column, they will appear in the right column. Look through them carefully, mark the one you need again in the right column, click the button Clean, which is located in the lower right corner of the program, enter the system administrator password, the one you entered during installation of the system, and the program will do the rest itself.

Have you ever wondered why a freshly installed Ubuntu with a basic graphical interface and a meager set of standard applications takes up as much as 2 GB of disk space? If so, then read on - we will put the penguin on a diet and make it take up much less space.

Formulation of the problem

Today's Linux distributions are not only fast, convenient and pleasing to the eye, but also incredibly bulky. As standard, most of them take up more than 4 GB. And this despite the fact that they are able to provide the user with only one graphical environment and a small set of applications (by the way, there are not even codecs for playing audio and video files). Where do the treasured gigabytes of free space go?

Oddly enough, the reason for Linux's gluttony lies in its main advantage. A good Linux distribution is a very flexible operating system that can adapt to any user and any hardware. It has everything to satisfy the needs of 99% of users: a huge number of drivers that can breathe life into almost any piece of hardware; a bunch of different demons, applets and widgets that make communication with these pieces of hardware simple and clear; a set of the most popular applications by users; support of several languages; various tools for people with disabilities and much more. All this can and should take up some space on your hard drive. Linux provides no less freedom of choice to programmers. Without any standardized interface to communicate with the operating system in the form of a single API, such as win32 in Windows or Cocoa in Mac OS X, Linux encourages the use of any programmer-friendly interfaces and runtime environments. The developer is free to choose his own GUI libraries, be it GTK, Qt or even FLTK. He can use any available libs without worrying that they will not be on the target system, because the package manager will install them on its own anyway. He can write applications in almost any existing programming language, and all the necessary interpreters, virtual machines and libraries will also be automatically installed. It goes without saying that when bundling the installation disk, all these endless dependencies will be included in the package, and during installation they will end up on the user's hard drive. And you shouldn’t even hope that the distribution developers will select software based on its number of dependencies and making sure that they don’t drag anything unnecessary into the system. For example, the standard Ubuntu distribution includes a simple note-taking program called Tomboy, and this small program takes up all of mono's runtime, taking up more than 30 MB of disk space. There are many more different nuances in the structure of the Linux distribution that make it more cumbersome, but those described above are the basis from which we will build, ridding the penguin of the fat layer.

Getting rid of trash

Let's start by trying to cleanse the system of clearly unnecessary slag, while preserving the original Ubuntu desktop almost unchanged and installing all any necessary applications in place.

So, install Ubuntu and execute “df -h”. The amount of occupied disk space is no less than 1.9 GB. We immediately look at the application menu. Here we have a Games section, which is hardly of any value. We delete all its contents with one command:

$ sudo apt-get purge gnome-games-common gbrainy

The gnome-games-common package will pull down aisleriot, gnomemahjongg, gnome-sudoku, gnomine, quadrapassel along with all configuration files and free up 20 MB of space for us. We go to the menu again, the most useless thing is now in the Accessories item. These are a calculator (gcalctool), a font research program (gucharmap), a disk space usage analyzer (baobab), a file search program (gnome-search-tool) and that same Tomboy. Delete:

$ sudo apt-get purge gcalctool gucharmap baobab gnome-search-tool tomboy

This operation will give us another 10 MB of space and open up the opportunity to get rid of mono. We do:

$ sudo apt-get purge mono-2.0-gac mono-charp-shell mono-gac mono-gmcs mono-runtime

That's another 30 MB.

We return to the menu again. From the completely uninteresting: a program for recording from a microphone and a video editor pitivi. Unfortunately, it is difficult to immediately determine whether a voice recorder belongs to any package, so we will install the apt-file utility, which will help do this:

$ sudo apt-get install apt-fi le
$ apt-fi le update
$ apt-fi le search /usr/bin/gnome-sound-recorder gnome-media: /usr/bin/gnome-sound-recorder

The package we need (more precisely, not needed) is called gnome-media, delete it:

$ sudo apt-get purge gnome-media

$ sudo apt-get purge gnome-dictionary wamerican vinagre tsclient rdesktop

Another 5 MB and a cleaner menu. The rest of the programs can be left in place for now and get rid of rubbish such as documentation, goodies for people with disabilities, examples, a screen saver and the Ubuntu testing system:

$ sudo apt-get purge gnome-accessibility-themes gnome-doc-utils gnome-mag gnome-screensaver screensaver-default-images xscreensaver-* gnome-user-guide example-content checkbox* branding-ubuntu

This will free up another 167 MB of space. Next, we will deal with “dangling” dependencies - packages that were listed in the dependencies of packages we have already removed and are now no longer needed. To do this we need the orphaner program included in the deborphan package:

$ sudo apt-get install deborpan

We launch the program, see the list of “orphans”, mark them with a space and select the “OK” button. At the end of the procedure, a list will be displayed again, this time listing the "orphans of orphans". We repeat all steps until the list is empty. Further cleaning will inevitably affect the functionality and appearance of the distribution, so those who love Ubuntu for what it is should stop there. Everyone else, welcome to the next section of the article.

A bunch of kernels in the boot menu

Over time, the Ubuntu boot menu may acquire a large number of kernel variants (updating the kernel does not remove the old kernel). To clear it, just run the following command:

$ aptitude purge $(aptitude search ~ilinuximage -F %p|egrep -v "$(uname -r)|linux-imagegeneric")

Big cleaning

Ubuntu includes quite a lot of applications, and not every one of them suits all users. For example, I haven’t used email programs for several years now, preferring the web interface of gmail, and the interface of the standard Ubuntu player Rhytmbox makes me sick (as, indeed, its ideological parents - Amarok and iTunes). Therefore, for me they are of no interest and only clutter the menu. Someone else may not need the IM client and office suite. And all this can be abandoned painlessly.

Probably the thickest component of Ubuntu is OpenOffice. It is, of course, very necessary if you are a student, a teacher or a secretary, but for most people it does not give up at all, so we get rid of:

$ sudo apt-get purge openoffice*

Another 256 MB of cleanliness. Not bad. Next in line: the inconvenient mail client Evolution, the completely useless video player Totem and the audio player for fans of licensed music Rhytmbox:

$ sudo apt-get purge evolution evolution-common evolution-data-server evolution-indicator evolution-plugins evolution-webcal libevolution totem totem-common libtotem* rhytmbox mediaplayer-info libgnome-media0

This is another 26 MB and a strong feeling of being right. Now we can remove the gstreamer multimedia framework used by Totem and Rhytmbox, but there are two pitfalls here. Firstly, gstreamer is heavily tied to the entire system, and completely getting rid of it will entail removing some necessary system packages. We can only get rid of the framework's utility packages, but even then we'll have to say goodbye to the Brasero disc burning program. If this is not important, then do the following:

$ sudo apt-get purge gstreamer0.10-alsa gstreamer0.10-nonlin gstreamer-0.10-nice gstreamer0.10-plugins-base gstreamer0.10-plugins-base-apps gstreamer0.10-plugins good gstreamer0.10-pulseaudio gstreamer0. 10-tools gstreamer0.10-x gnome-codec-install brasero*

Ubuntu comes with Shotwell photo manager. It may be convenient for those who take fifty photos a day, but for the average person it is much more convenient to view photos through Nautilus:

$ sudo apt-get purge shotwell

This is 4 MB. There are also things like the Empathy IM client and the Gwibber social networking client. In many ways, useful programs, but meaningless for people who cannot stomach socialism:

$ sudo apt-get purge empathy empathy-common telepathy-* gwibber gwibber-service

18 MB down. You can also remove the transmission BitTorrent client and the firefox browser, but this is already blasphemy and is only permissible if they are replaced with Deluge and Google Chrome. Now let's move on to the "System Administration" menu. It has many more important applications, but still a lot of unnecessary stuff. For example, I absolutely do not understand the purpose of a program called Computer Janitor. She had never found something truly useless and cleaned the system in any way. Accordingly, into the firebox:

$ sudo apt-get purge computer-janitor*

The language selection utility is also a rather controversial program, in most cases completely unnecessary:

$ sudo apt-get purge language-selector language-elector-common

Now let's talk about hardware support. As I already mentioned at the beginning of the article, Ubuntu supports a huge number of different hardware, for each of which the system has not only a driver that takes up several tens of kilobytes, but also a much heavier package in the form of various daemons and applications that work with this driver.

For example, Ubuntu supports Bluetooth technology very well, for which the system has drivers, daemons, and graphical configuration programs. The only question is whether blue-toothed is needed in our time of dominance of 3G and Wi-Fi networks. I think many people no longer do. Therefore, in most cases, you can refuse Bluetooth support:

$ sudo apt-get purge bluez*

This command will remove not only the Bluetooth protocol implementation distributed in the bluez package, but also all its dependencies in the form of gnome libraries and GUIs. The gain is modest: 12 MB.

Next, do you have a scanner at home? If not, then support for scanners in the system is not needed. Ubuntu offers a simple document scanning program called Simple Scan, which relies on the standard SANE scanner library. By removing the latter, we will remove support for scanners completely:

$ sudo apt-get purge libsane

This will give us an additional 15 MB. Third: you probably have a printer, and most likely it is connected to your home machine, so if you are cleaning Ubuntu installed on a laptop, then you can also get rid of printer support:

$ sudo apt-get purge cups cups-common hpijs hplip-data gsfonts

Now it's time for video drivers. Ubuntu contains a full set of Xorg drivers, but we only have one video card. Accordingly, everything else can be removed, but to do this you will first have to find out which drivers are supported by the hardware, so as not to accidentally remove the one you need. This can be done using the following command:

$ cat /var/log/Xorg.log.0 | grep "autoconf gured driver"

Immediately after the word "Matched" the driver name will be indicated; you need to remember it. In this case, there may be several drivers, this is quite normal, and it is better to leave them all. The rest can be removed using apt-get. Just type "apt-get purge xserver-xorg-video-", double click and delete everything in order, except for those names that we remember. For example, you can take the following command, which removes all drivers except fbdev and vesa:

$ sudo apt-get purge xserver-xorg-video-(apm,ati,chips, irrus,geode,i128,i740,intel,mach64,mga,neomagic,nouveau,nv,openchrome,r128,radeon,rendition,s3,s3virge ,savage, siliconmotion, sis, sisusb, tdfx, trident, tseng, vmware, voodoo)

You can also rub various goodies for nVidia and ATi drivers:

$ sudo apt-get purge nvidia-* fglrx-modaliases radeontool

And along with them are the kernel header files, which are included in Ubuntu only to assemble and install modules for proprietary video drivers, but in a normal situation they are rarely needed and take up 90 MB:

$ sudo apt-get purge linux-headers-*

There are still quite a few different utilities and libraries left in the system that are specific to specific pieces of hardware, but we can spend the whole day dealing with each of them. Instead, we will get rid of the junk hidden deep within the system. For example, compiz (unless, of course, you need desktop effects):

$ sudo apt-get purge compiz*

The speech synthesis system can also be thrown away; it is needed by people who have vision problems:

$ sudo apt-get purge espeak* speach-dispatcher gnome-rca

Tools for developers are also most likely not needed (of course, if you are not a developer yourself):

$ sudo apt-get purge gcc-4.4 gdb make

The courchdb database along with erlang, used to store various information in Gnome, is also not needed:

$ sudo apt-get purge erlang* courchdb

The smbclient library, used to access Windows balls, is not needed on separate machines (and it also takes up more than 50 MB):

$ sudo apt-get purge smbclient linsmbclinet

We also don’t need xulrunner, which is used to create XUL interfaces:

$ sudo apt-get purge xulrunner-1.9.2

You can also cut the following console software: dc, bc, ed, ftp, lftp, pcmciutils, screen, rsync, strace, xterm, lsof, w3m, telnet, tcpdump, vim*. In this case, you should be guided by a simple rule: if you don’t know what it is, then you don’t need it.

That seems to be all. Now let’s run orphaner so that it can clean up the remaining dependencies for us:

Let's look at the amount of free space:

1.4 GB, the command "sudo du -sh /" will give a more accurate 1.3 GB. We subtract the size of the /var directory from them (you can get it like this: “du -sh /var”) and we get 1.1 GB. Almost twofold reduction in weight while maintaining the full functionality of Gnome, including configuration utilities, administration, installing and uninstalling packages, and creating network connections. We also still have access to the Firefox browser, Evince document viewer, Nautilus file manager, Eye of Gnome photo viewer and file-roller archiver.

But moreover, we can free up about 90 MB of space if we remove the documentation and unnecessary locales:

$ sudo apt-get install localepurge

We mark in the list “en” and “en_GB” (if we are working in the English version of Ubuntu), or “ru” and “ru_RU” (for the Russian version).

Let's run the program:

$sudo localepurge

Now we remove the documentation:

$ sudo /usr/share/(doc,gtk-doc)

Back to the roots

Now let's talk about what to do for people who don't want Gnome on their desktop and would like to replace it with something lighter.

In the case of any other distribution, the recipe would be extremely simple: remove all packages with the word gnome in the name, plus clean up the remainder by removing applications and libraries. But this trick won't work with Ubuntu, it has built-in "foolproofing" which, if any of the packages that break Gnome are removed, will force the installation of the kubuntu-desktop package, dragging the entire KDE with it (just try to remove gnome, and you will see what apt-get suggests for installation). Therefore, you can completely clear Ubuntu from Gnome in only two more or less simple ways: either download Ubuntu Server and install it in a minimal configuration, and then install everything that is required, or bypass the security system by deleting all gnome packages at once.

I won’t explain the first method, but I’ll say a few words about the second. In Ubuntu, there is simply a huge number of packages that make up the Gnome environment, you will have to enter their names manually until the evening (and if you are reading this in the evening, then until the morning), so I prepared a list of the necessary packages in advance and put it on . All that is required is to simply copy its contents as an argument to the "apt-get purge" command.

conclusions

The cleaning method described in the article works perfectly and has been tested more than once by the author. Of course, we could achieve even more impressive results by shrinking Ubuntu together with Gnome to 500 megabytes, but it would take a whole book to describe all the steps necessary to achieve such a goal.

Info

  • Don't be afraid to remove a package unless you're sure someone else needs it. The apt-get utility will show a list of its dependencies before removal, and you can make a decision.
  • To prevent the cache of packages downloaded using apt-get from cluttering up the system, it must be cleaned periodically: sudo apt-get clean .

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.

In the Ubuntu operating system, obsolete or unnecessary files are not automatically destroyed. But they can be removed to save space. Here is my example of how to remove outdated and unnecessary configuration files. To remove unused configuration files, use this command (in terminal):

Sudo dpkg --purge $(COLUMNS=200 dpkg -l | grep "^rc" | tr -s " " | cut -d " " -f 2)

Note that it is also possible to remove configuration files when uninstalling a package via Synaptic by checking for "complete uninstall".

Adept Manager using "Request Cleanup". Using the -purge command

Sudo aptitude remove name-of-package --purge

Let's remove the packages in the cache. When you download and install packages, they are cached to avoid having to download them again. To remove these packages, you can use two commands: aptitude or apt-get (aptitude is better): autoclean removes packages that cannot be downloaded. "clean" removes all cached packages. So enter:

Sudo aptitude autoclean sudo aptitude clean

It is necessary to work with the kernels. When upgrading the kernel, old versions still remain. To remove an old version of the kernel, you must know the exact package name, Linux images kernel.version-indexofimage are native

The best way is to try to remove old kernels through a package manager. Launch your root manager mode kdesu adept_manager if you have kde and adept, gksu synaptic for synaptic and Gnome (or Xfce)), then search "linux-image". If you have adept, uncheck the "not installed" box on the display (below the search bar). If you have synaptic, sort the packages installed first through the first column. If you have multiple versions of the kernel or have different images of the same kernel, you can remove older versions. It is advisable to always keep the latest two versions at a minimum. If the upgrade fails for the latest kernel version, you can still revert to an older version instead of viewing the liveCD.

Now let's work with the log files. Most software services have logs/var/log files. Sometimes they are useful for solving problems, but they still take up a lot of space. Most services rotate logs (to keep a limited number) or limit their size, but not always. It's better to delete.

Don't forget to empty your Linux trash bin regularly. To do this, use the following command line:

Rm -rf ~ /.local/share/Trash/files/*

Mini images. As you browse the Internet, Linux will save thumbnails of images to make them easier to download in the future. Usually they are not deleted. The code below will remove the thumbnails within 7 days.

Find ~/.thumbnails -type f -atime +7 -exec rm () \;

Configuration of remainders in /home directories

Even if you uninstalled the software or deleted its configuration files from the /etc directory, the software may have left configuration files in each user's home directory. For example, the MPlayer software leaves files in the ~/.Mplayer directory. Same for most applications. Please note: these files may vary in size. For example, Google Earth stores a cache (at least 200 MB in size) in each user's home directory.

Please note: for partitions on external drives (USB drives, MP3 players, NTFS partitions...) Nautilus (ubuntu file browser), creates a Trash-username folder containing deleted files. Don't forget to delete this folder as well (press CTRL + H in Nautilus to see hidden files).

We automate tasks

Just create files containing these commands:

For legacy configuration files:

Pkg --purge $ (COLUMNS = 200 dpkg -l | grep "^rc" | tr -s "" | cut -d "" -f

For packages stored in cache:

Sudo aptitude clean

I think this is enough, but I will be glad to add in the comments

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 since 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