0

I want to see my disk usage for a specific folder with a pre-set maximum depth. On Linux, the command is

$ du -h --max-depth 1

On macOS Mojave (10.14.5) with bash version 3.2.57(1)-release, this is not working. I also tried

$ du -hd1

as described here, also not working. The terminal output is:

usage: du [-H | -L | -P] [-a | -s | -d depth] [-c] [-h | -k | -m | -g] [-x] [-I mask] [file ...]

What is the best solution?

  • 1
    Can you edit your post with these commands and their output ? type -a du and declare -f – fd0 Jun 12 at 13:24
2
du -h -d 1

seems to work on my Mac

1

Thanks to fd0, I was able to resolve the problem. The output

$ type -a du
du is aliased to 'du -sh'
du is /usr/bin/du

makes clear that the command du was aliased to du -sh. By removing this line from my .bash_profile, everything works as it should. The solution e.g. by PeterVP works perfectly fine:

$ du -h -d 1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .