If you want to clean up your Ubuntu host, you can follow some simple steps below to remove all unwanted junk files.
Remove unnecessary software packages
This is also a built-in function, but this time we don't have to use the new Package Manager (Synaptic Package Manager), but to achieve the goal in the terminal.
Enter the following command in the terminal window:
Sudo apt-get autoclean
This activates the package clearing command. What this command does is to automatically clear the system cache when you install or upgrade the program. deb package (that is, clear the/var/cache/apt/archives Directory, but only clear outdated packages ). To run the clear command, type the following command in the terminal window:
Sudo apt-get clean
Then you can use the automatic remove command. This command is used to clear software packages installed by an uninstalled software in the system as dependencies. To use the automatic remove command, type the following command in the terminal window:
Sudo apt-get autoremove
Remove unnecessary local data
To achieve this, we need to install the localepurge software, which will automatically remove unnecessary local data (LCTT translation: various language translation ). This software is a simple script that recycles disk space from the space occupied by localization files and localization online manual (man pages) that are no longer needed. This software will be automatically activated when running any apt installation command.
Install localepurge in Ubuntu:
Sudo apt-get install localepurge
After installing any software through apt-get install, localepurge will remove all online manuals for translation files and translations that are not using the language set in your system.
If you want to set localepurge, you need to edit the/ect/locale. nopurge file.
Based on the software you have installed, this will save you several megabytes of disk space.
Example:
If I try to use apt-get to install the dicus software:
Sudo apt-get install discus
After the software is installed, you will see the following prompt:
Localepurge: Disk space freed in/usr/share/locale: 41860 K
Remove an empty package
If you want to remove the orphan package, you need to install deborphan:
Install deborphan in Ubuntu:
Sudo apt-get install deborphan
Use deborphan to open the terminal and enter the following command:
Sudo deborphan | xargs sudo apt-get-y remove -- purge
Use GtkOrphan to remove an orphan package
GtkOrphan (a Perl/Gtk2 application for debian) is a graphical tool used to analyze the status of the user's installation process and find files in isolated libraries. It provides a GUI front-end for deborphan, it also has the function of removing software packages.
Install GtkOrphan in Ubuntu, open the terminal, and run the following command:
Sudo apt-get install gtkorphan
One screenshot
Remove an orphan package with Wajig
Wajig is a simple software package management frontend in the Debian package management system. It uses apt, apt-cache, dpkg,/etc/init. d. The script is integrated with a single command. It is designed to be simple to use and provide rich documentation for all its functions.
With proper sudo configuration, most (if not all) software package installation and creation tasks can be completed through a user shell. Wajig is also applicable to general system management. In addition, a Gnome GUI command gjig is also included in this package.
Install Wajig in Ubuntu, open the terminal, and run the following command:
Sudo apt-get install wajig
Debfoster --- tracking your operations during installation
Debfoster maintains a list of software packages that are explicitly required to be installed, but does not include software packages that are installed as dependencies of a software. The parameters are completely optional. You can even activate debfoster immediately after each running of dpkg and/or apt-get.
In addition, you can use debfoster in the command line to install or remove certain software packages. Packages with the suffix --- will be removed, and those without the suffix will be installed.
If a new software package or debfoster notices that the software package on which a software package depends is an orphan package, debfoster will ask you how to proceed. If you decide to keep this orphan package, debfoster will only record and continue the installation process; if you think this package is not enough to interest you, after debfoster asks this question, it will remove this software package. Further, if you decide to turn other software packages into standalone packages, more questions will come soon.
Install debfoster in Ubuntu, open the terminal, and run the following command:
Sudo apt-get install debfoster
Use debfoster
To create an initial trace file, run the following command:
Sudo debfoster-q
You can always edit the/var/lib/debfoster/keepers file to define the packages you want to stay in the system.
To edit this file, type:
Sudo vi/var/lib/debfoster/keepers
To force debfoster to remove all software packages not listed in the file above, or install them as dependencies of software packages listed in the file, it also adds all software packages that are not installed in this list. To perform related operations based on the list, you only need to execute:
Sudo debfoster-f
To track your newly installed software packages, you need to execute the following commands from time to time:
Sudo debfoster
Xdiskusage -- check where your hard disk space is
Displays the du of disk usage in a graphical manner. Xdiskusage is a user-friendly program that will show you the usage of all your disks. It was designed based on the "xdu" program written by Phillip C. Dykstra. You have made some modifications so that it can run the "du" command for you and display the remaining disk space. If you want to clearly know where your disk space is, it can also generate a PostScript format named display. xdiskusage file.
To install xdiskusage in Ubuntu, run the following command:
Sudo apt-get install xdiskusage
To open this application, run the following command:
Sudo xdiskusage
Once this application is opened, you will see the following interface:
Bleachbit
BleachBit can quickly release disk space and tirelessly protect your privacy. It can release the cache, delete cookies, clear Internet access history, smash temporary files, delete logs, and discard junk data that you do not know. Designed for Linux and Windows systems, it supports erasing thousands of applications, such as Firefox, Internet Explorer, Adobe Flash, Google Chrome, Opera, and Safari. In addition to simple file deletion, BleachBit also includes many advanced functions, such as crushing files to prevent recovery, and erasing disk space to hide traces of files deleted by other applications, "dust" for Firefox to make it faster. Better than free, BleachBit is an open source software.
Install Bleachbit in Ubuntu, open the terminal, and run the following command:
Sudo apt-get install bleachbit
One screenshot
Use Ubuntu-Tweak
Finally, you can use Ubuntu-Tweak to clean up your system.