Size of directories - what does it mean ?




(My 1st post)

In my linux system, I have a directory called /data .
When I do a ls -lrt is get a small list of files and directories with the various info about them.
The sizes of the (sub)directories (called /logs /local and /dda) are all 4096.
Inside of these directories, they are either empty or stuffed with huge amounts of other files.
Question...What does the original 4096 tell me ? It seems to have no bearing on the size of what is inside.
I did an 'info ls' and 'man ls' but the answer didn't seem to be in there.





Let me try to spell this out simply...

  • A file contains whatever data is put in it
  • A directory contains the names of the files that are listed in it - and their inode numbers
  • An inode contains metadata describing a file (or directory - in linux/unix, *everything* is a file). This includes:

  • the size of the file,
  • the file's physical location (i.e., the addresses of the storage blocks containing the file's data on disk)
  • the file's owner and group
  • the file's access permissions
  • timestamps telling when the inode was created, last modified and last accessed
  • a reference count telling how many hard links point to the inode.

So, an inode has a fixed size of 1024, which is sufficient to contain all the above


Probably not, so I'll guess that what you really wanted was a way to figure out the size of the stuff in the directory?

in which case...
cd <to the directory you are interested in>
du -sh *

if you have a directory with a lot of files, you might want to use these:
[COLOR=#000000][FONT=arial]du -sh * | sort -n                 # to the end of that command, or if you're looking for large files...[/FONT][/COLOR]
[COLOR=#000000][FONT=Times New Roman][FONT=arial]du -sh * | egrep '[0-9]G'  | sort -n  # which will (almost always) only show files with more than 1Gb in.

Feel free to ask for clarification or further Q's ;)



Thanks for the reply. Your explanation was clear to me.
There are other directories in my system that have other sizes (4096 and 32768) so I just
thought that those were the 'fuller' directories, but instead, they must be more 'complex' directories.

Thanks again,
MALIBAL Linux Laptops

Linux Laptops Custom Built for You
MALIBAL is an innovative computer manufacturer that produces high-performance, custom laptops for Linux.

For more info, visit:

Staff online

Members online