Preface after Linux computer is installed, various junk files will be generated in the hard disk due to activities such as adding and deleting software, surfing the Internet, and debugging programs, as these junk files continue to expand, they will not only flat our valuable hard disk space, but also drag down the running speed of the machine and affect our work efficiency. This article describes how to use the tool and weight loss methods for Linux. The Linux release version used in this article is Ubuntu12.04. The tools described in this article include: Act
Preface
After the Linux computer is installed, during our continuous use, various junk files will be generated in the hard disk due to activities such as adding and deleting software and surfing the Internet, debugging programs, etc, as these junk files continue to expand, they will not only flat our valuable hard disk space, but also drag down the running speed of the machine and affect our work efficiency. This article describes how to reduce the weight of a Linux system and how to use the tool. The Linux release version used in this article is Ubuntu 12.04. Tools described in this article include Activity Log Manager, BleachBit, find, fdupes, Geeqie, and GConf Cleaner. these tools are all open-source tools, linux users can download and compile the source code in other popular Linux versions (such as Redhat and SUSE.
Which files in Linux are spam files?
When installing many bin-format software, you must first extract the installation file to a temporary directory (usually the/tmp directory) and then install it. If the software design is neglected or the system is faulty, after the installation is complete, these temporary files will become non-"temporary" and become a pile of garbage in the hard disk. in many cases, they use *. tmp faces appear.
Like the installation process, some temporary exchange files are usually generated during the operation of the software. after some software runs, the garbage may even reach hundreds of megabytes, for example, files generated when the SSH server and client are connected. There are also files generated when the VM is running. In addition, some useless junk files and directories will exist after we delete an account.
When we access the Internet, the browser always Downloads webpage files to a local machine. these cached files not only occupy valuable disk space, but also often make our privacy public.
For example, some application software comes with help and System Manual pages. Since they are tasteless, they are also seen as a manifestation of junk files. A large amount of space is occupied, which seriously slows down the running speed of the system and some graphics processing software. There are also some corrupted desktop files, including damaged application menu buttons and file associations.
If a Linux user installs and uses GIMP, Geeqie, and other graphical editing tools, the image preview function is available in these software. in the folder where the image is saved, a file named "Thumbs. db file, this file will expand with the increase of image files. There is also the. DS_Store file. the DS_Store file is used to store the display attributes of this folder, such as the placement location of the file icon. The side effect after deletion is the loss of such information. In addition, cache files generated during installation using apt or YUM software package.
Use Linux commands to delete junk files
The main command we use here is find. For example, after deleting an account, some useless junk files and directories will exist. to find out the junk items belonging to this user, use the find/-user username: you can find the user-related files in the root directory and run the following command:
#find ./ -nouser |xargs rm ?rf
When an error occurs when a program is running in the system, the system automatically saves the data that remains in the memory as core files. Over time, more and more cores will be left in the system, it is annoying to scatter like dust in every corner of the system. At this time, we can apply the find command and add the-exec parameter to clear them. Run the following command:
# find / -name core -print -exec rm -rf {} \;
In addition, Linux provides many language manual pages (man). For example, the Ubuntu manual page is located in the/usr/share/man Directory. you can use commands to delete the manual pages of redundant languages and keep them in Chinese and English.
# cd /usr/share/man
# find ./ -maxdepth 1 -type d | tail -n +2 | grep -E -v '(en|zh|man).*' | \
while read d; do rm -rf $d; done
Note: The keyword is (en | zh | man). you can modify the keyword as needed.
Fdupes is a command line tool that searches for and deletes duplicate files in a specified directory. it compares the file size with the MD5 value. Compare one byte to one byte. First install this tool
# apt-get install fdupes
Run the following command to find duplicate files in the/etc directory:
#fdupes /etc
It can be used in combination with Linux commands to delete files:
#fdupes -r -f . | grep -v ^$ | tee duplicate.txt cat duplicate.txt | \
while read file; do rm -v "$file"; done
You can also use the sed command to delete files:
# fdupes -r -n -S /tmp | sed -r “s/^/#rm \”/” | sed -r “s/$/\”/” >duplicate-files.sh
Clear old software caches
# apt-get autoclean
Clear all software caches:
#apt-get clean
Delete isolated software that is no longer used by the system
These three commands mainly clean up and upgrade the cache and useless packages.
Use the Geeqie tool to find similar Image files
The current hard disk capacity is getting bigger and bigger. due to backup considerations, many friends will save the image by taking the principle of "Please do not miss it", which may lead to duplicate files, the efficiency of file search is low. It is not easy to find duplicate documents in massive buckets. In fact, with the famous image browsing tool Geeqie, you can easily find duplicate and similar image files in the system. These files are larger than text files, occupying a lot of hard disk space for a long time. The fdupes tool described above does not work, because the fdupes tool can only delete duplicate files identical (md5sum is the same), but to remove "similar" image files, you can use the geeqie tool. First install this tool:
# apt-get install gqview
Run the tool below, right-click the directory to be searched, and select "Find duplicates recursive...", as shown in Figure 1.