linux查看文件大小kb,linux 查看文件大小

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值