• 4 heures
  • Facile

Ce cours est visible gratuitement en ligne.

course.header.alt.is_video

course.header.alt.is_certifying

J'ai tout compris !

Mis à jour le 19/04/2022

Navigate your system

I'll be philosophical for a second. Two things matter in life:

  • Where you are 🌎

  • Where you're going ✈️

The same is true in Terminal! While you're exploring your computer using Terminal, you'll want to be able to know where you are in the system and where you need to go to perform the operations you want.

In the last chapter, you learned how to identify where you are. Now let's get to where you're going.

Change locations

You'll learn two commands in this chapter that will be helpful for navigating through your system: lsandcd. Both are low-pressure and straightforward, even for beginners.

Why does navigating through your system matter? It'll help you find your way between projects, folders, and files and make sure you're running the right code in the right place. This will always be the first step before running other commands you'll learn later in this course.

Finding destinations

In your computer, you can go pretty much anywhere you want. First, though, you must know the destinations available to you.

On the command line, type the following command (ls , which is short for list), and press the Enter key on your keyboard:

ls

When I type lsand press Enter, here's what I see:

Output of ls command
Output of ls command

These folders look very familiar to me!

That's because I see exactly the same contents as when I look at the same folder in Finder (you'll see Applications, Creative Cloud Files, and everything else that was in my computer's output above):

Same folder contents, different view
Same folder contents, different view

This hits home the point that using Terminal is more efficient way to navigate and perform operations within your computer that involve files and folders, whether those files and folders contain actual code or just everyday stuff like photos and text documents.

Going to destinations

Now that you've revealed possible directories (folders) available to you, you can move around them using a different command:cd which is short for "change directory," plus the name of the folder where you want to move.

For example, let's say I want to change locations in my system and move into the "Music" folder. This was listed as one of the options in the output from our ls command. I'd type:

cd Music

Here's what my Terminal looks like after running cd Music:

Changing directories to the Music folder
Changing directories to the Music folder

I'm now in the Music folder. 🎵  Let's see what's inside with another ls command: 

Listing the contents of the Music folder
Listing the contents of the Music folder

Now I know that inside the Music folder is another folder called iTunes.

You'll get an error if you try to cd (change directory) into a folder you don't have. For example, if you type cd Music but you don't have a folder called Music you'll get an error such as "No such file or directory." You should be replacing these examples with folder names you actually have. If you don't have a Music folder, run  cd name-of-folder-you-do-have  instead.

You've learned how to list the contents of a directory and change directories, meaning you can move nimbly through your system.

In the next chapter, we'll check out some keyboard shortcuts that will allow you to be more interactive with the typing process on the command line.

Exemple de certificat de réussite
Exemple de certificat de réussite