linux - Supressing 'Permission Denied' warning in du command -
this question has answer here:
- exclude permission denied messages “du” 2 answers
i want list size of sub-folders in directory. when try du -h --max-depth=1 output cluttered 'permission denied' statements such
du: cannot read directory `./folder_name': permission denied
how can suppress these warnings?
i tried workaround piping the output grep follows
du -h --max-depth=1 | grep -v 'du:'
but not seem working either!
try:
$ du -h --max-depth=1 2>/dev/null this redirects stderr (file handle 2) /dev/null, ignoring error messages.
Comments
Post a Comment