The terminal (black screen) scares people. But it’s faster, more precise, and more powerful than any mouse click. Once you know these 20 commands, you’ll feel like a wizard.
Introduction
Linux is everywhere — servers, clouds, android phones, and even Mars rovers. They all speak the same language: Bash. This guide covers the “Survival Kit” — the commands you will use 99% of the time.
- How to navigate folders (
cd,ls,pwd) - How to create, move, and copy files (
touch,cp,mv) - How to read files (
cat,less,head) - How to become the superuser (
sudo)
1. Navigation (Moving Around)
Imagine you are an explorer in a maze of folders.
pwd — “Where am I?”
Print Working Directory. Tells you your absolute path.
Show current directory path
ls — “What’s in here?”
List generic files.
List files in current folder
List with details (permissions, size, owner)
List ALL files (including hidden .dotfiles)
cd — “Take me there”
Change Directory.
Go into Downloads folder
Go UP one level (parent folder)
Go home (/home/user)
Go to root (very top)
2. File Manipulation (The Tools)
mkdir — Create Folder
Make a new directory
touch — Create File
Create an empty file
cp — Copy
Copy file.txt to copy.txt
Copy a whole FOLDER (recursive)
mv — Move (or Rename)
Linux doesn’t have a “rename” command. You just “move” the file to a new name.
Rename file.txt to newname.txt
Move file.txt into Documents folder
rm — Remove (Delete)
rm is permanent. There is no “Trash Can”. Once you run it, the file is gone forever.
Delete a file
Delete a folder and everything inside it
3. Reading Files
cat — Dump everything
Concatenate. Dumps the whole file to the screen. Good for small files.
Print file content to terminal
less — Scrollable View
Good for huge log files. Use arrow keys to scroll, q to quit.
Open file in read-only scrolling mode
head / tail — Peek
Show first 5 lines
Show last 5 lines (great for logs)
4. Search and System Info
grep — Find text
Global Regular Expression Print. Search for a word inside files.
Find lines containing 'error' in syslog
man — The Manual
Stuck? Ask the manual.
Show manual page for ls command (q to quit)
sudo — “God Mode”
SuperUser DO. Run a command with admin privileges.
Run update as root user
Hands-On Challenge
Open your terminal and try this sequence:
cd ~
mkdir flight-mission
cd flight-mission
touch plan-a.txt
touch plan-b.txt
mv plan-b.txt final-plan.txt
rm plan-a.txt
ls
# Output should basically be just final-plan.txt
Quiz: Test Your Knowledge
Test Your Knowledge
Take a quick 5-question quiz to check your understanding.