2

On a Linux environment. How can I find out the total space a folder is taking. It would like this total to include ALL sub-directories in the total. I don't want a dump of the size of each subdirectory. Just the total size a directory is taking up with the size of all it's subdirectories included in the c

Marlon
  • 535
  • 2
  • 10
  • 14

5 Answers5

2
du -sh /path/to/directory

Should do exactly what you want.

Kyle Brantley
  • 1,331
  • 1
  • 11
  • 14
0

du --max-depth=0 --one-file-system -m

Gives the size of the current directory in MB, not running past mount-points.

sysadmin1138
  • 133,124
  • 18
  • 176
  • 300
0

The following should work:

$ du -skh <directory>
atx
  • 1,281
  • 1
  • 9
  • 26
0

du -sh /path/to/directory

The output will return sumarize and human readeable directory size.

or in MB

du --max-depth=0 --one-file-system -m /path/to/directory

Also, you can create an alias if you will going to execute this command often.
If you want to know more about du command, execute: man du

Matias Dominoni
  • 337
  • 1
  • 4
0

If you're inside the directory, du -skh . works well. Otherwise, du -skh /path/to/directory is good.

The flags on that command mean "-s summary, -k kilobyte listing, -h human-readable suffixes". The "-k" is probably redundant, but a force of habit.

ewwhite
  • 197,159
  • 92
  • 443
  • 809