0

I need to search all file system in linux .I need a find disk space utilization of the entire filesystem based on search result ?

2
  • 2
    Try bash command: df -h
    – broadband
    Aug 22, 2013 at 6:37
  • @broadband df is a utility program, not a bash command.
    – Jens
    Aug 22, 2013 at 6:46

8 Answers 8

1
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
0

"df -hl" command could help you on this.

0

A portable way is:

df -k /ask

and most systems support the more readable

df -h /ask
0
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.

0
find any-path | xargs du -sh

for example

find /home/user/movies | xargs du -sh
0

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.

0

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

-1
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.

3
  • free displays memory, not diskspace use, so is not what the OP wants.
    – Jens
    Aug 22, 2013 at 12:48
  • 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.
    – Jens
    Sep 20, 2013 at 9:59

You must log in to answer this question.