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 looked at IBM's site and read the definition for ls -l, but could not find an answer to my question.

When issuing an ls -l command on AIX, what is the explanation for the different 'file size' values between a directory and a file in the listed output?

Directory =>             drwxr-xr-x    3 owner group     1601536 Sep 27 10:24 directory/

Tar File of Directory => -rw-r--r--    1 owner group  9554513920 Oct 09 10:29 directory.tar

The actual size of the directory and file is the same, at about 9 GB.

Why does the directory show 1601536 (1.6 MB?) and the file show as 9554513920 ( 9.5 GB)?

I know its not a file count because I get this for a file count -

$ cd directory

$ ls | wc -l

20708

Thanks for any answers.

share|improve this question

migrated from stackoverflow.com Oct 9 '13 at 17:03

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

    
Why all the votes to close this question? Its a good question for someone who is new to Unix, and I have spent a good deal of time searching for the answer. If it's so obvious, then post the answer. – hacket Oct 9 '13 at 16:30
up vote 3 down vote accepted

In UNIX the size of the directory reported by ls is not the size of all files under it. It is the size of the "directory" as a "file" that contains a list of entries under it. This hails back to the original UNIX filesystems structure where a directory was a file with a special bit on that contained a table of inode entries underneath it.

share|improve this answer
    
I had a hunch this was it. Thank you for answering. – hacket Oct 9 '13 at 17:00

You must log in to answer this question.

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