Linux
Linux Command Line Essentials
Get comfortable in a Linux terminal: navigate, manage files, understand permissions, chain commands with pipes, and know how to get unstuck.
Tutorial overview
What you will learn
- Navigate a Linux filesystem confidently from the terminal
- Create
- move
- inspect
- and delete files and directories safely
- Read permission strings and change them with chmod
- Chain commands with pipes and redirection to answer real questions
By the end, you will have
- A practiced set of everyday commands
- A small directory project built entirely from the terminal
- The reflexes to explore any unfamiliar Linux system
Introduction
Every server you will ever rent, every Docker container you will ever debug, and most of the cloud runs Linux. The graphical desktop is optional; the command line is not. The good news: the terminal is a small language, not a big one. A couple of dozen commands cover ninety percent of daily work, and they have barely changed in decades — which makes this one of the highest-value, lowest-churn skills in computing.
This tutorial is written for two readers: the genuine beginner, and the returning practitioner who once knew this and wants it back fast. Both should type every command rather than read past it — the terminal is learned in the fingers.
What you will build or practice
You will build a small project workspace — directories, files, a search across them, a permissions fix — entirely from the keyboard, and finish with the command set that daily Linux work actually uses.
Before you begin
You need a shell prompt. Any of these works:
- Linux machine or server — open Terminal, or connect with
ssh. - Mac — Terminal works for nearly everything here (macOS is Unix, not Linux, but these commands behave the same).
- Windows — install WSL (Windows Subsystem for Linux): open PowerShell as administrator and run
wsl --install, which sets up Ubuntu by default.
Key concept
The filesystem is a tree, and you are always standing somewhere in it. Every Linux path starts at the root, written /. Your home directory lives at /home/yourname (shortcut: ~). At any moment your shell has a working directory — the place commands act on by default. Most beginner confusion is really just "I'm not where I think I am," and one command (pwd) cures it.
The second idea worth loading before your fingers start: commands are small tools that do one thing, and the shell lets you snap them together. That's the pipe (|) — the output of one command becomes the input of the next. It is the single most Linux idea in Linux.
Step 1: Learn to stand somewhere
Open a terminal and orient yourself:
pwd
pwd prints your working directory — probably /home/yourname. Now look around and move:
ls # list what's here
ls -la # long form, including hidden "dotfiles"
cd / # go to the root of the tree
ls
cd ~ # and back home
Spend a minute at /. Those directories are the standard Linux layout: etc (system configuration), home (users), var (logs and changing data), usr (installed software), tmp (scratch space, cleared on reboot).
Step 2: Make things
Build a workspace:
mkdir -p projects/notes-app/{src,docs}
cd projects/notes-app
touch src/app.py docs/README.md
echo "A tiny notes application" > docs/README.md
Four commands, four ideas: mkdir -p creates nested directories in one go, touch creates empty files, > redirects a command's output into a file (replacing it), and the {src,docs} brace expansion made two directories at once.
Inspect what you built:
ls -R # recursive listing
cat docs/README.md
Step 3: Move, copy, delete — carefully
cp docs/README.md docs/README.backup.md # copy
mv src/app.py src/main.py # rename (moving IS renaming)
rm docs/README.backup.md # delete
Step 4: Read the permission string
Run ls -l in any directory and look at the first column — something like -rw-r--r--. That is three sets of three: owner, group, everyone else, each with read (r), write (w), execute (x) flags. A leading d means directory.
Make a script and make it runnable:
echo 'echo "hello from a script"' > hello.sh
./hello.sh # Permission denied — it isn't executable yet
chmod +x hello.sh
./hello.sh # now it runs
chmod +x adds the execute bit. You will also meet numeric form — chmod 644 file (owner read/write, everyone else read) and chmod 755 script (owner everything, others read/execute) cover most real cases. When a command needs system-level rights, prefix it with sudo — and treat that as a deliberate act, not a reflex.
Step 5: Ask the system questions with pipes
This is where the terminal starts beating any GUI:
grep -r "notes" . # find text in files, recursively
find . -name "*.md" # find files by name
history | grep chmod # what chmod commands have I run?
ls -la /etc | head -20 # first 20 lines of a long listing
du -sh * # how big is each thing here?
Each pipe (|) feeds one tool's output into the next. grep filters, head/tail trim, sort and wc -l count and order. Small tools, snapped together, answering a question you actually had — that is the daily rhythm of Linux work.
Step 6: Install software
On Ubuntu and Debian-family systems:
sudo apt update # refresh the package index
sudo apt install htop # install something useful
htop # an interactive process viewer (q to quit)
Fedora and RHEL-family use dnf, Arch uses pacman, Alpine (common in containers) uses apk. Same idea everywhere: a package manager installs, upgrades, and removes software as coherent packages — this is the normal way software arrives on Linux, not downloaded installers.
Practice exercise
Without looking back at the steps above:
- The task: create a directory
logs-practicecontaining three files —app.logwith the lineERROR: disk full,web.logwithINFO: started, andnotes.txtwith anything. Then, with a single piped command, count how many.logfiles mentionERROR. - Expected output:
1 - One hint:
grep -llists matching files;wc -lcounts lines. - Stretch goal: make
app.logreadable by you alone (chmod 600), and verify withls -l.
Common mistakes
- Running commands in the wrong directory.
pwdfirst, always. Deleting or overwriting in the wrong place is the classic self-inflicted wound. - Reflexive
sudo. If a normal command fails, read the error before elevating. Most "permission denied" moments in your own home directory mean a typo'd path, not a missing privilege. - Fearing the man pages.
man lslooks intimidating and is actually just a reference. Faster still:ls --helpfor a summary. Getting unstuck locally is a skill worth practicing before reaching for a search engine. - Spaces in filenames without quotes.
rm my file.txtdeletesmyandfile.txt. Quote paths with spaces:rm "my file.txt"— or avoid spaces in names you create.
Check your understanding
- What does
-rw-r--r--mean, group by group? - Why is
mvalso the rename command? - What does
grep -r "TODO" . | wc -ltell you, and how does the pipe make it work?
Key takeaways
- The filesystem is a tree;
pwd,ls, andcdare how you stand somewhere and look around. mkdir,touch,cp,mv,rmmanage files — andrmis permanent, so look before you delete.- Permissions are three triads (owner/group/other);
chmodchanges them,sudoelevates deliberately. - Pipes turn small commands into answers: filter with
grep, trim withhead, count withwc -l. - Package managers (
apt,dnf,pacman) are how software properly arrives on Linux.
Next steps
Keep the Linux Commands Cheat Sheet within reach — it is the compressed version of this tutorial plus the next tier of commands (processes, networking, disk space). Then put the skills to work: spin up any project starter and do the whole setup from the terminal.
Related resources
- Linux Commands Cheat Sheet — the quick reference version
- Project Starters — real terminal practice with a purpose
- Encryption and HTTPS in Plain English — what's happening when you
sshanywhere
Newsletter or next lesson
More plain-English lessons land regularly — browse the tutorials collection, or continue straight to the cheat sheet and start building muscle memory.