Determine the free file space in Linux

Apologies if this a dumb question, but i have not found an answer yet.

How do you find out how much free disk/file space for a given folder or partition.

Basically i need to know how much free space there is before i carry out a tasks on the server and don't wish to hit the limits unexpectedly.

thanks in advance.


Solution 1:

df -h # shows free disk space on all partitions
du -hs foldername # shows space used by a particular folder

Solution 2:

chaos answered first, but I just wanted to add "df -h" is more useful (display it in human-readable terms (MB, GB, KB, etc) instead of blocks), but you can figure that out from df's help page.

Solution 3:

   cd /path/to/dir
   df -h .
   Filesystem            Size  Used Avail Use% Mounted on
   /dev/sda1              36G   20G   14G  60% /

Solution 4:

my favorite trick for getting the really big files listed:

du | sort -rn | head

gets the top 10 filepigs listed.

Tim