"du: illegal option -- -" mac上使用du出错

有时候在Linux上查看,当前文件夹下磁盘占用情况,可能会用到命令

du -h -a --max-depth=1
//或简写为
du -ah --max-depth=1

 然鹅,在MacOS上,使用该命令则可能会报错"du: illegal option -- -", 如下:

 其实,在Mac上可以这样

du -hd1

或者用命令find 来实现,

find . -maxdepth 1 -type d -mindepth 1 -exec du -hs {} ;
原文地址:https://www.cnblogs.com/LordNeo/p/14167868.html