linux 中du命令指定以不同的单位显示文件的大小

 

001、

复制代码
(base) [root@pc1 test]# ls
(base) [root@pc1 test]# dd if=/dev/zero of=a.txt count=30 bs=1M     ## 生成一个测试文件
30+0 records in
30+0 records out
31457280 bytes (31 MB) copied, 0.0231627 s, 1.4 GB/s
(base) [root@pc1 test]# ll -h                                   ## 查看该文件
total 30M
-rw-r--r--. 1 root root 30M Nov 25 17:47 a.txt
(base) [root@pc1 test]# du -b a.txt                             ## bp
31457280        a.txt
(base) [root@pc1 test]# du -k a.txt                             ## kb
30720   a.txt
(base) [root@pc1 test]# du -m a.txt                             ## mb
30      a.txt
(base) [root@pc1 test]# du -h a.txt                             ## 人类友好可读
30M     a.txt
复制代码

 。

 

posted @   小鲨鱼2018  阅读(68)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律
点击右上角即可分享
微信分享提示