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.

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

1 Answer 1

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

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.