FAQ: Navigation - touch

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

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

Computer Science
Web Development
Build a Website with HTML, CSS, and Github Pages
Create a Front-End App with React

Learn the Command Line

FAQs on the exercise touch

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (reply) below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

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

Ask or answer a question about this exercise by clicking reply (reply) below!
You can also find further discussion and get answers to your questions over in #get-help.

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

Need broader help or resources? Head to #get-help and #community:tips-and-resources. If you are wanting feedback or inspiration for a project, check out #project.

Looking for motivation to keep learning? Join our wider discussions in #community

Learn more about how to use this guide.

Found a bug? Report it online, or post in #community:Codecademy-Bug-Reporting

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!

This may be a stupid question but what are some situations in which I would want to create an empty file within a directory?

I understand why I may want to create an empty directory to move files into.

Many thanks in advance


It is not a stupid question. I believe creating the empty file is only the first step. Once we have created the empty file, then we will learn how to populate the file with content in future lessons.

Hello, I have some questions about creating new files with the touch command. In the exercise, we create a .txt file using $ touch keyboard.txt. Had we not specified .txt, what would be the default file type that is created? What other types of files can you create with the touch command? Is it as easy as adding the document file extension, like newfile.psd or newfile.docx?

Thank you!


Creating new files with the touch command. In the exercise, we create a .txt file using $ touch keyboard.txt. Had we not specified .txt, what would be the default file type that is created? What other types of files can you create with the touch command?

1 Like

Honestly, I think the best way to truly know, is to do this yourself! Why not try it out and see for yourself, the output!



I ask this question due to the error messages I receive when I create a file, so I am not sure I am doing it correctly.

For example, I created a document “newfile.sketch” and when I try to open this document, I receive an error that states, “The document ‘newfile.sketch’ could not be opened.” I created a “newfile.pages” document, and the error reads, "'newfile.pages’ is damaged and can’t be opened." Finally, I created a “newfile.psd” and receive the error, “Could not open ‘newfile.psd’ because the file is empty.”

In this respect, I’m not sure if I’m doing something wrong when I’m creating the file, or if you are expected to only populate these files in the Terminal. For a document that is visual and design-based — like a Photoshop or Sketch file — I think this may be rather difficult, but would likely be easier for something more text-based like Pages or Word.

I suppose this all leads to me to another, bigger question — Why would we use the Command Line for building websites? I’m taking the Pro Path “Build a Website with HTML, CSS, and Github Pages” and this exercise is part of the “How to Build Websites On Your Own Computer” section. In the unit “Command Line for Building Websites,” we learn how to navigate the terminal, create new files, and create new directories. Still, these are all things that I could have done in Mac Finder or Windows Explorer. So I don’t understand the benefit of using the Terminal for building websites.

1 Like

For every format, .psd, .sketch and .pages … do you have the recommended software for opening such files? And did you try opening this from the normal mac/windows directory/file manager?

About your other question, it will be the case that as we progress in programming, we will collaborate. You will work with git. This is the reason we learn bash commands such as ls etc. That way, working with git is easier.

I hope this helps.

Thanks for your response! Yes, I have the appropriate software to open each file, and they do not open from the normal Mac Finder.

Thank you for clarifying how learning bash commands is helpful for git!

1 Like

Hi All,
In the previous exercise, we created two new directories, one nested in the other, namely media and tv.
Now we prepare to populate the directory tv with a file called keyboard.txt.
However, before we do that, we run the list command ls, and it turns out that the newly created folders are already populated with two files “monitor.txt” and “mouse.txt”. If we didn’t create them, how comes they are there?

In this lesson, current working directory (pwd) is /2014/dec, so monitor.txt and mouse.txt are already created, you can take a look at this diagram(https://content.codecademy.com/courses/learn-command-line/img/LCL-fileTrees-01.png). so when you do ls command it will print content of dec.

Creating files with touch really only makes sense for plaintext formats - that could be a .txt file, a config file (i.e .json or .yaml), or any kind of source code file (.js, .py, .c).

It makes sense that things like .sketch and .psd aren’t going to work, as those applications tend to have specialized binary formats for their filetypes. If you opened a proper .psd file with a text editor (or printed it to the command line with cat), you’d see a bunch of gibberish instead of legible text. I’d imagine in both cases even an empty project would have a bunch of metadata that wouldn’t be present by just creating an empty text file. Even text documents in a more complicated format (.docx) might be troublesome.

1 Like

Super helpful, thanks for clarifying! Good to know that it’s only really practical / intended for plaintext documents.