0
I'd like to be able to only show disk usage for specific partitions in GB and a % after. Basically ignore swap, tmpfs, etc..
I'd also like to sum the disk usage amount and subtract from the total to get free space.
Right now I have something like this, but not sure how to use awk and select the partitions I want to count.
df -h | awk '$5 ~ /\%$/ print $1 " " $5}'
This is for a debian system.
Edit:
So figured out I can use / to limit the results, however, this only shows me how much is free.
df -h / | awk '{ a = $4 } END { print a }'
Why not simply
grep
? – gronostaj – 2016-07-03T21:12:13.917Not familiar with the command – debianusr – 2016-07-03T21:18:23.747
"I'd also like to sum the disk usage amount and subtract from the total to get free space.". How is that different from what
df -h
already provides in theAvail
column? – John1024 – 2016-07-03T21:48:56.447df
should accept a mountpoint as an argument. It may even be a directory or a file below the mountpoint. The tool will then display information for the appropriate mountpoint only. Try it:df -h /tmp
ordf -h /dev/urandom
. You can specify multiple arguments in that fashion. – Kamil Maciorowski – 2016-07-03T22:04:54.040You know there's
df -x tmpfs
, right? – user1686 – 2016-07-04T06:15:46.233