E-Mail:
Author Avatar

How Do I Skip Certain Directories In “du” Output?

On a mailing list I’m on, someone asked an interesting question about the du command: “I want to figure out how much disk space I’m using in different directories, but I don’t know how to exclude certain directories from the output. Anyone have a suggestion?”
My initial response was that you’d want to just pour the output through a grep -v, or, if you want to get fancy and use a regular expression, grep -vE. Like this:

du * | grep -vE ‘(/usr/|/bin/|/mnt/)’

which would give you an exhaustive output of disk usage by directory, but would skip any directories that matched the pattern /usr/ or /bin/ or /mnt/

[Continued at Ask Dave Taylor!]

What Do You Think?

 


Anti-Spam Image

Want to Start a Blog Here for Free?

Are you an expert in one subject or another? If your goal is to help others and dispense hard-earned information back to the community, stake a claim on your very own Lockergnome blog today! You can write about anything - no matter the topic. Sign-up to start blogging!

Author Avatar
SEO - Mar 6, 2008

Using Differentiators In Keyphrases