日期:2014-05-16 浏览次数:20734 次
linux du命令用来查看磁盘空间的使用情况。
1. 通过du命令查看/bin目录下各个命令所占用的存储空间,
sh-# du -ah /bin/ | sort -nr
933K /bin/
676K /bin/busybox
25K /bin/fw_printenv
5.0K /bin/mountpoint
0 /bin/xargs
0 /bin/umount
0 /bin/touch
0 /bin/top
0 /bin/tar
0 /bin/sysctl
0 /bin/sync
0 /bin/stty
0 /bin/sort
0 /bin/sleep
0 /bin/sh
0 /bin/sed
0 /bin/route
0 /bin/rmmod
0 /bin/rm
0 /bin/pwd
0 /bin/ps
0 /bin/ping6
0 /bin/ping
0 /bin/nice
0 /bin/mv
0 /bin/mount.static
0 /bin/mount
0 /bin/modprobe
0 /bin/mknod
0 /bin/mkdir
0 /bin/lsmod
0 /bin/ls
0 /bin/login
0 /bin/ln
0 /bin/kill
0 /bin/insmod
0 /bin/ifconfig
0 /bin/hostname
0 /bin/head
0 /bin/gzip
0 /bin/grep
0 /bin/getopt
0 /bin/find
0 /bin/echo
0 /bin/du
0 /bin/dmesg
0 /bin/dirname
0 /bin/depmod
0 /bin/date
0 /bin/cp
0 /bin/chrt
0 /bin/chmod
0 /bin/cat
0 /bin/blkid.static
0 /bin/blkid
0 /bin/bash
0 /bin/basename
0 /bin/awk
0 /bin/arping
0 /bin/agetty
sh-#
2. 为什么有很多命令占用的空间大小为0呢?
使用ls命令查看,原来这些大小为0的命令都是symbolic link;
可以看到ls命令也能查看档案所占用的磁盘空间大小。
sh-# ls -lh /bin/
total 933K
lrwxrwxrwx 1 root root 19 Oct 10 01:29 agetty -> /openbox/bin/agetty
lrwxrwxrwx 1 root root 19 Oct 10 01:29 arping -> /openbox/bin/arping
lrwxrwxrwx 1 root root 16 Oct 10 01:29 awk -> /openbox/bin/awk
lrwxrwxrwx 1 root root 21 Oct 10 01:29 basename -> /openbox/bin/basename
lrwxrwxrwx 1 root root 17 Oct 10 01:29 bash -> /openbox/bin/bash
lrwxrwxrwx 1 root root 12 Oct 10 01:29 blkid -> /bin/busybox