LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   second field of "ls -l" output of directory (https://www.linuxquestions.org/questions/linux-software-2/second-field-of-ls-l-output-of-directory-565480/)

kaz2100 06-29-2007 05:38 PM

second field of "ls -l" output of directory
 
Hya,

I regret to post this kind of newbie question. I am totally lost.

Code:

>ls -l
total thismany
-rw-r--r-- 1 user group 1234 Jun 29 13:45 ThisFile
drwxr-xr-x 1 user group 4096 Jun 20 12:34 ThisDir
>

I know that
first field for file is permission
second field for file is "count of hardlink"
third field is owner
fourth is group
fifth is size
sixth (through eithth) is time stamp
ninth is name.

What is second field when target is directory? The other fields are not difficult.

man page and info coreutils ls do not give us much.

Happy Penguins!

pixellany 06-29-2007 06:01 PM

Just guessing---since directories are just a type of file, I would assume that that field has the same meaning. I can't seem to psyche out why some directories have different numbers.

One interesting thing; On my system no directory shows less than 2 in that field.

mikieboy 06-29-2007 06:06 PM

According to the Linux Cookbook the second field for a directory lists the number of hard links to the file, which is the same as "count of hardlink". It doesn't seem to be different for a directory than for a single file. Hope this helps.

kaz2100 07-02-2007 06:31 AM

Hya,

Thanks for replies. However,
Quote:

I can't seem to psyche out why some directories have different numbers.

One interesting thing; On my system no directory shows less than 2 in that field.
was my first question, and I (as user or root) had not made link (hard or soft). And files in that directory does not have hard link also.

Happy Penguins!

mallux 07-02-2007 07:32 AM

"." and ".." also count has hard links, so you are never going to have less than 2 hard links to any directory. If you create a subdirectory you will find that the count goes up to 3 (because your subdir contains a "..")


All times are GMT -5. The time now is 06:47 PM.