How to use the du and df commands to clear large files under Linux?

  
                

If you find that there is not enough free space in the /home directory on the Linux system, you can use the du and df commands to find large files and delete them to make room. So how do you use the du and df commands to clear large files?

specific methods:

Step 1. du

du --max-depth = 1 -Hm

--max-depth Maximum Depth

-H Easy to understand (humanable)

-m in MB

The result is as follows,

[root@gdc1000 gftp]# du - -max-depth=1 -Hm

2333 . /mirantis_virtualbox

1 ./.mozilla

1 ./.gnome2

1 ./.ssh

1 ./rpmbuild

2457 ./kb

1 ./root

15 ./thinprovider

177 ./pcap

13 ./webui_third_party

8 ./vm

1 ./.local

1 ./docker

51 ./wwwbackup

1 ./win7isomaker

77559 ./tool

2573 ./env

1 ./.pulse

Don't find mmirantis_virtualbox, it takes up more than 2G. Just delete it.

The discovery /tool ​​directory has 77G content, go to /tool ​​directory

Repeat step 1.

Step 2 df

So check the system

[root@gdc1000 windows]# df

Filesystem 1K-blocks Used Available Use% Mounted on< Br>

/dev/mapper/VolGroup-lv_root

257899908 68816416 175978852 29% /

tmpfs 1911300 296 1911004 1% /dev/shm

/dev/Sda1 487652 58191 403861 13% /boot

/dev/mapper/VolGroup-lv_home

206293688 162281004 33526928 83% /home

/srv/loopback-device/swiftloopback< Br>

1900368 3076 1792436 1% /srv/node/swiftloopback

[root@gdc1000 windows]#

The above is the specific use of du and df commands to clear large files under Linux system. The method, using this method to clean up the Linux system can free up a few G or even tens of G space.

Copyright © Windows knowledge All Rights Reserved