Puzzled by ls output for /media directory
Hello :)
I'm puzzled by ls -l output for the /media directory and realised I don't fully understand what the ls long output columns show. The ls man page did not help. Here's the puzzling output Code:
root@CW8:/media# ls -ld README hd* dvd* Code:
root@CW8:~# find / -xdev -samefile /media/hd0 symlinks dvd and hd have fifth column (spies!) figures the size of their target names. Reasonable but aren't such short names kept in the directory entries (dirents) themselves so such symlinks are not files; their file size should be zero ??? Regards the directory file sizes being 1 or 4096, a few files were written to hd0 while no file system was mounted on it. Presumably that made it grow to accommodate dirents and it went from being a dirent alone to being a dirent plus an inode so it had space to store dirents for its own files. The reported 4096 presumably represents this single inode. But why are the other directories' sizes 1? If my speculation is correct, these directories which have only ever been used as mount points so have never "contained any files" are implemented purely in dirents in their parent' directory -- so, like symlinks with short target names, they are not files; their file size should be zero ??? :scratch: :jawa: :scratch: Best Charles |
The second column is a number which tells how many directory entries are under that item. For a regular file, this will typically be 1. For a directory, this will always be at least 2.
http://docweb.cns.ufl.edu/docs/d0107/ar07s04.html The reported size of a symlink is the number of characters in the path it points to. |
Thanks troop :) Link bookmarked.
|
All times are GMT -5. The time now is 10:23 AM. |