Skip to main content
Linux Command Line – Complete Beginner to Advanced Guide
CHAPTER 03 Beginner

Basic Linux Navigation Commands

Updated: May 16, 2026
25 min read

# CHAPTER 3

Basic Linux Navigation Commands

1. Introduction

When you open a GUI file explorer in Windows, your eyes instantly tell you where you are, and you double-click folders to move around. When you open a Linux terminal, you are met with a dark screen and a blinking cursor. You are blind. To survive, you must use commands as your eyes and legs. You must ask the terminal: "Where am I standing?", "What is in this room?", and "How do I walk to the next room?" In this chapter, we will master the holy trinity of Linux navigation: pwd, ls, and cd. These three commands represent 80% of your daily interactions with the Linux command line.

2. Learning Objectives

By the end of this chapter, you will be able to:
  • Identify your current location in the filesystem using the pwd command.
  • List the contents of a directory using the ls command and its critical flags (-l, -a).
  • Navigate the filesystem tree using the cd (Change Directory) command.
  • Utilize the . and .. shortcuts for relative navigation.
  • Manage your terminal workspace using clear and the history command.

3. Command 1: Where am I? (pwd)

When you get lost in the terminal, you type pwd (Print Working Directory).
bash
12
alex@server:~$ pwd
/home/alex

The terminal prints the Absolute Path of the exact folder you are currently standing in. It is your GPS locator button.

4. Command 2: What is around me? (ls)

To see the files and folders inside your current directory, you type ls (List).
bash
12
alex@server:~$ ls
Desktop  Documents  Downloads  Music

Flags (Modifying the command): Commands can be altered by adding a hyphen and a letter (a flag).

  • ls -l (Long format): Displays a detailed vertical list showing file sizes, permissions, and creation dates.
  • ls -a (All): Displays hidden files. In Linux, any file or folder that starts with a dot (e.g., .bashrc) is completely invisible to a normal ls command. You must use -a to see the secret files!
  • ls -la: You can combine flags! This lists *all* hidden files in *long* format.

5. Command 3: How do I move? (cd)

To walk into a different folder, you use cd (Change Directory).
bash
12345
# Using a relative path to walk into the Documents folder
alex@server:~$ cd Documents

# Using an absolute path to jump directly to the system logs
alex@server:~/Documents$ cd /var/log

The Navigation Shortcuts:

  • cd .. (Two dots) -> Walk UP one level to the parent directory. If you are in /home/alex, typing cd .. places you in /home.
  • cd . (One dot) -> Represents "Right here, current directory." (Mostly used when running scripts).
  • cd ~ (Tilde) -> Instantly teleports you back to your Home directory from anywhere in the system.
  • cd - (Dash) -> Teleports you back to the very last folder you were just in. Like the "Back" button on a web browser.

6. Terminal Housekeeping (clear and history)

  • clear: After typing commands for an hour, your screen will be cluttered with text. Typing clear (or pressing Ctrl + L) wipes the screen clean, moving your prompt back to the top.
  • history: Forgot that massive command you typed 20 minutes ago? Type history. The terminal will print a numbered list of the last 1,000 commands you executed.
  • *Pro-Tip:* Press the Up Arrow on your keyboard to scroll backward through your previous commands one by one!

7. Diagrams/Visual Suggestions

*Visual Concept: The ls -l Output Breakdown* Show a screenshot of an ls -l output. Use colored arrows pointing to the specific columns of text to explain them to the user:
  • Arrow 1 pointing to drwxr-xr-x -> "File Permissions"
  • Arrow 2 pointing to alex -> "Owner"
  • Arrow 3 pointing to 4096 -> "File Size in bytes"
  • Arrow 4 pointing to Nov 12 14:00 -> "Last Modified Date"
  • Arrow 5 pointing to Documents -> "File/Folder Name"

8. Best Practices

  • Tab Completion (Again!): When typing cd Documents, NEVER type the whole word. Type cd Doc and press the Tab key. It prevents typos and makes you look like a professional. If there is a Documents and a Downloads folder, hitting Tab once will do nothing. Hit Tab *twice* rapidly, and Linux will list all matching options!

9. Common Mistakes

  • Case Sensitivity: Windows does not care about capital letters. Linux is strictly Case Sensitive. cd documents will fail with "No such file or directory." You MUST type cd Documents with a capital D. A file named Report.txt is a completely different file from report.txt.

10. Mini Project: The Terminal Obstacle Course

Open your terminal (WSL, Mac Terminal, or Linux VM) and perform this sequence:
  1. 1. Type pwd. Confirm you are in your home directory.
  1. 2. Type cd /var/log. (Jump to logs).
  1. 3. Type pwd. Confirm your location changed.
  1. 4. Type ls -la. View the massive list of system logs and hidden files.
  1. 5. Type cd -. (Jump back to where you came from).
  1. 6. Type pwd. You should be back in your home directory!
  1. 7. Press the Up Arrow key three times to cycle through the history of what you just typed.

11. Practice Exercises

  1. 1. What command and specific flag would you type to view a detailed, vertical list of files that explicitly includes hidden configuration files?
  1. 2. Explain the difference between typing cd / and cd ~. Where does each command take you?

12. MCQs with Answers

Question 1

You are deeply lost within the Linux filesystem and want to instantly return to your personal user workspace. Which command accomplishes this?

Question 2

In Linux, how does the operating system determine that a file or folder should be "hidden" from the standard ls output?

13. Interview Questions

  • Q: Explain the significance of the . (single dot) and .. (double dot) directories that appear at the top of every folder when you run an ls -la command.
  • Q: A junior developer is trying to navigate to a folder called AppData but complains the terminal says the directory does not exist. You notice they typed cd appdata. Explain why this fails in Linux but might have worked for them on Windows.
  • Q: Describe how you would utilize the history command alongside the grep tool to find a complex command you typed two days ago.

14. FAQs

Q: I typed a command and the terminal is just frozen with a > symbol. How do I escape? A: You likely opened a quote (") but forgot to close it. The terminal is waiting for you to finish the sentence. The universal panic button in the Linux terminal is Ctrl + C. It instantly cancels whatever command is currently running and gives you a fresh prompt.

15. Summary

In Chapter 3, we gained our terminal senses. We used pwd to print our absolute GPS coordinates, acting as our eyes to verify our location. We deployed ls with the -l and -a flags to illuminate the contents of directories, exposing hidden configuration files. We utilized cd as our legs, traversing the filesystem using Absolute paths, Relative paths, and powerful shortcuts like .. (up) and ~ (home). Finally, we learned to manage our workspace efficiency using clear, history, and the absolute necessity of Tab Completion.

16. Next Chapter Recommendation

We can walk around the house, but the house is empty. We need to start building and moving furniture. Proceed to Chapter 4: Working with Files and Directories.

Finish this Chapter

Save your progress on your learning path and prepare for coding interview challenges.

Discussion

Join the discussion

Log in or create a free account to participate.

Sort: ·