Chapter 2

Now that you can talk to the shell, let’s figure out where you actually are in Linux and how to move around. Think of this as learning to explore the map of your new world.


🌳 The Linux Filesystem Tree

Linux organizes everything in a single tree, starting from / (the root directory).

/
β”œβ”€β”€ bin/     β†’ Essential commands (like ls, cp, mv)
β”œβ”€β”€ home/    β†’ User folders (e.g., /home/alex)
β”œβ”€β”€ etc/     β†’ System configuration files
β”œβ”€β”€ var/     β†’ Logs, caches, temporary files
β”œβ”€β”€ usr/     β†’ Apps, libraries, documentation
β”œβ”€β”€ tmp/     β†’ Temporary stuff (wiped on reboot)
└── root/    β†’ Admin user’s home directory

πŸ’‘ Unlike Windows (C:\, D:\), Linux doesn’t have multiple drives β€” everything lives inside this one giant tree.


πŸ“ Where Am I?

Find your current spot:

pwd
  • pwd = Print Working Directory

  • Shows your exact location.

Example:

This means you’re in your own home folder.


πŸ“¦ What’s Here?

List what’s inside your current directory:

Useful variants:

Example:


🚢 Moving Around

  • Change directory:

  • Go up one level:

  • Jump home:

  • Go to root:


🧭 Paths: Absolute vs Relative

  • Absolute path β†’ Always starts from /. Example: /home/alex/Documents

  • Relative path β†’ Starts from where you are right now. Example: Documents (if you’re in /home/alex).

πŸ‘‰ Think of absolute as a full GPS address, relative as local directions.


⚑ Pro Navigation Tricks

  • cd - β†’ Jump back to the previous folder.

  • cd . β†’ Stay in the same place (basically no move).

  • cd ~username β†’ Go to another user’s home directory.


πŸ‹οΈ Exercises

  1. Open your terminal.

  2. Run:

  3. Move into a folder (like Documents) β†’ then back with cd ...

  4. Try going directly to / using:

  5. Jump back home with cd ~.

  6. Test cd - to hop between two directories.


Date Learned: 13 August 2025

Source: The Linux Command Line, Chapter 2

Last updated