Linux下查看磁盘空间使用
1>df是以磁盘分区为单位来查看磁盘的使用情况:
[root@order properties]# df -lh
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root 50G 14G 34G 30% /
tmpfs 3.8G 0 3.8G 0% /dev/shm
/dev/sda1 485M 32M 429M 7% /boot
/dev/mapper/VolGroup-lv_home 42G 4.5G 35G 12% /home
参数说明:
-h --human-readable print sizes in human readable format (e.g., 1K 234M 2G)
-l limit listing to local file systems
--help display this help and exit
2>du是用来统计某个目录下面的文件大小:
[root@order properties]# du -h -s /* | sort
du: cannot access `/proc/20989/task/20989/fd/4': No such file or directory
du: cannot access `/proc/20989/task/20989/fdinfo/4': No such file or directory
du: cannot access `/proc/20989/fd/4': No such file or directory
du: cannot access `/proc/20989/fdinfo/4': No such file or directory
0 /proc
0 /selinux
0 /sys
11G /export
127M /lib
1.4G /usr
160K /dev
16K /lost+found
183M /root
20M /lib64
21M /boot
22M /etc
33M /test
4.0K /bin.zip
4.0K /media
4.0K /mnt
4.0K /opt
4.0K /srv
4.4G /home
460K /tmp
468K /order_logs
511M /var
5.7M /bin
9.9M /sbin
参数说明:
-s --summarize display only a total for each argument
-h --human-readable print sizes in human readable format
-b --bytes equivalent to `--apparent-size --block-size=1 -k like --block-size=1K
-m like --block-size=1M