1831170 Members
2646 Online
110021 Solutions
New Discussion

ls output

 
SOLVED
Go to solution
Camel_1
Valued Contributor

ls output

Hi there,

When I list the directory details "ls -ld abc", what is the value is the size column represent for?

drwxr-xr-x 2 test users 1482752 Mar 5 17:31 abc

The directory is empty.

Thanks,

Simon
6 REPLIES 6
Rodney Hills
Honored Contributor

Re: ls output

Number of files/directories in the directory. The "2" you have include "." and "..".

HTH

-- Rod Hills
There be dragons...
Camel_1
Valued Contributor

Re: ls output

In my example what is the meaning of value 1482752, the directory is already empty!
Patrick Wallek
Honored Contributor
Solution

Re: ls output

The directory may be empty now, but it definitely wasn't previously.

That size, 1,482,752, is the size that the directory is taking up on disk. A directory is basically just a different type of file. As there are more files/subdirectories for a directory, its size will grow. However, once a the size of the directory grows, it stays there. It never shrinks.

At one point abc had a LOT of files / directories in it. If you need to reclaim the 1.5 MB, you have to remove and recreate the directory.
Rodney Hills
Honored Contributor

Re: ls output

It is a count of directories under the directory, which include "." and "..".

My mistake...

-- Rod Hills
There be dragons...
Hein van den Heuvel
Honored Contributor

Re: ls output


hmmm...

ls -ld gives me a size in bytes, not a file count for my directories.
That size in bytes would be a multiple of 8192 (181 in this case).
That abc directory must have had a good few files.

Hein.
Patrick Wallek
Honored Contributor

Re: ls output

Correct. The 1,482,752 is NOT the number of files/dirs under that directory.