Linux Terminal – Hands-On Practice

Companion practice file to the study notes. Run these in an actual Linux terminal (a VM, WSL, or a cloud instance all work fine). Each drill isolates one concept; the capstone at the end combines everything into one realistic sysadmin-style session.

Safety note before you start: several drills below intentionally simulate small mistakes so you can see their effect. Do them in a disposable VM or a non-production account — not on a machine you actually depend on.


Quick Drills (5–10 min each)

Drill 1 — Terminal & shell orientation

  1. Open your terminal using three different methods: the applications menu, right-click → “Open in Terminal,” and the Ctrl+Alt+T shortcut.
  2. Open a second tab in the same window (the + button).
  3. Run echo $0 in each tab — confirm both report the same shell (likely bash or -bash).
  4. Run type bash and type cd. Note which one is an executable file and which is a shell builtin.

Check yourself: Can you explain, in one sentence each, the difference between the terminal window and the shell running inside it?


Drill 2 — Command anatomy

  1. Run ping -c 1 8.8.8.8. Identify out loud (or in a notes file) which part is the command, which is the option, which is the option’s value, and which is the argument.
  2. Run ping with no arguments at all. Read the error message carefully.
  3. Run ls, then ls -l /etc, then ls -la /etc, then ls --all /etc. Confirm the last two produce identical output.
  4. Run df, then df -h (human-readable sizes — a bonus option not in the transcript, but useful to discover on your own).

Check yourself: Without looking at your notes, write the general syntax pattern command [options] [arguments] from memory.


Drill 3 — man pages and getting help

  1. Open man ls. Practice: g (top), G (bottom), /format + Enter (search forward), n (next match), q (quit).
  2. Find the SYNOPSIS line for ls. Identify one part in square brackets (optional) and explain what the ... after [FILE] means.
  3. Run type useradd and type alias. Try man useradd on one and help alias (or the appropriate builtin) on the other — confirm which works.
  4. Use apropos or man -k to find every command related to the word "password". List at least 2 you didn’t know existed.

Check yourself: Explain the difference between bold text and italic/underlined text inside a man page synopsis.


Drill 4 — Tab completion discipline

  1. Type ifc and press Tab — confirm it completes to ifconfig (install net-tools first if needed: sudo apt install net-tools).
  2. Type just if and press Tab once (nothing happens), then Tab again to see all matches. Keep typing until it resolves uniquely.
  3. Type cat /e + Tab, then continue toward /etc/passwd using Tab at each opportunity — never type a full path segment by hand.
  4. Deliberate mistake drill: in a scratch directory (mkdir ~/tabtest && cd ~/tabtest && touch fileone), type cat fileone with two spaces in the middle, then press Tab. Notice it does not complete — this is your signal something’s wrong. Fix the extra space, then Tab again and confirm it now completes.

Check yourself: State the rule from the lecture in your own words: what should you do the moment Tab fails to complete something you expected it to?


Drill 5 — Keyboard shortcuts in motion

  1. Run ls -l /etc/passwd.
  2. Press to recall it, then Ctrl+A to jump to the start of the line, delete ls -l and type cat instead, then Enter.
  3. Type a long command, then press Ctrl+U partway through — confirm the line before the cursor is wiped.
  4. Start a long-running command (ping 8.8.8.8 with no -c limit) and stop it with Ctrl+C.
  5. Start it again, this time pause it with Ctrl+Z, then resume it with fg (foreground) or bg %1 (background).
  6. Press Ctrl+L to clear your screen.

Check yourself: What’s the practical difference between stopping a process with Ctrl+C versus Ctrl+Z?


Drill 6 — Bash history control

  1. Check your limits: echo $HISTFILESIZE and echo $HISTSIZE.
  2. Run 5 different harmless commands (whoami, pwd, date, uptime, id).
  3. Run history and find each one by its line number.
  4. Re-run one using !<number>, then re-run the most recent using !!.
  5. Try !wh:p (print, don’t run) before actually running !wh.
  6. Check your current HISTCONTROL value: echo $HISTCONTROL. Set it to ignorespace for this session only, then run a command with a leading space and confirm it’s absent from history.
  7. Set HISTTIMEFORMAT="%d/%m/%y %T" and run history again — confirm timestamps now appear.
  8. Delete one specific history line with history -d <line_number>.

Check yourself: Explain why history -c alone, run right after doing something you didn’t want logged, might actually draw more attention than it prevents.


Drill 7 — Root access, the three ways

