ncdu 命令可以用來查看和分析 Linux 中各目錄對磁盤空間佔用情況的工具。
[root@wangjianxiong ~]# rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
Retrieving https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
warning: /var/tmp/rpm-tmp.DWv51E: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing... ########################################### [100%]
1:epel-release ########################################### [100%]
[root@wangjianxiong ~]# ls /etc/yum.repos.d/
epel.repo epel-testing.repo media.repo
[root@wangjianxiong ~]# yum -y install ncdu
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* epel: mirrors.ustc.edu.cn
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package ncdu.x86_64 0:1.11-1.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
======================================================================================================================================================
Package Arch Version Repository Size
======================================================================================================================================================
Installing:
ncdu x86_64 1.11-1.el6 epel 43 k
Transaction Summary
======================================================================================================================================================
Install 1 Package(s)
Total download size: 43 k
Installed size: 76 k
Downloading Packages:
https://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/ncdu-1.11-1.el6.x86_64.rpm: [Errno 14] Peer cert cannot be verified or peer cert invalid
Trying other mirror.
ncdu-1.11-1.el6.x86_64.rpm | 43 kB 00:00
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
Importing GPG key 0x0608B895:
Userid : EPEL (6) <[email protected]>
Package: epel-release-6-8.noarch (installed)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
Installing : ncdu-1.11-1.el6.x86_64 1/1
Verifying : ncdu-1.11-1.el6.x86_64 1/1
Installed:
ncdu.x86_64 0:1.11-1.el6
Complete!
[root@wangjianxiong ~]# ncdu /
ncdu 1.11 ~ Use the arrow keys to navigate, press ? for help
--- / -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
4.2 GiB [##########] /media
2.9 GiB [###### ] /usr
174.3 MiB [ ] /var
148.0 MiB [ ] /lib
36.5 MiB [ ] /etc
25.6 MiB [ ] /lib64
23.8 MiB [ ] /boot
13.8 MiB [ ] /sbin
7.2 MiB [ ] /bin
1.4 MiB [ ] /root
392.0 KiB [ ] /dev
68.0 KiB [ ] /tmp
e 16.0 KiB [ ] /lost+found
12.0 KiB [ ] /.dbus
8.0 KiB [ ] /opt
e 4.0 KiB [ ] /srv
e 4.0 KiB [ ] /mnt
e 4.0 KiB [ ] /home
0.0 B [ ] /sys
. 0.0 B [ ] /proc
0.0 B [ ] /selinux
e 0.0 B [ ] /net
e 0.0 B [ ] /misc
0.0 B [ ] .autofsck
Total disk usage: 7.5 GiB Apparent size: 7.5 GiB Items:
163855