How to get file/directory size on GNU/Linux

du reports the amount of disk space used by the set of specified files and for each subdirectory. With no arguments, du reports the disk space for the current
directory. Normally the disk space is printed in units of 1024 bytes, but this can be overridden.

To get the size of a file / directory, type:

$ du -sh directorio

where:

  • -s: displays the total for each argument
  • -h: display the size of each file in a readable format (K, M, G)

In order to get the total size for each file that belongs to a directory, type:

$ du -csh directory/*

-c: prints the total

 

About the Author

Leave a Reply

%d bloggers like this: