This comp.os.linux.misc poster wanted to exclude multiple directories from "du"'s totals. Answers pointed out that he could put the list the files to exclude in another file and use -X filename. Wildcard patterns are allowed in this file, and also can be used with --exclude (quote wildcards):

du -s . --exclude 'b*'

You can also use multiple --excludes:

du -s . --exclude source --exclude old

Don't make the mistake the poster did of using the real path

du -s . --exclude /home/mylogin/old 

Older Unixes (SCO OSR5) "du" aren't so flexible, and lack all these nice options. Bsd has a -I that works like Linux's --exclude, including wildcards.

Got something to add? Send me email.

(OLDER) <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

-> -> Using exclude with 'du'

Increase ad revenue 50-250% with Ezoic

More Articles by

Find me on Google+

© Tony Lawrence

Kerio Samepage

Have you tried Searching this site?

Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us

FORTRAN—the "infantile disorder"—, by now nearly 20 years old, is hopelessly inadequate for whatever computer application you have in mind today: it is now too clumsy, too risky, and too expensive to use. (Edsger W. Dijkstra)

This post tagged: