Signal9Signal9 — home
online
all lessons

First Contact: The Shell & Moving Around

Beginner35 min8 steps
What you'll learn
  • Explain what a terminal and a shell are, and read the prompt with confidence
  • Tell commands, options/flags, and arguments apart in any command line
  • Answer 'where am I / what's here?' with pwd and ls, and move with cd
  • Picture the filesystem as one tree and read absolute and relative paths (/, ~, ., ..)
  • Read files with cat, less, head, and tail — and pick the right one for the job
  • Recover from the everyday errors, cancel a stuck command, respect rm, and lean on the sandbox reset
  1. What you're actually looking at

    Demystify the terminal, the shell, and that blinking prompt — before you type anything.

    If you've only ever used a computer by clicking, a screen of text with a blinking cursor can feel intimidating. It shouldn't — by the end of this paragraph you'll know exactly what you're looking at.

    Two words, often used loosely, mean two different things:

    • The terminal is the window — the frame that shows text and takes your keystrokes. (You'll also hear "console" or "command line" — same idea.)
    • The shell is the program running inside that window. It reads the line you type, figures out what you meant, runs it, and shows you the result.

    Think of it as a conversation. You say something (type a command and press Enter), the machine does it and replies, and then it shows a prompt — that little $-or-#-ended line that means "your turn." Say something, get a reply, repeat.

    That loop — type → Enter → read — is the entire interaction model. It never gets more complicated than that. Starting a web server, hunting down an intruder, deploying an app to a thousand machines: all of it is this same small conversation, just with different sentences.

    So why do professionals live here instead of clicking through menus? Three real reasons, not snobbery:

    • It's everywhere. Most servers have no desktop at all — the shell is the only way in. Learn it once, use it on every Linux machine on Earth.
    • It's automatable. Anything you can type, you can save into a script and have the machine do a thousand times, perfectly, while you sleep. You can't automate a mouse click nearly as well.
    • It's faster. Once the basics are in your fingers, a three-word command beats a dozen clicks.
    whoami
    root
    Your very first command — and a gentle one. It prints the username you're logged in as, and nothing else. In Signal9 labs that's root, the all-powerful administrator account. Notice the shape of the exchange: one word in, one word out. The machine did exactly what you asked — no more, no less. That literal-mindedness is the shell's defining trait, and once you expect it, everything gets predictable.

    Check yourself

    The text that appears when the machine has finished and is ready for your next command is called the…?

  2. Anatomy of a command

    Recognise the three parts of every command line: command, options, arguments.

    Here's a small idea that pays off forever: every command line you will ever type has the same three-part shape.

    `

    command -options arguments

    `

    • The command is the verb — the thing to do: ls (list), cd (change directory), cat (show a file).
    • Options (also called flags) change how the verb behaves. They start with a dash: ls -l lists in a long, detailed form. You can think of them as settings on the verb.
    • Arguments are what the verb acts on: ls /home lists a specific place.

    Two rules the shell never bends. Spaces separate the parts — ls-l is a mystery word, ls -l is a command with an option. And capitalisation matters everywhere: ls is a command, LS is "command not found."

    ls -l /
    drwxr-xr-x   2 root root  4096 Jun 30 10:02 bin
    drwxr-xr-x   4 root root  4096 Jun 30 10:04 etc
    drwxr-xr-x   3 root root  4096 Jun 30 10:02 home
    drwx------   5 root root  4096 Jul  1 09:15 root
    drwxr-xr-x  12 root root  4096 Jun 30 10:02 usr
    drwxr-xr-x  13 root root  4096 Jun 30 10:05 var
    -l
    long format: one line per entry with size, owner, and date
    All three parts in one line: ls is the command, -l is an option (long format — one entry per line with details), and / is the argument (list this place). Don't try to decode that wall of drwxr-xr-x letters yet — that's what the Permissions lesson is for. For now, just notice you asked one clear question and got one orderly answer.

    Check yourself

    In the command ls -a /home , which part is the option (flag)?

  3. Where am I? What's here?

    Never feel lost: always know your location (pwd) and your surroundings (ls).

    Here's the mental shift that makes the filesystem click: you are always standing somewhere in it. That spot is your working directory — in plain English, the folder you're currently "in." Commands act relative to where you're standing unless you tell them otherwise, so step one of not getting lost is always knowing your two basics:

    • pwd — print working directory: where am I?
    • ls — list: what's here?

    ls on its own is useful; ls with a flag or two is where it earns its keep. These are the ones you'll reach for daily:

    • ls -l — long detail (sizes, dates, owners)
    • ls -a — all files, including hidden ones (names starting with .)
    • ls -lh — long + human-readable sizes (4.0K instead of 4096)
    • ls -lt — newest first (time-sorted) — perfect for "what changed most recently?"
    • ls -S — biggest first (Size-sorted) — perfect for "what's eating the space?" (add -r to reverse either sort: ls -Sr is smallest first)
    • ls -R — Recursive: this folder and everything inside it
    pwd
    /root
    You're standing in /root — the administrator's home directory. This is the 'you are here' dot on the map. Any time a lab leaves you disoriented, pwd is the first thing to type: it costs nothing and instantly re-anchors you.
    ls -lh /root
    total 16K
    drwxr-xr-x 2 root root 4.0K Jul  1 09:15 practice
    -rw-r--r-- 1 root root  220 Jul  1 09:15 notes.txt
    drwxr-xr-x 3 root root 4.0K Jul  1 09:15 voyage
    -l
    long format — one entry per line, with details
    -h
    human-readable sizes (K, M, G) instead of raw bytes
    Long + human sizes: now 4.0K is readable at a glance instead of 4096. The leading d marks a directory (practice, voyage); a leading - marks a regular file (notes.txt). Already you can look at a folder and tell what's a container and what's content.
    mkdir -p /tmp/sizes && head -c 300 /dev/zero > /tmp/sizes/small.log && head -c 9000 /dev/zero > /tmp/sizes/big.log && head -c 2000 /dev/zero > /tmp/sizes/mid.log && ls -lS /tmp/sizes
    total 20
    -rw-r--r-- 1 root root 9000 Jul  1 09:16 big.log
    -rw-r--r-- 1 root root 2000 Jul  1 09:16 mid.log
    -rw-r--r-- 1 root root  300 Jul  1 09:16 small.log
    -S
    sort by file size, largest first
    -l
    long format, so you can see the sizes
    Three files of 300, 9000 and 2000 bytes, created in that order, listed by size: -S put the biggest at the top whatever order they were made in, and -l shows the byte counts that prove it. Drop the -l and ls -S prints just the names, still biggest first, so the first name it prints is the largest file in the folder.

    Check yourself

    You suspect a folder contains hidden files. Which ls flag reveals them?

  4. The filesystem is one big tree

    Read any path by understanding /, ~, ., and .. — absolute vs relative.

    Every file on a Linux machine lives in one single tree. Not "the C: drive and the D: drive" — one tree, and it starts at /, called the root of the filesystem. Everything branches out from there:

    / the root — the top of everything
    ├── bin/ essential programs
    ├── etc/ system configuration files
    ├── home/ regular users' home folders
    │ └── alice/
    ├── root/ the root user's home ← you are often here
    │ └── practice/
    └── var/
    └── log/ system logs live here
    One tree, starting at /. Every path is just directions to one spot in it.

    A path is simply directions to one spot in that tree. Read /var/log as "start at the root, into var, into log."

    There are two ways to give directions, and you'll use both constantly:

    • Absolute paths start at / and work from anywhere, because they always describe the full route from the top: /root/practice/attic.
    • Relative paths start from wherever you're standing, so they're shorter but depend on your current location: practice/attic (from inside /root).

    And four shorthands that appear everywhere — memorise these four and half of navigation is free:

    | Symbol | Means |

    |---|---|

    | / | the very top of the tree (and the separator between path parts) |

    | ~ | your home directory (/root for the root user) |

    | . | the directory you're standing in right now |

    | .. | the directory one level up (the parent) |

    Check yourself

    Which shorthand means 'one directory up from where I'm standing'?

  5. Moving around with cd

    Walk the tree confidently — down, up, home, and back.

    cd (change directory) is how you walk the tree. Every move you'll ever need is one of these:

    • cd practice — step into a folder that's here (relative)
    • cd /var/log — jump anywhere in one hop (absolute)
    • cd .. — step one level up
    • cd ~ — or just cd on its own — go home from anywhere
    • cd - — bounce back to wherever you just were (brilliant for hopping between two spots)

    Notice there's a rhythm to exploring any machine, and it's always the same loop: pwd (where am I?) → ls (what's here?) → cd somewhere → and repeat. When a lab says "go to X and do Y," that loop is literally how you get to X.

    cd /var/log && pwd && cd - && pwd
    /var/log
    /root
    /var/log
    A little tour in one line: jump to /var/log (absolute), confirm with pwd, then cd - bounces you back to /root, and a final pwd proves it. The && just chains commands so each runs only if the one before it succeeded — a pattern you'll use everywhere. cd - is the shell remembering your last location so you don't have to.

    Check yourself

    You're deep in /root/practice/attic/boxes and want to get back to your home directory in ONE command. What do you type?

  6. Reading files: cat, less, head, tail

    Pick the right reader for a file's size and read exactly what you need.

    Four readers, four jobs — and picking the right one is the whole skill:

    • cat file — pour the whole file onto the screen at once. Perfect for short files; chaos for a 50,000-line log.
    • less file — page through a long file calmly: arrows or space to scroll, /word to search, q to quit. (You already know its controls — the man help pages open in less.)
    • head -n 5 file — just the first 5 lines. Great for "what kind of file is this?"
    • tail -n 5 file — just the last 5 lines. Great for "what happened most recently?" (Later you'll love tail -f, which follows a growing log live, line by line as it's written.)

    And two small friends that round out the set: echo prints text back at you (echo hello → hello) — the backbone of scripting — and clear wipes a cluttered screen (nothing is lost; scroll up and it's all still there).

    Runnable in the fund-read-the-log room — that room’s setup plants the files it reads

    head -n 3 /root/voyage/log.txt
    day 001: cast off from Port Signal at dawn
    day 001: heading north-northeast, seas calm
    day 002: crew drilled on knots and rigging
    -n 3
    how many lines to show (the default is 10)
    head -n 3 shows exactly the first three lines — no scrolling through a hundred to see how a file begins. Swap head for tail and you'd see the last three instead. This 'peek at the edges' move is how you size up an unfamiliar file in one second.
    cat notes.txtpour the whole file onto the screen — perfect for short files
    less log.txtpage through a long file — space scrolls, /word searches, q quits
    head -n 5 log.txtonly the first 5 lines — the safe peek at an unknown file
    tail -n 5 log.txtonly the last 5 lines — what happened most recently
    tail -f log.txtfollow a growing log live, line by line as it's written

    Check yourself

    A log file is 80,000 lines and you only care about the most recent entries. Which command shows just the end of it?

  7. Safety habits from day one

    The three habits that make the terminal safe to explore fearlessly.

    1. `Ctrl-C` cancels. Command stuck? Output flooding the screen? Press Ctrl-C — it interrupts whatever's running and hands the prompt back to you. It isn't rude or dangerous; it's how everyone stops a runaway command. (One exception: if you're trapped inside a pager like less or man, the key to escape is q, not Ctrl-C.)

    2. `rm` is forever. There is no recycle bin in the terminal. rm file deletes it — permanently, silently, no "are you sure?". Until careful deletion is second nature, look before you delete: ls the target first so you know exactly what you're about to remove. The full deletion toolkit, including safety nets like rm -i (interactive, asks first), comes in the next module.

    3. Your sandbox resets. Every Signal9 lab is a throwaway machine. Delete the wrong thing? Break the box beyond repair? Reset the lab and it comes back pristine. Mistakes here cost you nothing — that is the entire point of a sandbox. So explore hard, try the scary command, and learn by doing.

    Check yourself

    A command is printing output endlessly and won't stop. Which key combination cancels it?

  8. Now do it — your first tour

    Read it, then run it. Take the navigation loop for a spin in your live terminal.

    You have a real shell to the right — and a real sandbox that resets, so nothing you type here can do harm. Run this short tour end to end and watch how each command answers a question. This is the loop every lab expects of you, so a minute here pays off immediately.

    whoami && pwd
    Who am I, and where am I standing? Two questions, one line. You should see your user (root) and your location (/root). This is your orientation reflex — start here whenever you land somewhere new.
    ls -la
    List everything here, hidden files included, in detail. Notice any names starting with a dot — those are the hidden config files ls normally keeps out of your way.
    cd /var/log && ls && cd -
    Travel to where the system logs live, look around, then bounce straight home with cd -. You just used an absolute path, a listing, and the 'back' shortcut in a single move — the whole navigation loop in one line.
Recap
  • The shell is a conversation: type a command, press Enter, read the answer, repeat — every Linux task is this one loop.
  • Every command line is command → -options → arguments, separated by spaces and case-sensitive; read errors to see which part is unhappy.
  • Stay oriented with the loop: pwd (where am I) → ls (what's here) → cd (move) → repeat. ls -lath shows everything, freshest first.
  • The filesystem is one tree from /. Absolute paths start at /; relative paths start here. ~ = home, . = here, .. = up.
  • Read files with the right tool: cat (short), less (long, q quits), head/tail (the edges; tail -f follows a live log).
  • Ctrl-C cancels a stuck command, q quits a pager, rm has no recycle bin — and the sandbox reset makes every mistake free.
Your first ten commands
CommandWhat it does
whoamiwho you're logged in as
pwdwhere you're standing (working directory)
ls · ls -l · ls -a · ls -lathwhat's here (detail / hidden / everything, freshest first)
cd name · cd .. · cdmove in / up / home
cd -bounce back to the last place you were
cat fileshow a whole (short) file
less filepage through a long file (q quits, /word searches)
head -n 5 · tail -n 5first / last lines of a file
echo textprint text back (the backbone of scripting)
clear · Ctrl-Cwipe the screen · cancel a stuck command