Linux / UNIX Tech Support Forum
This is a discussion on Linux / UNUX directory hard link count within the Linux software forums, part of the Linux Getting Started category; Hi, Can anyone pls explain me the concept behind the link count in Linux -sh-3.00$ ls -lrt total 194 drwxr-xr-x ...
|
Register free or login to your existing account and remove all advertisements. |
|
|||||||
| Linux software General questions and discussion about Redhat/Fedora Core/Cent OS, Debian and Ubuntu Linux related to softwares should go here. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Hi,
Can anyone pls explain me the concept behind the link count in Linux -sh-3.00$ ls -lrt total 194 drwxr-xr-x 2 root root 4096 Aug 12 2004 srv drwxr-xr-x 2 root root 4096 Aug 12 2004 mnt drwxr-xr-x 2 root root 4096 Aug 12 2004 initrd drwxr-xr-x 2 root root 4096 Aug 12 2004 home drwxr-xr-x 2 root root 4096 Aug 24 2005 misc drwx------ 2 root root 16384 Jun 26 2006 lost+found drwxr-xr-x 2 root root 4096 Jun 26 2006 selinux drwxr-xr-x 2 root root 4096 Jun 26 2006 post drwxr-xr-x 4 root root 1024 Jun 26 2006 boot drwxr-xr-x 28 root root 4096 Nov 2 2006 var drwxr-xr-x 18 root root 4096 Feb 15 2008 usr drwxr-xr-x 12 mqm mqm 4096 Sep 26 12:58 mqm drwxr-xr-x 35 root root 4096 Nov 20 19:42 opt dr-xr-xr-x 8570 root root 0 Nov 23 13:53 proc drwxr-xr-x 9 root root 0 Nov 23 13:53 sys drwxr-xr-x 9 root root 6100 Nov 23 13:57 dev drwxr-xr-x 4 root root 4096 Nov 23 13:57 media drwxr-xr-x 2 root root 4096 Dec 7 04:23 bin drwxr-xr-x 10 root root 4096 Dec 7 04:23 lib drwxr-xr-x 2 root root 12288 Dec 7 04:23 sbin drwxr-x--- 3 root root 4096 Dec 10 04:15 root drwxr-xr-x 61 root root 12288 Dec 11 04:02 etc drwxrwxrwt 7 root root 4096 Dec 11 12:24 tmp for above output, I do see that /etc has 61 link count where are sbin has 2. Is there any reason for this.. |
| Sponsored Links | ||
|
|
|
||||
|
Are you talking about soft links or hard links?
__________________
Vivek Gite Linux Evangelist |
|
|||
|
Hi,
I am refering to the number 2 in the below output. Please let me know if you have any question. drwxr-xr-x 2 root root 4096 Aug 12 2004 srv |
|
||||
|
2 is number of links. A normal Unix / Linux filesystem has at least 2 hard links: its name and its . entry. Additionally, its subdirectories (if any) each have a .. entry linked to that directory.
Hard links are indicated with the number of links counter. To verify this do as follows: Code:
cd /tmp mkdir foo ls -ld foo Code:
mkdir foo/bar ls -ld foo Hope this helps!
__________________
Vivek Gite Linux Evangelist Last edited by nixcraft; 12-13-2008 at 02:14 AM. |
![]() |
| Tags |
| directory , hard links , ls command , soft links |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| grep command count number of CPU | sidebrake | Shell scripting | 3 | 09-09-2008 11:26 PM |
| Hard Link Query | sharadgana | Getting started tutorials | 2 | 03-25-2008 12:11 AM |
| Debian d-link dwl 510 configuration | chimu | Linux hardware | 0 | 01-26-2007 07:15 PM |
| D-Link 520 rev B | uspak | Linux hardware | 3 | 12-28-2006 10:35 AM |
| Erase hard drive with Linux live CD | jerry | Linux software | 1 | 07-17-2006 03:29 AM |