I'm on an OS X operating System, and I don't understand what the second field in the
ls -l command is supposed to mean. Say I am inside an empty directory, and I create a single directory inside of it:
When I run
ls -l I get:
$ ls -l total 0 drwxr-xr-x 2 josh staff 68 Nov 17 15:45 folder
In this case the number of links to the directory is 2. I believe these links refer to the original directory name and the
. entry inside the directory.
Now I add a file (not a folder) to the directory:
Now the output of
ls -l looks like this:
$ ls -l total 0 drwxr-xr-x 3 josh staff 102 Nov 17 15:47 folder
Why is there now three links instead of two? For each new file I add, the number of links goes up by one. I see why this makes sense if I add a new subdirectory to the directory, as a new link (
.. in the new folder) would be created, but not a new file. What are these extra numbers? Where do they come from?