Thuta Learning
BasicDevOps & Toolsbeginner

Getting Around with pwd, ls, cd

Relax. We'll talk through this in plain words — no textbook voice.

What you'll walk away with

  • Understand pwd, ls, and cd, without the intimidation
  • Get comfortable trying out commands yourself in the terminal
  • See how these commands are actually useful on a real server or project

Let's think about it this way for a second

pwd (print working directory) asks 'where am I right now?' ls (list) shows 'what's in this room?' cd (change directory) means 'take me to this room.' There are two ways to write a path — an absolute path starts from / and spells out the full location (like a GPS address), while a relative path is written starting from where you currently are (like directions that say 'turn right'). .. means 'one folder up,' . means 'right here,' and ~ is a shortcut for 'my home folder.'

Let's connect this to a real-world scenario

cd is basically the same as clicking a folder icon in Windows Explorer — the only difference is you're giving the instruction with text instead of a mouse. Typing cd .. twice takes you up two levels. Typing cd ~, or just cd with nothing after it and hitting Enter, takes you straight back to your home folder — think of it as the 'go home for a quick break' shortcut.

Let's try it together in the terminal

bash
pwd
ls
cd /home
ls -la
cd ..
cd ~
cd Documents
You should see
pwd shows /home/username, and after cd .., ls shows the root-level folders.

5-minute try-it

Run cd /var/log. Then head back home with cd ~ and double-check your position with pwd.

A quick word of caution

Don't forget that paths are case-sensitive — Documents and documents are two completely different folders as far as Linux is concerned.

Easy traps

  • Assuming cd Documents (a relative path) works from anywhere — a relative path only depends on where you currently are
  • Mixing up ls and cd, thinking ls Documents takes you into the folder (ls only lists — cd is what actually moves you)

Now try it yourself

Run cd /var/log. Then head back home with cd ~ and double-check your position with pwd.

You'll know it worked when: pwd shows /home/username, and after cd .., ls shows the root-level folders.

Getting Around with pwd, ls, cd | Thuta Learning