How to Use pwd, cd, and ls - Linux Basic Commands Tutorial
What You'll Learn
Conclusion: pwd, ls, and cd give location, contents, and movement — the three core commands.
- Check "where you are" with
pwd - See "what's here" with
ls - Navigate anywhere with
cd - Fix "No such file or directory" errors on your own
Target Audience: First-time Linux command users, those nervous about the terminal
Introduction: Lina's First Stumble
Conclusion: Lina hits the terminal and learns why pwd, ls, and cd are the starting point.
pwd (current location), ls (list), and cd (change directory). Once you know these, you won't get lost in the terminal.pwd - Check Your Current Location
Conclusion: Run pwd first to know where you are — this single habit prevents most accidents.
pwd command. It tells you where you are right now.pwd reduces accidents.Let's Try It
$ pwd
/home/user
Key Point: The output /home/user means "you're currently in your home directory." / is the Linux root (the topmost directory), and from there you've gone through home → user.
/home/user! So that's where I am right now?pwd to check.ls - See What's Here
Conclusion: ls shows directory contents; ls -la adds details and reveals hidden files too.
ls command. It shows you what's in your current location.ls first.Basic ls
$ ls
documents pictures downloads
ls -la more often. -l for detailed view, -a to show hidden files too.Detailed View (ls -la)
$ ls -la
total 12 drwxr-xr-x 5 user user 4096 Feb 2 10:00 . drwxr-xr-x 3 user user 4096 Feb 2 10:00 .. drwxr-xr-x 2 user user 4096 Feb 2 10:01 documents drwxr-xr-x 2 user user 4096 Feb 2 10:01 pictures drwxr-xr-x 2 user user 4096 Feb 2 10:01 downloads
Key Point: You don't need to understand everything at first! Just remember these 2 things:
- First character:
dmeans directory (folder),-means file - Last name:
documentsorpicturesis the directory name
(rwxr-xr-x is about permissions - "who can read/write." You can learn this later!)
pwd to check location, then ls -la to check contents. That's the basic pattern.cd - Navigate Directories
Conclusion: cd enters dirs; .. goes up one; ~ goes home; - returns to the previous place.
cd command. It lets you move between directories.cd documents.Move to a Directory
$ cd documents $ pwd
/home/user/documents
pwd, it shows /home/user/documents now.pwd after moving.Common Shortcuts
$ cd ~ # Go to home directory $ cd .. # Go up one directory $ cd - # Go back to previous location
.. is handy! It goes up one level?cd .. goes up one level, cd ~ takes you straight home. Remember these to make navigation much easier.Common Pitfall: No such file or directory
cd dowloads and got "No such file or directory" error...ls -la first and copy-paste it.Recovery Pattern:
- Check location with
pwd - Check options with
ls -la - Copy the exact directory name and use
cd
Mini Challenges - Practice Now
Conclusion: Practice pwd, ls -la, and cd in mini challenges to lock in the core workflow.
Challenge 1: Check your location and list contents
$ pwd $ ls -la
Challenge 2: Move to documents directory and come back
$ cd documents $ pwd $ cd .. $ pwd
cd ..!Challenge 3: Jump straight to home directory
$ cd ~ $ pwd
Today's 3-Line Summary
Conclusion: pwd, ls, and cd in 3 lines — the terminal foundation before anything else.
pwdchecks "where you are" (prevents getting lost)ls -lashows "what's here" in detail (including hidden files)cdto move,cd ..to go up,cd ~to go home
Practice these commands anytime in the interactive terminal.