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
pwdcommand.
-
List the contents of a directory using the
lscommand 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
clearand thehistorycommand.
3. Command 1: Where am I? (pwd)
When you get lost in the terminal, you type pwd (Print Working Directory).
bash
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
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 normallscommand. You must use-ato 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
The Navigation Shortcuts:
-
cd ..(Two dots) -> Walk UP one level to the parent directory. If you are in/home/alex, typingcd ..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. Typingclear(or pressingCtrl + L) wipes the screen clean, moving your prompt back to the top.
-
history: Forgot that massive command you typed 20 minutes ago? Typehistory. 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: Thels -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. Typecd Docand press theTabkey. It prevents typos and makes you look like a professional. If there is aDocumentsand aDownloadsfolder, 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 documentswill fail with "No such file or directory." You MUST typecd Documentswith a capital D. A file namedReport.txtis a completely different file fromreport.txt.
10. Mini Project: The Terminal Obstacle Course
Open your terminal (WSL, Mac Terminal, or Linux VM) and perform this sequence:-
1.
Type
pwd. Confirm you are in your home directory.
-
2.
Type
cd /var/log. (Jump to logs).
-
3.
Type
pwd. Confirm your location changed.
-
4.
Type
ls -la. View the massive list of system logs and hidden files.
-
5.
Type
cd -. (Jump back to where you came from).
-
6.
Type
pwd. You should be back in your home directory!
- 7. Press the Up Arrow key three times to cycle through the history of what you just typed.
11. Practice Exercises
- 1. What command and specific flag would you type to view a detailed, vertical list of files that explicitly includes hidden configuration files?
-
2.
Explain the difference between typing
cd /andcd ~. 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 anls -lacommand.
-
Q: A junior developer is trying to navigate to a folder called
AppDatabut complains the terminal says the directory does not exist. You notice they typedcd appdata. Explain why this fails in Linux but might have worked for them on Windows.
-
Q: Describe how you would utilize the
historycommand 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 usedpwd 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.