Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get file size

Status
Not open for further replies.

Tison

Programmer
May 12, 1999
216
CH
How do I get the freespace for a file system ?

I want to put a check in a script that will report and perform calculations on the freespace amount.
Manually I type "df -k" but this does not work in my script because the columns are not always equal lengths (if you know what I mean).
 
df -k | tr -s ' ' ' ' | cut -f3 -d ' ' grep -v Free

will return the free space column only. You could then put this in a file and cat it to do whatever arithmetic you need. HTH.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top