LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
LinkBack Search this Thread
Old 06-29-2007, 05:38 PM   #1
kaz2100
Senior Member
 
Registered: Apr 2005
Location: Penguin land, with apple, no gates
Distribution: Debian testing woody(32) sarge etch lenny squeeze(+64) wheezy jessie
Posts: 1,397

Rep: Reputation: 81
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!
 
Old 06-29-2007, 06:01 PM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728
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.
 
Old 06-29-2007, 06:06 PM   #3
mikieboy
Member
 
Registered: Apr 2004
Location: Warrington, Cheshire, UK
Distribution: Linux Mint 12 LXDE
Posts: 555

Rep: Reputation: 33
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.
 
Old 07-02-2007, 06:31 AM   #4
kaz2100
Senior Member
 
Registered: Apr 2005
Location: Penguin land, with apple, no gates
Distribution: Debian testing woody(32) sarge etch lenny squeeze(+64) wheezy jessie
Posts: 1,397

Original Poster
Rep: Reputation: 81
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!
 
Old 07-02-2007, 07:32 AM   #5
mallux
Member
 
Registered: Jun 2007
Location: London, UK
Distribution: Ubuntu, RHEL, Fedora
Posts: 46
Blog Entries: 1

Rep: Reputation: 16
"." 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 "..")
 
  


Reply

Tags
ls


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
"bad interpreter : no such file or directory" when configure "flex" acer_peri Linux - Software 10 11-10-2010 01:19 AM
"/usr/bin/ls: reading directory .: Input/output error" DiZi Slackware 15 07-13-2008 10:03 AM
What does "Directory "/usr/src/linux" doesn't appear to contain kernel source." mean? jtp51 Linux - General 4 06-11-2007 12:22 AM
Adding a footer to "directory style" apache2 output {Rm}Gh0sT Linux - Software 2 01-16-2006 02:51 AM
i just finished typing "./configure" and "make" in mplayer directory... kublador Linux - General 4 02-22-2003 03:12 PM


All times are GMT -5. The time now is 10:02 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration