How can I check the size of a specific directory in Linux(CentOS) and print it out?
I know I can use lvs
and df
(df -f "path to dir"
) but how can I get just a number like 78Gbs instead of the whole thing(avail, used, etc)
How can I check the size of a specific directory in Linux(CentOS) and print it out?
I know I can use lvs
and df
(df -f "path to dir"
) but how can I get just a number like 78Gbs instead of the whole thing(avail, used, etc)
To find the size of a directory without any other info:
To get the size of a partition:
The
tail
gets rid of the header andawk
prints just the size of the partition. On the other hand, if you want just the amount of space used on the partition:What you're looking for is the
du
command.To get the grand total of the arguement(s):
Same as above, but only print the summary:
If wanted, you can throw in a
-h
in there too with the same effect as with dhTry
du
instead ofdf
. Check du manpage!do you mean
du -sh
? Depending on your need you may use other options