Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know these folders each have >80gb of files. Yet, they only show 4.0K in ls -lah? How can I have ls show size including the contents?

[root@aapsan01 aapxen01]# ls -lah
total 48K
drwxrwxrwx  6 root root 4.0K Sep 29 03:45 .
drwxrwxrwx 15 root root 4.0K Sep 27 09:15 ..
drwxr-xr-x  2 root root 4.0K Sep 29 03:45 aapxen01.0
drwxr-xr-x  2 root root 4.0K Sep 28 12:10 aapxen01.1
drwxr-xr-x  2 root root 4.0K Sep 27 09:21 aapxen01.2
drwxr-xr-x  2 root root 4.0K Sep 27 09:21 aapxen01.3
share|improve this question

migrated from Sep 29 '10 at 13:36

This question came from our site for professional and enthusiast programmers.

up vote 26 down vote accepted

du --max-depth=1 -h should show how much space the folders use

share|improve this answer
That's what I want. Thanks. Too bad they couldn't make an ls switch to provide this info. O well. – Flotsam N. Jetsam Sep 29 '10 at 13:39
I find that one pretty handy, so usually have it as an alias on my system like du-dir or something like that. – dtlussier Sep 29 '10 at 14:26
Actually adding --max-depth=1 is kind of weird choice, because then sub-subfolders (and files inside those) are not counted at all. From question it's not clear whether that was wanted or not. – Olli Mar 15 '11 at 17:46
@Olli Subfolders are counted, but not displayed. – Bernhard Nov 15 '12 at 6:57
Also equivalent to du -d 1 -h – checksum Nov 26 '13 at 8:02

Using the command du:

du -sh .

Note that this takes some time, because it has to scan the directory contents.

share|improve this answer

du -sh

where s displays a summary of the directory size.
h human readable format


[root@smsc tmp]# du -sh
219M    .
share|improve this answer

ls shows the size of the directory entry, not of the directory contents. The directory itself is basically a list of all file names contained in the directory, and thus quite small.

For getting the combined size of a directory and its contents, use du.

share|improve this answer

To show the size of /var, use:

du -sh /var

To show the size of contents of /var, use:

du -sh /var/*
share|improve this answer
$ du -sm * | sort -n | tail -n 20
6       persilleriet
10      reading-material
22      Desktop
24      android
24      workspace
28      Dropbox
35      skole
36      2011v
38      fpsu
42      archives
46      prosj
54      2011erm
54      books
64      svn
99      reference
227     tmp
311     muz
331     images
370     src
share|improve this answer

Use 'du'. Further explanation

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .