(Unix) Exclude mounted directories in du
Running du
can be slowed down by huge filesystems mounted,
and the outputs can easily be distorted by such directories.
To exclude them from du
result,
- Add
-x
flag, e.g.du -hx --max-depth=1
- Use
--exclude=<PATTERN_TO_EXCLUDE>
to specify patterns of directory names to exclude, e.g.du -h --exclude=/mnt
References:
Written on October 1, 2021