Current location - Health Preservation Learning Network - Healthy weight loss - Linux folders are getting bigger and bigger. How to delete some unnecessary files?
Linux folders are getting bigger and bigger. How to delete some unnecessary files?
Under linux, if the system garbage changes greatly, it will lead to insufficient system space. Using df -h, you can see which user has a large directory space utilization. If it is large, you need to execute some commands to slim down the system:

1, sudo apt-get automatic cleaning

sudo apt-get clean

Sudo apt-get automatic deletion

These three commands mainly clean up the upgrade cache and useless packages.

2. Clean up the cache file of opera/firefox:

ls ~/。 opera/cache4|xargs rm -f

ls ~/。 mozilla/firefox/*。 Default/Cache |xargs rm -f

3. Clean up the isolation package under Linux:

In the graphical interface, we can use: gtkorphan

Sudo apt-get installs gtkorphan -y

Under the terminal command, we can use: deborphan.

Sudo apt-get install deborphan -y

4. Delete the redundant kernel:

Open a terminal and enter the command: dpkg-get-selections | grep Linux.

The image is the kernel file;

Delete the old kernel file:

Sudo apt-get deletes the kernel file name (for example, linux-image-2.6.27-2-generic).

The kernel is deleted and space is released. It should be possible to release 130- 140m.

Finally, look at the current kernel: uname -a A.

5. Clear all logs in the directory:

Because I'm in ls. Log * `

do

cat/dev/null & gt; $i

finished