How can you navigate directories in Linux?

QuestionsQuestions4 SkillsProDec, 25 2025
0178

To navigate directories in Linux, you primarily use the cd command, which stands for "change directory".

Here are the most common ways to use it:

1. Moving to a Specific Path

You can move to a specific folder by typing its name or path:

  • cd project — Moves you into the "project" folder (if it exists in your current location).
  • cd /home/labex/project — Moves you directly to that specific absolute path.

2. The Home Shortcut (~)

The tilde symbol ~ is a shortcut for your home directory:

  • cd ~ — Takes you home (/home/labex) from anywhere in the system.
  • cd — Simply typing cd with no arguments also takes you back to your home directory.

3. Moving Up One Level (..)

To go "backwards" or up to the parent directory:

  • cd .. — Moves you up one level. (For example, if you are in /home/labex/project, typing cd .. takes you to /home/labex).

4. Moving to the Last Directory (-)

  • cd - — This is like a "back" button; it takes you to the previous directory you were in.

Summary Checklist for Navigation:

Command Action
pwd Check where you are.
ls See what folders are available to enter.
cd <name> Enter a folder.
cd .. Go back up one level.

Try this in your terminal:

  1. Type cd ~ to go home.
  2. Type pwd to confirm you are at /home/labex.
  3. Type cd project to go back into your project folder.
  4. Type pwd again!

0 Comments

no data
Be the first to share your comment!