How to Exclude a Specific Directory in NCDU Command

Drunken M picture Drunken M · Aug 9, 2019 · Viewed 17.4k times · Source

How to exclude a directory from ncdu scanning?

I can't found the information in man ncdu page.

When doing ncdu -x / it scanned my /home/tmp directory for almost an hour.

Thanks for any help.

Answer

Drunken M picture Drunken M · Aug 10, 2019

As requested by @subtleseeker in comment, I will share how I exclude directories when doing ncdu command.

Basically ncdu has the same command line options as the du command, so to exclude a directory simply use:

--exclude /dir/path

For example: ncdu -x / --exclude /home/tmp

To exclude multiple directories: ncdu -x / --exclude /home/tmp --exclude /var/log

etc.

Note that you should avoid a trailing slash (use /home/tmp NOT /home/tmp/) otherwise it will fail to actually exclude the directory.