Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

For example, it shows the kernel as being 18M but the Applications folder as being 3.8K

BSD/Darwin

share|improve this question
add comment

2 Answers

According to the man page for ls:

List information about the FILEs (the current directory by default).

ls is intended to show the size of the files on the file system, not to show the usage of a directory. du will show total usage of a file system object.

So ls is doing what it is supposed to do. While your Applications directory may contain files that use more than 3.8K, the Applications directory itself is really only 3.8K on the disk.

share|improve this answer
add comment

Because you're not on Windows, where the world pretends that directories have no space cost, and all directories are zero length. (Some parts of the Windows world pretend that the size of a directory is the cumulative size of all of the things contained in the directory.)

On Unices and Linux, the ls -l command, when displaying a directory entry that points to another directory, shows the size of the directory. It shows the amount of space devoted to actually storing the entries in the directory itself. For each directory entry, ls -l always shows the size of the node pointed to by that entry, be it file, symbolic link, or directory.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.