How to lose weight for Linux systems

Source: Internet
Author: User
Tags manual file size root directory ssh server linux

Objective

After the Linux computer is installed, in the course of our continuous use, because of adding, removing software and surfing the Internet, debugging programs and other behavior, the hard disk will produce a variety of garbage files, and as these garbage files are expanding, they will not only devour our valuable hard disk space, but also drag the machine running speed, affect our work efficiency. This article describes the methods and techniques used to lose weight on Linux systems, and the Linux distributions used in this article are Ubuntu 12.04. The tools described in this article include: Activity Log Manager, Bleachbit, Find, Fdupes, Geeqie, gconf Cleaner, which are open source tools that Linux users can download to compile source code in other popular Linux versions (such as Redhat, SUSE, etc.) are used.

Which files under Linux belong to the junk file

Temporary files generated during software installation

Many bin-format software is installed by first extracting its own installation files into a temporary directory (typically the/tmp directory) before installing. If the software design is negligent or has problems with the system, when the installation is over, these temporary files will become not "temporary", a heap of garbage in the hard drive, many times they appear with *.tmp faces.

Temporary files generated during software operation

As with the installation process, some temporary swap files are usually generated during the running of the software, and some of the garbage left over after the software has run up to hundreds of trillion megabytes, such as the files generated during the SSH server and client connection. There are also files generated by virtual runtime. In addition, after we delete an account, there will be some useless garbage files and directories.

Temporary files generated by surfing the internet

When we surf the Internet, browsers always download the Web files to the local machine, which not only takes up valuable disk space, but also often makes our personal privacy publicly available.

Some of the less common chicken files

For example, some application software with the Help and System manual pages. Since food is tasteless, they are also regarded as a manifestation of junk paper. Occupy a lot of space, will seriously drag the system and some graphics processing software running speed. There are also some corrupted desktop files, which include the corrupted application menu buttons and file associations.

Various cache files

If a Linux user installs a graphics editing tool, such as GIMP or Geeqie, where the software has a picture preview feature, a file named "Thumbs.db" will be created in the folder where the picture is saved, which will swell with the increase in the picture file. And there is. Ds_store files, ds_store files are used to store the display properties of this folder: for example, the placement of file icons. The next side effect of deletion is the loss of this information. There are also cache files generated during installation of apt or YUM packages.

Remove junk files with Linux commands

Delete the junk files left behind by the user

The main command we use here is find. For example: After we delete an account, there will be some useless garbage files and directories, we want to find the garbage belonging to this user, using the Find/-user Username: You can locate the root directory of the user's related files, using the command:

#find./-nouser |xargs RM–RF

Core file

When we run a program under the system error, the system will automatically save the data in memory into a core file, over time, the legacy of the system will be more and more core, like dust scattered in every corner of the system is very annoying. At this time, we can use the Find command plus the-exec parameter to clean them up. To use the command:

# Find/-name core-print-exec rm-rf {} \;

Extra manual Pages

In addition Linux offers a number of language manual pages (man) such as Ubuntu's hand album located in the/usr/share/man directory, you can use the command to delete the extra language of the hand album to keep in English and Chinese.

# 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

Description: The keyword is (en|zh|man), you can modify according to your own situation.

Use the Fdupes tool to delete duplicate files in a specified directory

Fdupes is a command-line tool that finds and deletes duplicate files for a specified directory, comparing the file size to the MD5 value. A byte is compared to one byte. First install this tool

# Apt-get Install Fdupes

To find duplicate files in the/etc directory, use the following command:

#fdupes/etc

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

It can also be used in combination with the SED command to delete files:

# fdupes-r-N-S/tmp | Sed-r "s/^/#rm \"/"| Sed-r "s/$/\"/">duplicate-files.sh

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.