(Do this only in a disposable VM.)

  1. Run id to confirm your current user and groups.
  2. Try sudo su, confirm your prompt now ends in #, then exit back out.
  3. Try a single privileged command with plain sudo: sudo groupadd testgroup101. Then immediately run a second sudo command — notice you’re not re-prompted for a password (5-minute credential cache).
  4. Run sudo -k to invalidate the cache, then try a third sudo command — confirm you’re prompted again.
  5. Set a root password (Ubuntu only, since it has none by default): sudo passwd root. Then try plain su and log in with that root password.
  6. Compare / and /root — run ls / and ls /root and explain in your own words why they are not the same thing.

Check yourself: Which of the three root-access methods is generally considered the safest habit for day-to-day admin work, and why?


Capstone Lab: “New Server Onboarding” (30–45 min)

Scenario: You’ve just been handed a fresh Ubuntu server (or VM) as a junior sysadmin. Your task is to do initial setup and safe exploration — combining terminal basics, help-seeking, history hygiene, and privilege management the way you would on a real first day.

Work through this as one continuous session. Where a step says “explain,” write a one-line comment either in your terminal (as a # comment, harmless in bash) or in a separate notes file.

  1. Orient yourself.
    • Open a terminal. Check your current user and groups with id.
    • Confirm your default shell: echo $SHELL.
  2. Install a better terminal tool.
    • Update package lists and install terminator: sudo apt update && sudo apt install terminator
    • Open Terminator and split the window both horizontally and vertically at least once.
  3. Investigate the network.
    • Check if ifconfig works. If not, install net-tools.
    • Use ifconfig (or ip a as a modern alternative) to find this machine’s IP address.
    • Confirm outbound connectivity: ping -c 3 8.8.8.8. Explain what would happen if you ran plain ping 8.8.8.8 with no -c option, and how you’d stop it if you did.
  4. Learn a command you’ve never used, using only built-in help.
    • Pick a command you haven’t used before (e.g., du, free, uptime, who, w).
    • Use man to read its synopsis and at least two options.
    • Confirm with type whether it’s a builtin or executable, and use the correct help method (man, help, or --help) accordingly.
    • Use man -k or apropos to find one other command related to the same topic.
  5. Do some safe file exploration using Tab discipline.
    • Using only Tab completion (no manually typed full paths), navigate to /var/log and view the contents of one log file with cat or less.
    • Deliberately introduce a stray space in a path and observe Tab refusing to complete it — then fix it. Write one sentence on why this habit matters, referencing the /var/log deletion risk from the lecture.
  6. Create a group and a user as root, two different ways.
    • Use sudo groupadd to create a group called deploy.
    • Use sudo useradd to create a user called svc_app and add them to the deploy group.
    • Set a password for svc_app using sudo passwd svc_app.
    • Now do the equivalent user-creation task a second way: sudo su, create a second test user directly as root, then exit back to your normal account.
    • Explain in one line why the second approach (sudo su) carries more risk of “forgetting you’re root” than the first.
  7. Practice responsible history hygiene.
    • Run history and scroll through everything you’ve done in this lab.
    • Set HISTTIMEFORMAT="%d/%m/%y %T" and re-run history to see timestamps.
    • Make that setting permanent by appending it to ~/.bashrc.
    • Find the line number of one command you’d like to “clean up” (e.g., a typo’d command) and remove just that line with history -d.
  8. Wrap-up documentation.
    • In a plain text file (~/onboarding-notes.txt), write 5–8 lines summarizing: what shell is running, what IP address the server has, what groups/users you created, and one new command you learned today with a one-line description of what it does.
    • View the finished file with cat ~/onboarding-notes.txt.

Stretch goal (optional): Repeat steps 3 and 6 on a CentOS/RHEL machine or container if you have access to one, and note every place the behavior differs from Ubuntu (package manager, wheel vs sudo group, root password defaults, HISTCONTROL default).


Self-assessment checklist

By the end of this lab you should be able to, without hesitation:

  • [ ] Explain terminal vs. shell vs. console in your own words
  • [ ] Correctly identify command, option, option-value, and argument in any command line
  • [ ] Navigate and search a man page without touching the mouse
  • [ ] Tell whether a command is a shell builtin or an executable, and get help for either
  • [ ] Recite the Tab-completion safety rule and explain the /var/log cautionary example
  • [ ] Use at least 5 keyboard shortcuts from memory
  • [ ] Explain HISTFILESIZE vs HISTSIZE, and configure HISTCONTROL and HISTTIMEFORMAT
  • [ ] Demonstrate all three ways to gain root access, and state which is safest for daily use and why
  • [ ] Distinguish /, /root, and a regular user’s home directory
Arbaz
Arbaz

I’m a dedicated IT support and cloud engineering enthusiast with 3+ years of experience, passionate about solving problems, continuous learning, and creating innovative tech solutions.

Articles: 49

Leave a Reply

Your email address will not be published. Required fields are marked *