# # Using exclude with 'du'
APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

Using exclude with "du"

I've removed advertising from most of this site and will eventually clean up the few pages where it remains.

While not terribly expensive to maintain, this does cost me something. If I don't get enough donations to cover that expense, I will be shutting the site down in early 2020.

If you found something useful today, please consider a small donation.



Some material is very old and may be incorrect today

© June 2004 Tony Lawrence

Referencing: http://groups.google.com/[email protected]_f1.net



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 
# WRONG!
 

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.


If you found something useful today, please consider a small donation.



Got something to add? Send me email.





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

Printer Friendly Version

->
-> Using exclude with 'du'


Inexpensive and informative Apple related e-books:

iOS 10: A Take Control Crash Course

Digital Sharing Crash Course

Take control of Apple TV, Second Edition

Take Control of Upgrading to El Capitan

Take Control of OS X Server





More Articles by © Tony Lawrence





Printer Friendly Version

Have you tried Searching this site?

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


Printer Friendly Version





Dump may work fine for you a thousand times. But it _will_ fail under the right circumstances. And there is nothing you can do about it. (Linus Torvalds)




Linux posts

Troubleshooting posts


This post tagged:

Basics

Blog

Linux

Unix



Unix/Linux Consultants

Skills Tests

Unix/Linux Book Reviews

My Unix/Linux Troubleshooting Book

This site runs on Linode