I am trying to use du to get a list of the files/sizes on the filesystem (doing this as sudo):
cd /
du --exclude-from="/home"and I am getting an error message, telling me that /home is a folder.
I do not want /home to be included. Looking through the du manual, it does not look like this is possible. What's the alternative to du to accomplish what I want?
1 Answer
Two things are wrong with your command:-
- You cannot combine
cdwith another command, unless you add;between them, egcd /; du ..., though it would be better simply to specify/as a positional parameter todu, as indu ... /. - The
--exclude-fromspecifies a file containing a list of search patterns: what you need is--excludeto specify the pattern in-line.
So the command you need is:
du --exclude=/home /This will exclude /home and all its subdirectories. Note that du --exclude="/home/* / will exclude all files and subdirectories, but include the size of the /home directory itself.