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.

When using the terminal, is there a command that allows you to see the size of each individual file in a particular directory?

share|improve this question
add comment

3 Answers 3

Use ls -l to list all files with their details on OS X and Linux, or dir on Windows.

share|improve this answer
    
man ls would get you far but just to add to Darth's answer, adding -h will help you get a more human-readable output! –  Garrett Dec 30 '11 at 7:21
add comment

On Linux/Unix, use

  • ls -lk (for size in kilobyte) or
  • ls -lh (for easier readable approximate file sizes, like 12M or 2G).

ls -l will show size in blocks, which might not be that useful.

share|improve this answer
add comment

I'm late to the party! ls -lh works if you don't want to know the size of directories with their content (all the directories just get listed as being 4 kilobytes).

Example output of ls command:

$ ls -lh
total 796K
drwxr-xr-x.  2 user user 4.0K Sep 25 20:04 Desktop
drwxr-xr-x.  7 user user 4.0K Aug 13 23:48 Documents
drwxr-xr-x.  6 user user 4.0K Nov 21 18:27 Downloads
drwx------. 12 user user 4.0K Nov 21 10:06 Dropbox
-rw-rw-r--   1 user user    5 Nov 21 22:06 file1
-rw-rw-r--   1 user user 751K Nov 21 22:06 file2
...

May I suggest du -h -s /path/to/dir/*
Example output of du command:

$ du -h -s *
4.0K    Desktop
980M    Documents
3.7G    Downloads
5.0G    Dropbox
4.0K    file1
752K    file2
...

Be ready to sit back and wait. Depending on how big the contents of the folder are and your IO speed, du can take quite a while.

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.