Question

I am working to create a shell script to return iNode usage from a Solaris box.

The command I use to run is: df -F ufs -o i,

and say the output is:

    Filesystem             iused   ifree  %iused  Mounted on
    /dev/dsk/c1t0d0s1     248503 3443913     7%   /

The only part I need to catch is 7%. Please help me on the part that returns the %iused, and output it at the end of the script.

Thanks in advance!

Regards,

Madean

Was it helpful?

Solution

df -F ufs -o i | nawk 'NR>1 {print $4}'

OTHER TIPS

set `df -F ufs -o i`
printf '%s\n' ${10}

This works as long as the df output is exactly as you've shown. If it actually has more lines and you are only interested in the root file system /, then use df ... / to make it output only the stats you are interested in.

Use this.

df -F ufs -o i | sed -n '$p' | awk '{print $4}'

df -F ufs -o i | grep ^/ | awk '{print $4}'

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top