Here is a categorized list of the essential Linux commands, each with its syntax, role, and examples.
What makes this list different from others: every command on this page can be practiced right in your browser. Each entry has a practice link that opens the matching WebTerm Learn lesson. There is nothing to install and nothing you can break. Don't just read; when a command catches your eye, go type it.
Working with Files and Directories
The highest-frequency group, and the place to start.
| Command | Syntax | What it does | Practice |
|---|---|---|---|
pwd | pwd | Print the path of the directory you are currently in | Open lesson |
cd | cd directory | Change directory. cd .. goes up, cd - goes back | Open lesson |
ls | ls [options] | List files and directories | Open lesson |
mkdir | mkdir name | Create a directory. -p creates nested paths in one go | Open lesson |
touch | touch filename | Create an empty file (originally a timestamp updater) | Open lesson |
mv | mv source destination | Move files or directories; also used for renaming | Open lesson |
cp | cp source destination | Copy files. Use -r for directories | Open lesson |
rm | rm filename | Delete files. -r removes a directory and its contents | Open lesson |
rmdir | rmdir name | Delete only empty directories (fails safely if not empty) | Open lesson |
ln | ln -s target linkname | Create a symbolic link (a shortcut-like reference) | Open lesson |
The forms you will type most often:
ls -la # detailed view, including hidden files
mkdir -p app/src # create nested directories at once
cp -r docs backup # copy a whole directory
mv draft.txt notes/ # move into the notes directory
rm -i old.txt # confirm before deleting
Directories nest inside each other, and the "paths" you handle with pwd and cd are addresses into that nesting.
Viewing File Contents
Checking a file from the command line is often faster than opening an editor.
| Command | Syntax | What it does | Practice |
|---|---|---|---|
cat | cat filename | Print the whole file. Best for short files | Open lesson |
head | head -n N filename | Show only the first lines (10 by default) | Open lesson |
tail | tail -n N filename | Show only the last lines. The classic way to check recent log entries | Open lesson |
less | less filename | Scroll through a long file. Quit with q | Open lesson |
tail -n 20 access.log # just the latest 20 log lines
less error.log # scroll through a long log (q to quit)
Searching and Filtering
For "where is that file" and "which lines contain this string".
| Command | Syntax | What it does | Practice |
|---|---|---|---|
find | find path conditions | Find files by name, type, size, and more | Open lesson |
grep | grep pattern filename | Find lines matching a pattern inside files | Open lesson |
wc | wc -l filename | Count lines, words, and characters | Open lesson |
find . -name "*.log" # find .log files under the current directory
grep -n "ERROR" server.log # matching lines with line numbers
grep -r "TODO" src/ # search a directory recursively
wc -l access.log # count lines in a log
Pipes and Redirection
The real power of the terminal is combining commands. These are symbols rather than commands, but they matter just as much.
| Symbol | Syntax | What it does | Practice |
|---|---|---|---|
| | cmd1 | cmd2 | Send the output of the left command into the right one (pipe) | Open lesson |
> | cmd > file | Write output to a file (overwrite) | Open lesson |
>> | cmd >> file | Append output to the end of a file | Open lesson |
grep "ERROR" app.log | wc -l # count error lines
ls -la > files.txt # save the listing to a file
echo "done" >> history.log # append one line to a log
Compressing and Archiving
| Command | Syntax | What it does | Practice |
|---|---|---|---|
tar | tar -czf name.tar.gz target | Bundle and compress files (-czf), or extract (-xzf) | Open lesson |
tar -czf backup.tar.gz docs/ # compress the docs directory
tar -xzf backup.tar.gz # extract it
tar -tf backup.tar.gz # just list the contents
Shell Tricks and Configuration
The group that makes your daily typing faster.
| Command | Syntax | What it does | Practice |
|---|---|---|---|
echo | echo text | Print text or a variable's value, like echo $HOME | Open lesson |
alias | alias name='command' | Give a long command a short name | Open lesson |
export | export NAME=value | Set an environment variable | Open lesson |
env | env | List environment variables | Open lesson |
history | history | Show your command history. Pairs well with arrow keys and Ctrl+R | Open lesson |
man | man command | Open the manual for a command | Open lesson |
alias gs='git status' # two keystrokes for a frequent command
echo $SHELL # check which shell you are using
man ls # read the manual for ls (q to quit)
Permissions and Root Privileges
Unavoidable on servers. When you hit "Permission denied", come back here.
| Command | Syntax | What it does | Practice |
|---|---|---|---|
chmod | chmod mode filename | Change file permissions (read, write, execute) | Open lesson |
chown | chown owner filename | Change the owner of a file | Open lesson |
sudo | sudo command | Run a command with administrator (root) privileges | Open lesson |
chmod +x deploy.sh # make a script executable
sudo chown app config.yml # hand ownership to the app user
Users and Packages
| Command | Syntax | What it does | Practice |
|---|---|---|---|
useradd | sudo useradd name | Create a user | Open lesson |
passwd | sudo passwd name | Set a user's password | Open lesson |
apt | sudo apt install package | Search, install, and update software (Debian/Ubuntu family) | Open lesson |
sudo apt update # refresh package information
sudo apt install tree # install tree
Processes and System Health
When someone says "the server feels slow", these are the first commands you reach for.
| Command | Syntax | What it does | Practice |
|---|---|---|---|
ps | ps aux | List running processes | Open lesson |
top | top | Live view of CPU and memory usage. Quit with q | Open lesson |
kill | kill PID | Terminate a process | Open lesson |
df | df -h | Show free disk space | Open lesson |
du | du -h path | Show how much space each directory uses | Open lesson |
free | free -h | Show memory usage | Open lesson |
uname | uname -a | Show OS and kernel information | Open lesson |
ps aux | grep node # find node processes
df -h # disk space in human-readable units
du -h -d 1 . # which directory is eating the space
Services and Scheduled Tasks
| Command | Syntax | What it does | Practice |
|---|---|---|---|
systemctl | sudo systemctl status service | Start, stop, and inspect services (daemons) | Open lesson |
journalctl | journalctl -u service | Read a service's logs | Open lesson |
crontab | crontab -e | Schedule recurring tasks with cron | Open lesson |
sudo systemctl restart nginx # restart nginx
journalctl -u nginx # check nginx logs
crontab -l # list scheduled tasks
Networking
| Command | Syntax | What it does | Practice |
|---|---|---|---|
ping | ping host | Check whether you can reach a server | Open lesson |
curl | curl URL | Send a request to a URL and read the response. The go-to for APIs | Open lesson |
ssh | ssh user@host | Connect securely to a remote server | Open lesson |
ping example.com # reachability check
curl -O https://example.com/data.json # download a file
ssh app@203.0.113.10 # log in to a server
Turning a List into Commands You Can Actually Use
This list covers nearly everything you need for everyday work. But nobody learns commands by staring at a table. Commands are like vocabulary in a foreign language: they stick exactly as fast as you use them.
WebTerm Learn teaches every command on this page in a safe, browser-based environment where you type them for real. There is nothing to install or configure, and any mistake resets in one click.
- Terminal Introduction: your very first steps, from pwd, cd, and ls to file operations
- Terminal Fundamentals: find, grep, pipes, and the tools of daily work
- Terminal Advanced: permissions, processes, and networking, the gateway to server administration
Found a command you want in your fingers? Hit "Open lesson" in the table and type it right now.