Help clarify the '-l' option of ls(1).

Dan Nelson dnelson at allantgroup.com
Wed Apr 12 17:13:00 UTC 2006


In the last episode (Apr 12), David Robillard said:
> I'd like to have an explication about the '-l' (minus L) option of
> the ls(1) command. What exactly is the signification of the second
> column in the display? The man page states that it is 'the number of
> links'. But what does it mean exactly?

It means "the number of links".

$ pwd
/tmp/z
$ touch a
$ ln a b
$ ls -la

total 4
drwxr-xr-x  2 dan   wheel  512 Apr 12 12:09 .
drwxrwxrwt  8 root  wheel  512 Apr 12 12:09 ..
-rw-r--r--  2 dan   dan      0 Apr 12 12:09 a
-rw-r--r--  2 dan   dan      0 Apr 12 12:09 b

"a" and "b" both have a link count of 2.  "." has a link count of 2
because it also exists in /tmp as "z".  ".." has a link count of 8
because it also exists as "." in /tmp, plus as "tmp" in /, plus as ".."
in 5 other subdirectories off /tmp.

-- 
	Dan Nelson
	dnelson at allantgroup.com


More information about the freebsd-questions mailing list