'df' - finding the disk free space / disk usage
$ df
It gives a table consisting of 6 columns.
Remember that the 'Size', 'Used' and 'Avail' columns use kilobytes as the unit.
The 'Use%' column shows the usage as a percentage which is also very useful.
$ df -h
Displays the same output as the previous command but the '-h' indicates human readable format.
Hence instead of kilobytes as the unit the output would have 'M' for Megabytes and 'G' for Gigabytes.
$ df -h | grep /dev/hda1 | cut -c 41-43
Example of Answer
45%
Basically this command makes 'df' display the disk usages of all the partitions and then extracts the lines with /dev/hda1.
Then it cuts the characters from the 41st to the 43rd column since they are the columns that display the usage in %.
No comments:
Post a Comment
Note: only a member of this blog may post a comment.