Create Two Directories (Solution)

00:00 Here I am again in my terminal. That’s what you see on the left side. And basically, I will be in the terminal for all the exercises. So I probably won’t mention it in future exercises, but this time on the right side, you also see my file explorer.

00:13 The reason why I’m doing this is that we are seeing live what changes I’m doing in the terminal. So we could check everything in the terminal with commands as well, but it’s nice to have it a bit more visual for this course.

00:26 The first thing we need to do is to navigate to the desktop to navigate in the file system in the terminal, you use the cd command.

00:37 cd stands for change directory, but the cd command alone doesn’t do anything because you need to tell the terminal where you want to go.

00:46 And now there is one cool shorthand on Unix systems where you can use the tilde character followed by a slash, and that’s basically your user directory. And when I want to go to desktop, I use the tilde slash and then desktop with the cd commands before that.

01:04 And once I press enter, I am going to the desktop.

01:09 How do I know if I’m on the desktop now? There is another command, pwd. pwd stands for print working directory. And that shows me the path.

01:21 So now we can be sure that we’re on the desktop. And the next part was to create a directory named pip_exercises. For this, I use mkdir, then a space pip_exercises.

01:40 And once I press enter, you see on the right side of the screen that there is a new folder named pip_ exercises in the file explorer.

01:48 So cool, that worked.

01:50 Now change into the newly created folder and print the current working directory. The command to print the current working directory you already know. And also, you basically know how to move into a folder.

02:03 So this should be nothing new to you, it’s cd. And then you use the folder name that you just created. And here I can use another trick and that’s starting with a name that exists in that folder.

02:16 And press tab. And then the terminal auto-completes if it finds something. So in this case, this pip_exercises folder exists, and once I cd in it, I can do pwd and that prints the current working directory, which now is the pip_exercises folder on the desktop.

02:37 To move back to the desktop, I can use cd. And now I could use the tilde desktop command, but I can also use .., which is the parent directory link.

02:47 Once I press enter and use pwd, you can see that I moved back to desktop. And from there, we should create another folder named other_ exercises.

03:02 Once I press enter, you can see on the right the folder got created. And with ls, I can list all the folders in the terminal as well.

03:11 This concludes this exercise.

Become a Member to join the conversation.