You are here:

C/how to get free disk space size in C on linux

Advertisement


Question
which C function lets me know about size of free disk space in current directory?
im using gcc, Linux Advances Server 3 , Dell P-IV
regards

Answer
There are two functions which you can use.
They are:
1. df
2. du

There are manual pages installed in your Linux box using which you can learn how to use them.

To find the size occupied by any directory, you can use the command:
du -sh <dir-name>

For knowing the used and available space on the mounted filesystems, you can use the command:
df -h

Hope this helps....

-Narendra

C

All Answers


Answers by Expert:


Ask Experts

Volunteer


Narendra

Expertise

I can answer questions in C related to programming, data structures, pointers and file manipulation. I use Solaris for doing C code and if you have questions related to C programming on Solaris, I will be able to help better.

Experience

6.5

Organizations belong to
Sun Microsystems

Awards and Honors
Brain Bench Certified Expert C programmer.
Advanced System Software Certified

©2012 About.com, a part of The New York Times Company. All rights reserved.