Sunday, January 1, 2012

How To Use 'df' and 'awk' to View Disk Usage

One of my favorite command line tools for viewing disk usage is 'df'.  It's simple but with a few pipes, awk and grep it can do some neat things.

The line below only shows files or directories that match [something]G in the file size reported by 'df':


sudo du -h . | awk '{print $1 " " $2}' | grep ^[0-9.]*G

0 comments:

Post a Comment