FAQ: Navigation - mkdir

Community%20FAQs%20on%20Codecademy%20Exercises

This community-built FAQ covers the “mkdir” exercise from the lesson “Navigation”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Web Development
Computer Science

Learn the Command Line

FAQs on the exercise mkdir

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

Hi! Does anybody understand from the instructions how to see the file directory using pwd after you created a new directory or file? The instructions say that after creating it you should see it using pwd but the only thing I see is the directory from before like cd /home/ccuser/workspace/blog/2014/dec - yet when I try to create the file or directory again, I get an error message that says: “file/directory already exists” so clearly it has been created. Did I miss sth?

1 Like

pwd gives you the current working directory, it doesn’t show you the files or directories in the current working directory

1 Like

thanks! just found out what was wrong. I needed to navigate to the media directory with ‘cd’ first in order to see what was in there and that it is there (now my mistake is obvious). I think this should be defined a bit more clearly in the instructions though. If you are new to this whole stuff it can get super confusing as you are not used to navigating in this way.

2 Likes

I’m still confused though. If the instructions ask for “list all files… from the current directory” I expect a command to get a list of all files. But we haven’t had this instruction yet? I can’t use pwd for this because it will just show me the current directory I am in. Not a list of files included.
image

1 Like

the command to list files within a directory surely has been taught? Otherwise, maybe you can google? Google is you friend, using google and learning to read documentation is a good idea

maybe the exercise only validates the navigation/changing directory?

1 Like

I think this part of the cmd tutorial fails to teach how to return back to 2014 and expects people to google so here’s a good site to refer to:

  1. https://stackoverflow.com/questions/15214486/command-to-list-all-files-in-a-folder-as-well-as-sub-folders-in-windows
  2. Otherwise, just reset the code and utilize the solution and go directly to cd 2014. Sometimes it’s not worth it to waste an hour learning what you would know just by checking the syntax 5 hours into a subject (takes 10 seconds) then.

Summary of generalizations covered

  • pwd outputs the name of the current working directory.
  • ls lists all files and directories in the working directory.
  • cd switches you into the directory you specify.
  • mkdir creates a new directory in the working directory.
  • touch creates a new file inside the working directory.
2 Likes

You can use ls to list all files in your working directory.

pwd refers to print working directory which means it will show you in which directory you are.

Just want to say that using the command $ cd ../../2014/dec/ should be valid. I end up in the correct wd but the test says I failed and need to list the whole file name.

2 Likes

In the exercise typing “cd 2014/dec/” should not work and gives “no such file or directory” error, but the steps automatically checks out when I type it.

Hi. The first task of the lesson was to navigate to 2014/dec directory. At the beginning of the lesson I was at the 2015/feb directory, so by typing cd ../../2014/dec I’ve got right to the directory required. But the lesson scenario insisted that I shoud specify the full path to the file and though I was at the right directory considered my actions erroneous.

Hello @4292056471. Welcome to the forum. There are many, many alternate solutions to almost every exercise in every lesson in every course on Codecademy. Usually when the directions are specific, we have to comply in order to move on. It’s just part of the experience. Learn what you can from it, and move on. After passing a step, you can always go back, and experiment with alternate solutions. Happy coding!

I think your answer about differences between "mkdir" and "touch" needs to be more lighted up and to have even its own distinct topic.
Because in the lesson there isn’t such an explanation for why we had talked only about "mkdir" and suddenly just used "touch" command.