FAQ: Manipulation - ls -l

cd comedy actually just worked for me.

3 Likes

I’ve had the same problem. Wrote cd ./comedy/ and didn’t get the green tick. However, tried as you suggested cd comedy only, and the problem was solved. Thank you!

1 Like

I’m having an issue with the same thing. I tried all possible ways 10 times each and nothing works…

Hello CC Moderator,

Can you please explain what “Hard Links” number actually includes per reading in this Lesson?

Lesson says the following:

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

However, if we follow what the actual filesystem tree contains, it will be different from what terminal produces: (this picture was presented in the beginning of the lesson -

  • per filesystem tree, while in movies directory:
  • action should contain total of 4 child items, which coincides with terminal: scifi, superhero, superman.txt, wonderwoman.txt;
  • comedy should contain 2 child items, slapstick, satire, but terminal says that is has 4;
  • similarly, drama should contain 2 child items, biopic, historical, but terminal says 4 again:
    45%20PM

I have found similar inconsistencies between numbers-logic when going into child directories and printing ls -l command.
Thank you for your time and clarification!

2 Likes

Directories can never be hard links, and none of the other files you mentioned are hard links, they are just files

understanding what hard links are is quite useful:

https://medium.com/@wendymayorgasegura/what-is-the-difference-between-a-hard-link-and-a-symbolic-link-8c0493041b62

anyway, in action directory are two hard links: current directory (.) and parent directory (..), then scifi and superhero each also have a hard link to parent directory (..), this way, you have 4

2 Likes

Hey, everyone has probably figured this out by now, but I’m putting it here for any future forum visitors as well.

@lukecook3081430052, @pinboynyc, and @devasconcelos, and @saharab:

I was having the same problem, and thought I had a workaround that somebody else had “discovered”. But it was wrong. Fortunately, @midlindner had the right answer.

Yes, if you do this to get back to the right place, Codecademy will tell you that you got the first step wrong. All you have to do to fix that is then follow all the exercise instructions.

Also, you gotta make sure you’ve got both those fullstops in there before the slash. I noticed a couple of people not doing that. That might also cause a problem.

LMK if that helps!

I’ve checked some online resources saying that hard links can only be created on files, not on directories. Yet, in the content about ls -l, it says the number in the second column refers to the number of hard links to files and directories.

The two explanations seem in conflict, and I’d like to know if I have any misunderstanding.

Both are true, as user you can’t create hard links for directories. However, the exception is current directory (.) and parent directory (..) which are created by the operating system. They are an exception to the rule so to speak

1 Like

Please describe what is “hard link”? Means we must have also “soft” ones or others? I could find the answer in the internet, but I prefer to have the description from codecademy, it’s better. Thank you for your efforts!

As usual codecademy does a piss poor job of explaining how to do something. “Navigate to the comedy/ directory.” How do I navigate? I’m taking a command line course because I don’t know how to navigate. If I knew how to navigate, then I wouldn’t be taking this course. How do I do this?

Thanks,

Ken

the course is divided in syllabuses, the first one being navigation:

https://www.codecademy.com/courses/learn-the-command-line/lessons/navigation/exercises/your-first-command?action=resume_content_item

which you can use to check if you forgot how to navigate, or consult documentation.

1 Like

Thanks for your reply. That was helpful.

The most useful for me was the phrase: “A directory contains an entry for itself, its parent, and each of its children.” And the word “itself”.

hello, this content hasn’t been explained yet:
" 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 ( . )."

what is hard links. and didn’t have defination for ‘…’ and ‘.’ .
Since the file Tree is not match with the lesson content so it’s hard to understand.

(Edit: there are Q&A previous, consider to put this on lessons plz, thanks)

Hi, I’d like to know more about access rights. Are these codes that have certain actions attached to them?

These codes? What codes? You mean the different permissions (read, write and execute) for the user, group and others?

Thanks for responding! I’m talking about learning more about the first item in the column, Access rights. It is defined in the lesson but doesn’t explain how these characters(I thought maybe it was some type of code?) like ‘drwxr-xr-x 5’ dictate an action.

d is for directory, then we have 3 permissions (read ®, write (w) and execute (x)) for the different groups (owner, group, and others). so for example action directory:
d - directory
r - read permission for owner
w - write permission for owner
x - execute permission (is needed for directories or executable files) for owner
r - read permission for group
- no write permission for group
x - execute permission for group
then r-x is the same for others

3 Likes

So there’s the following passage:

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

According to the filesystem scheme provided for “Manipulation” lesson, the directory titled ‘comedy’ is linked to its parent directory ‘movies’ and to two child directories: ‘slapstick’ and ‘satire’. That is 3 links in total. Yet the ‘ls -l’ command shows that ‘comedy’ has 4 hard links. I’m clearly missing something here.

Could someone provide definitions for the terms “hard link”, “parent directory link” and “current directory link”?

I am noticing that there are files that are 0 bytes. How is that technically possible? I can think of the following. 8 bits go into a byte. Could it be that the bits are rounded down so it becomes zero?

I did find an answer here, but it still is quite hard to understand:
https://superuser.com/questions/1030800/how-can-a-files-size-on-disk-be-0-bytes-when-theres-data-in-it