首页 > 解决方案 > 以人类可读格式查看文件大小,在 macOS bash 中不进行四舍五入

问题描述

在 bash 中,我可以用来du -sh查看人类可读格式的文件大小,并ls -lta以字节为单位查看完整大小。有没有办法在不四舍五入的情况下查看人类可读的数量?下面的例子。

~ du -sh test.txt
 26G    test.txt

ls

 ~ ls -lta test.txt 
-rw-r--r--  1 username  staff  27992876444 Apr  2 10:53 test.txt

想要的

 ~ some_command test.txt
26gb 72mb 89kb 412b

标签: bashmacosshell

解决方案


推荐阅读