英文說明: This manual page documents the GNU version of df. df displays the amount of disk space available on the filesystem containing each file name argument. If no file name is given, the space available on all currently mounted filesystems is shown. Disk space is shown in 1K blocks by default, unless the environment variable POSIXLY_CORRECT is set, in which case 512-byte blocks are used.
If an argument is the absolute file name of a disk device node containing a mounted filesystem, df shows the space available on that filesystem rather than on the filesystem containing the device node (which is always the root filesystem). This version of df cannot show the space available on unmounted filesystems, because on most kinds of systems doing so requires very nonportable intimate knowledge of filesystem structures.
-h, --human-readable print sizes in human readable format (e.g., 1K 234M 2G)
-H, --si likewise, but use powers of 1000 not 1024
-i, --inodes list inode information instead of block usage
-k like --block-size=1K
-l, --local limit listing to local filesystems
--no-sync do not invoke sync before getting usage info (default)
-P, --portability use the POSIX output format
--sync invoke sync before getting usage info
-t, --type=TYPE limit listing to filesystems of type TYPE
-T, --print-type print filesystem type
-x, --exclude-type=TYPE limit listing to filesystems not of type TYPE
-v (ignored)
--help display this help and exit
--version output version information and exit
SIZE may be (or may be an integer optionally followed by) one of following: kB 1000, K 1024, MB 1000*1000, M 1024*1024, and so on for G, T, P, E, Z, Y.
-a, --all write counts for all files, not just directories
--apparent-size print apparent sizes, rather than disk usage; although the apparent size is usually smaller, it may be larger due to holes in (â?˜sparseâ?™) files, internal fragmentation, indirect blocks, and the like
-B, --block-size=SIZE use SIZE-byte blocks
-b, --bytes equivalent to â?˜--apparent-size --block-size=1â?™
-c, --total produce a grand total
-D, --dereference-args dereference FILEs that are symbolic links
-H like --si, but also evokes a warning; will soon change to be equivalent to --dereference-args (-D)
-h, --human-readable print sizes in human readable format (e.g., 1K 234M 2G)
--si like -h, but use powers of 1000 not 1024
-k like --block-size=1K
-l, --count-links count sizes many times if hard linked
-L, --dereference dereference all symbolic links
-P, --no-dereference donâ?™t follow any symbolic links (this is the default)
-0, --null end each output line with 0 byte rather than newline
-S, --separate-dirs do not include size of subdirectories
-s, --summarize display only a total for each argument
-x, --one-file-system skip directories on different filesystems
-X FILE, --exclude-from=FILE Exclude files that match any pattern in FILE.
--exclude=PATTERN Exclude files that match PATTERN.
--max-depth=N print the total for a directory (or file, with --all) only if it is N or fewer levels below the command line argument; --max-depth=0 is the same as --summarize
--help display this help and exit
--version output version information and exit
ls ?lh 可以看出當前目錄文件的大小(不含目錄), 比如下面的的322M。 [root@LS-SVR-18 ~]# ls -lh total 322M -rw-r--r-- 1 root root 312M Aug 1 23:35 10.50.86.18.tar.z -rw-r--r-- 1 root root 1.3K Aug 1 17:41 anaconda-ks.cfg drwxr-xr-x 2 root root 4.0K Aug 1 21:44 Desktop -rw-r--r-- 1 root root 62K Aug 1 17:41 install.log -rw-r--r-- 1 root root 5.2K Aug 1 17:41 install.log.syslog -rw-r--r-- 1 root root 8.9M Sep 28 15:29 Install_MSN_Messenger_zhcn.EXE -rwxr-xr-x 1 root root 9.2K Aug 16 11:20 m64 -rw-r--r-- 1 root root 1.1K Aug 16 11:20 m64.c -rw-r--r-- 1 root root 1.1K Aug 8 04:33 m64.o drwxr-xr-x 2 root root 4.0K Oct 9 15:45 MCA drwxr-xr-x 2 root root 4.0K Oct 9 15:41 MGM drwxr-xr-x 2 root root 4.0K Oct 9 15:45 MYSQL -rw------- 1 root root 95 Sep 5 10:34 nohup.out 使用du -sSh 也是同樣的結果 [root@LS-SVR-18 ~]# du -sSh 322M 使用du -sh 則包含了子目錄的內容 [root@LS-SVR-18 ~]# du -sh 451M . 查看每個文件和目錄的大小 [root@LS-SVR-18 ~]# du -sh * 313M 10.50.86.18.tar.z 8.0K anaconda-ks.cfg 8.0K Desktop 72K install.log 12K install.log.syslog 8.9M Install_MSN_Messenger_zhcn.EXE 16K m64 8.0K m64.c 8.0K m64.o 476K MCA 65M MGM 65M MYSQL 8.0K nohup.out