bash - 以人类可读格式查看文件大小,在 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
解决方案
推荐阅读
- javascript - 如何使用 Lodash 的 unionBy 并合并嵌套数组?
- uwp - 创作经典 COM 组件与 Windows 运行时类相比是否有优势?
- c# - XmlDocument - 如何从多个节点获取所有值
- php - simplexml 对象上的 xpath 不返回任何内容
- java - 每个实体的 Spring Boot 安全角色
- octobercms - 如何在 octobercms 中动态更改页面布局
- aop - 标记为已弃用的不同包或子包中的类的切入点,以及它们使用或实例化的时间?
- xamarin - Xamarin 形成自定义滚动视图,显示奇怪的行为
- powershell - 如何将逻辑添加到 powershell 脚本?
- python - Matplotlib 未导入,脚本无论如何都会打开绘图