qnx du统计目录大小单位

在qnx上使用du命令统计目录大小时,发现统计数值与实际大小不一样。

比如目录下有个已知1gb大小的问题,但du统计出来的值跟1gb差太多了

# ls -al
total 2097169
drwxrwxrwx   2 root      root           4096 Jan 01 00:21 .
drwxrwxrwx   6 root      root           4096 Jan 01 00:07 ..
-rw-r--r--   1 root      root      1073741825 Jan 01 00:21 1gb.bin
# du -s
      2097161 .

查看qnx关于du命令的文档

The space figures are displayed in 512-byte blocks by default. If you want du to print the size in bytes, you specify the -p option. The sizes output by du when you specify the -p option are accurate with one exception. The numbers may be slightly higher than expected because they include extent blocks that are part of filesystem overhead associated with the file, but don’t contain actual data.

If you specify nondirectories, they aren’t listed unless you specify the -a option.

Files with multiple links are reported only once.

与Linux不同的是,du -s显示的大小是以512byte为单位的,也就是说du -s的值x512后等于实际大小。如果想直接以1byte为单位显示,把-s参数改为-p参数即可。

# ls -al
total 2097169
drwxrwxrwx   2 root      root           4096 Jan 01 00:21 .
drwxrwxrwx   6 root      root           4096 Jan 01 00:07 ..
-rw-r--r--   1 root      root      1073741825 Jan 01 00:21 1gb.bin
# du -p
   1073746432 .

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值