Ls -l command (hard links)


#1

In the long list format, the second column represents the number of hard links.
Does anyone know what are hard links and how to count them? :sweat::sweat:


#2

Isn’t the count explanation within the exercise? Can you link the exercise?


#3

https://www.codecademy.com/courses/learn-the-command-line/lessons/manipulation/exercises/ls-l?action=resume_content_item


#4

I didn’t really get the explanation
what did parent directory link and current directory link mean?
And i saw in another post that the files and directories were not counted??

I do apologise if it’s a very dumb question, just very new to all of this :frowning:


#5

its say right here:

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 (.).

for example in the lesson:

Screenshot_2018-03-02_15-35-50

4 make sense for the action directory:
current directory (.)
parent directory (..)
scifi directory in action directory
superheroes directory in action directory


#6

just a bit confused about what a current directory link is?


#7

ls -a will show all hidden files, include .. (parent directory) and . (current directory), which are hard links

if we want to execute a script in the current directory, we can do ./scriptname.sh or something. . here indicates the current directory. If you just did scriptname.sh, it would look in PATH


#8

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