The terminal is a way to talk to your system through text. Each command does a small task. You do not need to memorize everything: start with a few commands, read their output, and use help when needed.
Know where you are
| Command | Example | What it does |
|---|---|---|
pwd | pwd | Shows the current folder. |
ls | ls -la | Lists files; -la adds details and hidden items. |
cd | cd Projects/site | Enters a folder. |
cd .. | cd .. | Goes up one folder. |
cd ~ | cd ~ | Goes to your home folder. |
Create and organize files
mkdir materials # creates a folder
mkdir -p notes/2026/october # creates a series of folders
touch reminder.txt # creates an empty file
cp source.txt copy.txt # copies a file
mv old.txt new.txt # moves or renames a fileUse cp -r source-folder copied-folder to copy an entire folder. Before moving or replacing files, run ls to check names and destination.
Read without editing
cat reminder.txt # shows a short file
less large-file.log # paged reading; press q to exit
head -n 20 file.txt # shows the first 20 lines
tail -n 20 file.log # shows the last 20 lines
tail -f app.log # follows new lines in real time
Find files and text
find . -name "*.html" # finds HTML files below the current folder
rg "search phrase" # searches for text in project files
rg --files | rg "config" # lists files with config in their namerg, also called ripgrep, is fast for searching projects. If it is not installed, grep is a common alternative: grep -R "phrase" ..
Permissions and processes
chmod +x script.sh # lets a script run
ps aux # lists running processes
man ls # opens the ls manualAvoid using sudo by habit. It runs a command with administrative powers and can modify important parts of the system. Read the command and understand why it is needed before confirming it.
The command that deserves extra care
rm deletes files. Start with rm -i file.txt, which asks for confirmation. Do not copy cleanup commands without understanding the path they use. After deletion, there may be no trash or simple recovery.A routine for building confidence
- Use
pwdandlsbefore creating, moving, or deleting. - Prefer testing in an example folder first.
- Use Tab to complete paths and reduce typing errors.
- Read
man command-namewhenever an option is unclear.