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.rpmwarning: /var/tmp/rpm-tmp.DWv51E: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEYPreparing... ########################################### [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, securityLoading mirror speeds from cached hostfile * epel: mirrors.ustc.edu.cnSetting up Install ProcessResolving Dependencies--> Running transaction check---> Package ncdu.x86_64 0:1.11-1.el6 will be installed--> Finished Dependency ResolutionDependencies Resolved
======================================================================================================================================================
Package Arch Version Repository Size======================================================================================================================================================Installing: ncdu x86_64 1.11-1.el6 epel 43 kTransaction Summary
======================================================================================================================================================Install 1 Package(s)Total download size: 43 k
Installed size: 76 kDownloading 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 invalidTrying 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: NOKEYRetrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6Importing GPG key 0x0608B895: Userid : EPEL (6) <epel@fedoraproject.org> Package: epel-release-6-8.noarch (installed)From : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
Running rpm_check_debugRunning Transaction TestTransaction Test SucceededRunning TransactionWarning: RPMDB altered outside of yum. Installing : ncdu-1.11-1.el6.x86_64 1/1 Verifying : ncdu-1.11-1.el6.x86_64 1/1Installed:
ncdu.x86_64 0:1.11-1.el6Complete!
[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 [ ] /tmpe 16.0 KiB [ ] /lost+found 12.0 KiB [ ] /.dbus 8.0 KiB [ ] /opte 4.0 KiB [ ] /srve 4.0 KiB [ ] /mnte 4.0 KiB [ ] /home 0.0 B [ ] /sys. 0.0 B [ ] /proc 0.0 B [ ] /selinuxe 0.0 B [ ] /nete 0.0 B [ ] /misc 0.0 B [ ] .autofsck Total disk usage: 7.5 GiB Apparent size: 7.5 GiB Items:163855