Skip to content

Terminal and Shell Basics


You now know the shell sits between you and the kernel, translating what you type into something the system can act on. But knowing that conceptually and actually sitting in front of a blinking cursor are two different things. Open a terminal for the first time and it gives you almost nothing to go on — no menus, no buttons, just a prompt waiting for input. This chapter is about making that prompt make sense.

Opening A Terminal

How you open a terminal depends on your setup, but on any Debian-based desktop system you’ll typically find a “Terminal” application in your app menu, or a keyboard shortcut like Ctrl+Alt+T. On a server, you’re often dropped straight into a shell the moment you log in — there’s no desktop at all.

Either way, what you land in looks something like this:

you@hostname:~$

That line is called the prompt, and it’s not just decoration — it’s telling you three things at once.

Reading The Prompt

Break you@hostname:~$ into its pieces:

  • you — the username you’re currently logged in as
  • hostname — the name of the machine you’re on
  • ~ — your current location in the filesystem (~ is shorthand for your home directory — more on this in the next section)
  • $ — a symbol indicating your permission level

That last symbol matters more than it looks. A $ means you’re an ordinary user. A # means you’re operating as the root user — the account with unrestricted access to the entire system. If you ever see a # prompt and didn’t expect it, stop and figure out why before typing anything, since mistakes made as root have no safety net.

Warning

There’s no “are you sure?” prompt for most destructive commands on Linux. A $ prompt gives you some protection because ordinary users can’t touch most of the system. A # prompt gives you none. Treat root access with real caution — we’ll cover why permissions work this way in the Permissions section.

Anatomy Of A Command

Every command you type follows roughly the same shape:

command  [options]  [arguments]
  • command — the program you want to run
  • options (or “flags”) — modify how the command behaves, usually starting with - or --
  • arguments — what the command should act on

For example, in ls -l /home, ls is the command (list directory contents), -l is an option (show results in long format), and /home is the argument (the directory to list). None of these pieces are mandatory except the command itself — many commands run fine with no options or arguments at all.

Options come in two common styles:

StyleExampleMeaning
Short flag-lSingle letter, single dash
Long flag--allFull word, double dash
Combined short flags-laSame as -l -a together

Not every command supports both styles for the same option, and not every flag can be combined — but this pattern covers the vast majority of what you’ll type.

Getting Help Without Leaving The Terminal

You will not memorize every flag for every command, and you’re not meant to. Linux gives you two built-in ways to check:

man <command> opens the manual page — a full reference for that command, including every flag it supports. For example, man ls opens the complete manual for ls. Manual pages are dense but authoritative. Navigate them with the arrow keys, and press q to quit back to your prompt.

<command> --help prints a shorter, quicker summary directly to your terminal — usually enough to jog your memory without opening a full manual page. For example, ls --help.

Tip

When you’re not sure which to reach for: --help for a quick reminder of a flag you’ve used before, man when you need to actually understand a command you’re unfamiliar with. Reaching for man first is a habit worth building early — it’s almost always more complete than searching the web, and it works with no internet connection.

A Few Things That Will Trip You Up Early

The shell is case-sensitive. File.txt and file.txt are different files. LS is not the same command as ls — in fact, LS doesn’t exist at all as a default command.

Spaces matter. ls -l and ls-l are not the same thing — the second one is the shell trying (and failing) to find a program literally named ls-l.

Nothing confirms success by default. If a command runs without printing anything, that usually is the success message. Linux tools generally follow the philosophy of staying silent unless something needs your attention — a wall of unexpected output is more often a sign something went wrong than right.

The up arrow is your friend. Pressing the up arrow key cycles back through your previously typed commands, so you don’t need to retype something you just ran with a small change.

Putting It Together

Here’s what actually happens, step by step, when you type a command and hit Enter:

    sequenceDiagram
    participant You
    participant Shell as Shell (bash)
    participant Kernel
    You->>Shell: Type command + Enter
    Shell->>Shell: Parse command, options, arguments
    Shell->>Kernel: Request to run program
    Kernel->>Kernel: Execute program, manage resources
    Kernel-->>Shell: Return output/result
    Shell-->>You: Display output, show new prompt
  

That’s the whole loop you’ll be repeating for the rest of this course — and honestly, for as long as you use Linux at all. Every command, no matter how complex, moves through those same steps.

What’s Next

With the prompt and command structure demystified, the next chapter puts this into practice: moving around the filesystem, understanding where you actually are at any given moment, and getting comfortable navigating without a graphical file browser.

Last updated on