I need to search all file system in linux .I need a find disk space utilization of the entire filesystem based on search result ?
8 Answers
df .
is all you need, in any directory you care to be. Or with the path
df /path/of/the/interesting/directory
In other news, has the apropos
command stopped working?
$ apropos "file system"
[...]
df (1) - report file system disk space usage
A portable way is:
df -k /ask
and most systems support the more readable
df -h /ask
df # file system usage info
df -h # same, but in human readable format
df -a # all system and dummy file system usage info
Look at man df
for more useful info.
I think your'e best shot is using df and using a unix pipe to extract the data you need. You ould possibly use awk or grep for this.
There are a lot of things you can do, but I like the following:
Find currently growing files
cd / ; touch now ; find . -newer /now -type f -print0 | du --files0-from=- | sort -n | perl -ne 'if ( /^(\d+)\s+(.*$)/){$l=log($1+.1);$m=int($l/log(1024)); printf ("%6.1f\t%s\t%25s %s\n",($1/(2**(10*$m))),(("K","M","G","T","P")[$m]),$2);}' | tail -n10
Find largest files
cd / ; find . -type f -print0 | du --files0-from=- | sort -n | perl -ne 'if ( /^(\d+)\s+(.*$)/){$l=log($1+.1);$m=int($l/log(1024)); printf ("%6.1f\t%s\t%25s %s\n",($1/(2**(10*$m))),(("K","M","G","T","P")[$m]),$2);}' | tail -n10
Enjoy
free
command will be very handy. Because as you want to know the disk free, you can remember it very well.
You have additional options to view the output as you want.
free -b -> display usage in bytes.
free -k -> display usage in KB.
free -m -> display usage in MB.
free -g -> display usage in GB.
Also the total RAM+Swap memory, etc.. have a look free --help
and play with it.
-
-
hello.. -jens. just go through the output of free command. it displays.. total, used and free memory. Sep 20, 2013 at 8:21
-
no
free
doesn't display free file system space (it displays free RAM). Please read and understand the actual question. Disk space is not RAM.– JensSep 20, 2013 at 9:59
df
is a utility program, not a bash command.