Linux is the operating system that runs most of the world's servers. You control it by typing commands
into a shell (the program that reads your commands — usually bash). Let's
decode the prompt and run your first commands.
Before you type anything, the shell shows a prompt. It's packed with information:
[student@rhel9 ~]$ └─┬──┘ └─┬─┘ └┬┘└┬┘ │ │ │ └─ $ = normal user (# = root/superuser) │ │ └──── current directory (~ means your home) │ └───────── hostname of the machine └──────────────── the user you are logged in as
$ vs #
A $ at the end means you're a normal user. A # means you're root
— the all-powerful administrator, where a typo can wipe the system. We'll mostly stay a normal user and
use sudo only when we need power.
Run these in the terminal below — type each and press Enter:
whoami — who am I logged in as?pwd — print working directory (where am I?)ls — list what's in this directoryAlmost every command follows the same shape:
ls -l /etc │ │ └── argument: what to act on (here, the /etc directory) │ └─────── option/flag: changes behaviour (-l = long, detailed view) └──────────── the command itself
Options usually start with - (short, like -l) or -- (long, like
--all). You can combine short options: ls -la is -l plus -a.
| Trick | What it does |
|---|---|
| ↑ / ↓ | Scroll through commands you already typed (history). Try it above! |
clear | Wipe the screen clean. |
history | Show every command you've run this session. |
man ls | Open the manual for a command (here in short form). |
uname -a | Show the kernel & OS — proof you're on Linux. |
ls works, LS does not. Notes.txt and
notes.txt are two different files. Type carefully.
pwd = print working directory.# means you are…# = root. Be careful — root can change or delete anything.ls -la is…-la = long listing + show all (hidden) files.