Command ls -l and its number counting


#1

I typed ls -l and it shows “Number of hard links. This number counts the number of child directories and files. This number includes the parent directory link (…) and current directory link (.).” I am confused here.

As you can see the screenshot below, the action directory has more than 4 files and directories. I would like know why commad ls -l at movies directory showing only 4 for action directory. Should .txt file also have to be counted as a file?

This is the exercise link regarding to my question:
https://www.codecademy.com/courses/learn-the-command-line/lessons/manipulation/exercises/ls-l?action=lesson_resume


#2

If you look at ls -a you’ll see, . and .. in the list. Now use, ls -alt to get a complete breakdown.

Active links refer to directories, only, not files. Again, look at ls -a in that folder and count the directories, only. . .. scifi superhero

Aside

Please remember to post a link to the exercise with every new question, in addition to your screenshot (for this module) since we cannot copy from the console. It will add tremendous value to this topic where other users are concerned, especially new learners with the same question. If they can confirm your question is from the same lesson, perhaps they can end their search and heed the replies they find there. Just saying…


#3

Thank you! I added the exercise link.

I see that the active links do not refer to files. But, then, why the explanation on the exercise link says" Number of hard links. This number counts the number of child directories and files. " ?


#4

If you believe the lesson text or instructions to be in error then the best thing to do is report it using the Bug Report form below the instructions.


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.