ls
ls可以用来查看目录下文件与子目录信息
$ ls -lh
total 6.9G
-rw-rw-r-- 1 root root 531M Jul 12 2017 test1.txt
-rw-rw-r-- 1 root root 438M Jul 12 2017 test2.txt
查看指定文件信息
$ ls -lh test1.txt test2.txt
-rw-rw-r-- 1 root root 531M Jul 12 2017 test1.txt
-rw-rw-r-- 1 root root 438M Jul 12 2017 test2.txt
du
du是专门显示文件或目录大小信息的命令
Usage: du [OPTION]... [FILE]...
or: du [OPTION]... --files0-from=F
-0, --null end each output line with 0 byte rather than newline
-a, --all #每个文件
--apparent-size #文件大小
-B, --block-size=SIZE scale sizes by SIZE before printing them. E.g.,
'-BM' prints sizes in units of 1,048,576 bytes.
See SIZE format below.
-b, --bytes
-c, --total #总的大小
-D, --dereference-args dereference only symlinks that are listed on the
command line
-d, --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
--files0-from=F summarize disk usage of the NUL-terminated file
names specified in file F;
If F is - then read names from standard input
-H equivalent to --dereference-args (-D)
-h, --human-readable #自动使用K,M,G
-k like --block-size=1K
-L, --dereference dereference all symbolic links
-l, --count-links count sizes many times if hard linked
-m like --block-size=1M
-P, --no-dereference don't follow any symbolic links (this is the default)
-S, --separate-dirs do not include size of subdirectories
--si like -h, but use powers of 1000 not 1024
-s, --summarize display only a total for each argument
-t, --threshold=SIZE exclude entries smaller than SIZE if positive,
or entries greater than SIZE if negative
--time show time of the last modification of any file in the
directory, or any of its subdirectories
--time=WORD show time as WORD instead of modification time:
atime, access, use, ctime or status
--time-style=STYLE show times using style STYLE:
full-iso, long-iso, iso, +FORMAT
FORMAT is interpreted like 'date'
-X, --exclude-from=FILE exclude files that match any pattern in FILE
--exclude=PATTERN exclude files that match PATTERN
-x, --one-file-system skip directories on different file systems
--help display this help and exit
--version output version information and exit
$du -h #显示当前文件和目录大小
812K a.txt
444K ./count
$ du -h *
531M test1.sam
438M test2.sam
$ du -h test1.sam
531M test1.sam