Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
Showing results for 
Search instead for 
Did you mean: 

awk in df -k output.

Frequent Advisor

awk in df -k output.



$ bdf /tmp /usr /var |grep -v "Filesystem"|grep "%"|awk '{print $NF, $(NF-1)}'

/tmp 9%
/usr 37%
/var 50%

I am able to get File system usage correctly using bdf as what I expected.


I need the output to be same for df -k as bdf output.


I tried using different ways to df -k ,but i am not able to get the df -k output as same as bdf.



Dennis Handly
Acclaimed Contributor

Re: awk in df -k output.

Why would you ever want to use df when you have bdf?

You may want to look at Bill's bdfmegs:


But this should work:

df -k | awk '
substr($0, 1, 1) != " " {
   name = $1
/%/ {
   print name, $1 $2