Linux disk space management tool --ncdu (for your system slimming)

Linux disk space management tool – ncdu (for your system slimming)

When the Linux system becomes stuck and the space is not enough. ncdu, here it comes. ncdu, it can clearly point out which directory and which file occupies more space in your disk file directory, and then we can do some proper cleaning to achieve the purpose of slimming down the Linux system.

ncdu install

Now commonly used Linux systems are nothing more than two, Ubuntu and Centos. The following mainly talks about the installation methods of these two Linux systems ncdu. As for other Linux systems, the installation commands are also the same.

  • Ubuntu
sudo apt install ncdu -y
  • hundred
yum install ncdu -y

ncdu's precise weight loss

The use of ncdu is very simple, just use the following command:

ncdu 目录名称

Example: When using ncdu /, the root directory of the system will be scanned. The insert image description here
following is the scan result: you can see that the /var directory occupies 19.3G. Use the Enter key to enter the next level of directory for viewing, and find the specific file that takes up a lot of space.
insert image description here
In the end, we saw that docker took up most of the space, and then entered the deep directory to find out. insert image description here
It turns out that there are images in docker that take up a lot of space, and then we can use the command to delete images in docker to delete useless images. insert image description here
In other directories, we also saw that the log files about Harbor actually take up 1.1G of disk space, so that we can accurately clean up useless files to achieve a system slimming directory. insert image description here
The command to exit ncdu is to use the q key (lowercase Q) to exit the ncdu window.

Guess you like

Origin blog.csdn.net/wFitting/article/details/108676993