The terminal looks intimidating, but it's really just a text box for telling your computer to do things. These ~20 commands cover most of what anyone does every day. Learn them once and you'll use them forever.
1. Finding your way around
pwd # print working directory – where am I? ls # list files in the current folder ls -la # list everything, including hidden files (a = all, l = details) cd folder # change directory – go into a folder cd .. # go up one folder cd ~ # go to your home folder cd - # go back to the previous folder you were in
cd is the one you'll type most. Remember: .. means "parent
folder" and ~ means "home".
2. Working with files
cp source dest # copy a file mv source dest # move (or rename) a file rm file # delete a file rm -r folder # delete a folder and everything inside it (careful!) mkdir folder # make a new folder touch file # create an empty file cat file # print a file's contents less file # view a file page by page (q to quit) nano file # edit a file in a simple editor (Ctrl+O save, Ctrl+X exit)
There is no undo for rm. It's the terminal equivalent of dragging
something into the void. Always double-check the path before you press Enter.
3. Permissions (why Linux asks who you are)
Linux is built around users and permissions. Every file has an owner and access settings – read, write, execute – for the owner, their group, and everyone else.
ls -l # shows permissions (like -rw-r--r-- and the owner) chmod +x file # make a file executable chown user file # change a file's owner sudo command # run a command as administrator
sudo ("superuser do") is how you install software or change system
settings. Only use it when a command fails with a permission error – and always know
what the command does first.
4. Installing software (package managers)
Linux installs software through a package manager. The command depends on your distro family:
# Debian / Ubuntu / Mint sudo apt update && sudo apt upgrade # update everything sudo apt install package-name # install sudo apt remove package-name # remove # Fedora / RHEL family sudo dnf upgrade # update everything sudo dnf install package-name # install sudo dnf remove package-name # remove
Install && means "run the first, and if it succeeds, run the second".
Updating first keeps the package lists current.
5. Pipes: the terminal superpower
The | character (a pipe) feeds one command's output into the next
command. This is where the terminal becomes magical:
ls | wc -l # count how many files are here history | tail # show your recent commands grep error log.txt # search a file for "error" ps aux | grep firefox # find running Firefox processes
grep deserves its own medal – it searches text for a pattern. You'll use
it constantly.
6. Looking around the system
top # live view of running processes (q to quit) htop # friendlier version of top (if installed) df -h # how full are my disks? (h = human-readable) free -h # how much RAM is in use? uname -a # what kernel am I running? ip a # my network addresses ping google.com # is the internet reachable? (Ctrl+C to stop)
7. Quick tips that save time
- Tab to autocomplete – press Tab to finish file and command names. Every terminal user does this.
- Up arrow – recall the previous command.
- Ctrl+C – cancel whatever is running.
- Ctrl+L – clear the screen.
- Ctrl+R – search your command history.
- man command – read the manual for any command (q to quit).
A tiny real-world session
Here's everything above working together:
$ cd ~/projects $ mkdir mysite $ cd mysite $ touch index.html $ ls -la $ nano index.html # type some HTML, Ctrl+O, Ctrl+X $ grep -i "title" index.html # did I write a title? $ cd .. $ rm -r mysite # oops – no undo from here
You don't need to memorize any of this – man and the tab key will carry
you. Just keep these handy and the terminal stops being scary and starts being your
favorite tool.
Never memorize the permission number table again – toggle read/write/execute and get the chmod command instantly.
Open calculator →Grab the free VelsTech Linux command cheat sheet – the commands you'll actually use, all on one page.
Get the cheat sheet →