Linux Show Directory Sizes

I think we all know how to show how much each MAJOR directory is using:
df -h

But what if I wanted to see inside a few further directories?
Yes, du. Du – estimates file space usage.

So, in my case, I could do the following:
du -hc --max-depth=1 | grep M
That checks, in human terms, with a max depth of 1, how many directories have X number of MB.
You can also replace the M with G or T to list directories in the GB range or the TB range.

Be warned though, Grepping for M or G can also yield some files with those names.

ALSO I wanted to find files edited in the past “x” days or hours:
Find all files modified in the past 2 days:
find / -mtime -2 -ls

Find all files modified in the past 20 minutes:
find / -mmin -20 -ls

List all open items on linux:
lsof > file.txt

Leave a Reply

Your email address will not be published. Required fields are marked *

Ramblings Of An IT Person