-3

I am new to Linux and working through Dion's course for Linux+. I'm currently on Permissions and Sticky Bits, and have run into an issue I can't figure out.

The assignment asks to create a directory called Crypto, and then change the directory permissions. The prompt shows the examples being completed as a root user.

I created the directory using the following command: mkdir Crypto, and when I use the ls -al command I can see the directory was successfully created.

The example prompt then instructs to change to another user and execute the following command: cd /Crypto

I receive the "No such file or directory" error when I enter the command as instructed, but I figured out that if I enter the command as such: cd Crypto/ I am able to switch directories.

What am I doing wrong? What is the difference between "cd /Crypto" and "cd Crypto/"?

Any insight would be greatly appreciated.

4
  • Can you include a link to the course in your question? Commented Sep 5, 2023 at 18:54
  • The title is a misinterpretation. It's not about the slash after the name, it's about the (lack of the) slash before the name. Commented Sep 5, 2023 at 19:08
  • I’m guessing it’s this course... Commented Sep 5, 2023 at 19:21
  • It's very likely the course's cd command is missing a period, and should be: cd ./Crypto. Commented Sep 5, 2023 at 21:06

1 Answer 1

3

The command cd /Crypto will change the working directory to a directory called Crypto located at /, the root of the directory structure. This will fail if there is no directory called Crypto in /.

The command cd Crypto/ (or the equivalent cd Crypto or cd ./Crypto) will change the working directory to a directory called Crypto located in the current directory. The trailing slash in Crypto/ serves no real purpose (it would possibly serve a purpose under some circumstances, but not here).

Your command cd /Crypto would have succeeded if you had created the directory in the root of the directory tree, which possibly might have been the intention of the exercise. You would have created the directory in the root of the directory tree had you done cd / before mkdir Crypto, or if you had used mkdir /Crypto (from wherever in the directory hierarchy).

The dot in cd ./Crypto means "the current directory", and .. means "the parent directory".

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.