Linux 101: Top 101 Essential Linux Commands
Every Linux user remembers the first time a single line in a terminal did the work of twenty clicks. This guide collects the 101 commands I think are worth knowing, grouped by what you are trying to do. Each one comes with a plain-English description and an example you can paste straight into a terminal.
You do not need to memorize all 101. Skim the groups, learn the handful you will use this week, and come back when you need the rest. Commands stick when you use them for a real task.
Read this before you start typing. A few commands can destroy data without asking: rm -rf, dd, mkfs, fdisk and chmod -R on the wrong folder. Try new commands in a virtual machine or an empty test folder first, and always read what you are about to run, especially if it came from a forum post.
How to get help for any command
Three habits will make you self-sufficient faster than any list. Run man command for the full manual, command --help for a short summary, and whatis command for a one-liner. Inside man, press / to search and q to quit.
Shell and system basics (13)
The commands that tell you about the machine and the shell you are talking to.
| Command | What it does | Example |
|---|---|---|
echo | Print text or a variable | echo $HOME |
date | Show or format the date and time | date +%F |
history | List the commands you have typed | history | tail |
alias | Create a shortcut for a longer command | alias ll='ls -lah' |
export | Set an environment variable for child processes | export EDITOR=nano |
env | Print all environment variables | env | sort |
man | Open the manual page for a command | man tar |
uname | Show kernel and system information | uname -a |
uptime | Show how long the system has been running, plus load | uptime |
free | Show memory and swap usage | free -h |
systemctl | Start, stop and inspect systemd services | sudo systemctl status ssh |
journalctl | Read the systemd logs | journalctl -u ssh -n 50 |
crontab | Schedule recurring jobs | crontab -e |
Files and navigation (13)
Moving around and managing files is 80% of daily terminal life.
| Command | What it does | Example |
|---|---|---|
pwd | Print the directory you are in | pwd |
ls | List directory contents | ls -lah |
cd | Change directory | cd ~/Documents |
mkdir | Create directories | mkdir -p projects/blog/images |
rmdir | Remove empty directories | rmdir old-folder |
touch | Create an empty file or update its timestamp | touch notes.txt |
cp | Copy files and folders | cp -r photos/ backup/ |
mv | Move or rename | mv draft.txt final.txt |
rm | Delete files (there is no trash can) | rm -i junk.txt |
ln | Create links between files | ln -s /var/log/syslog ~/syslog |
tree | Show a directory as a tree | tree -L 2 |
stat | Show size, permissions and timestamps | stat report.pdf |
file | Identify what kind of file something is | file mystery.bin |
Viewing files (9)
Read files without opening an editor.
| Command | What it does | Example |
|---|---|---|
cat | Print a file to the screen | cat /etc/os-release |
less | Scroll through a file; press q to quit | less /var/log/syslog |
more | A simpler, older pager | more README.md |
head | Show the first lines of a file | head -n 20 access.log |
tail | Show the last lines; -f follows new ones | tail -f /var/log/syslog |
wc | Count lines, words and bytes | wc -l notes.txt |
diff | Compare two files | diff -u old.conf new.conf |
tac | Print a file with the lines reversed | tac log.txt | head |
strings | Pull readable text out of a binary | strings /bin/ls | head |
Searching (7)
Finding files and finding text inside them.
| Command | What it does | Example |
|---|---|---|
find | Search for files by name, size or age | find ~ -name "*.pdf" -mtime -7 |
locate | Fast filename search using an index | locate nginx.conf |
grep | Search inside files with patterns | grep -rn "TODO" src/ |
which | Show which executable will run | which python3 |
whereis | Locate the binary, source and man page | whereis ssh |
type | Tell how the shell interprets a name | type ll |
whatis | Show a one-line description of a command | whatis chmod |
Text processing (9)
Small tools that become powerful when chained with pipes.
| Command | What it does | Example |
|---|---|---|
sort | Sort lines | sort -n scores.txt |
uniq | Collapse or count adjacent duplicate lines | sort names.txt | uniq -c |
cut | Extract columns or fields | cut -d: -f1 /etc/passwd |
tr | Translate or delete characters | echo Hello | tr a-z A-Z |
awk | Scan and report on structured text | awk '{print $1}' access.log |
sed | Stream editor, often used for find and replace | sed -i 's/foo/bar/g' config.txt |
tee | Write output to a file and the screen at once | make 2>&1 | tee build.log |
xargs | Build commands from standard input | find . -name "*.tmp" | xargs rm |
paste | Merge lines of files side by side | paste names.txt emails.txt |
Permissions and users (11)
Who can do what on the system.
| Command | What it does | Example |
|---|---|---|
chmod | Change file permissions | chmod 755 script.sh |
chown | Change file owner | sudo chown alex:alex file.txt |
chgrp | Change file group | chgrp developers project/ |
umask | Set default permissions for new files | umask 022 |
sudo | Run a command as another user, usually root | sudo apt update |
su | Switch to another user | su - alex |
id | Show your user and group IDs | id |
whoami | Print your username | whoami |
groups | List the groups a user belongs to | groups |
passwd | Change a password | passwd |
useradd | Create a new user | sudo useradd -m -s /bin/bash sam |
Processes (10)
See what is running and stop what should not be.
| Command | What it does | Example |
|---|---|---|
ps | Take a snapshot of running processes | ps aux | grep firefox |
top | Live view of processes and load | top |
htop | A friendlier top (usually installed separately) | htop |
kill | Send a signal to a process by PID | kill -15 1234 |
killall | Signal processes by name | killall firefox |
pkill | Signal processes by pattern | pkill -f "python app.py" |
bg | Resume a stopped job in the background | bg %1 |
fg | Bring a job to the foreground | fg %1 |
jobs | List jobs started from this shell | jobs |
nohup | Keep a command running after you log out | nohup ./backup.sh & |
Disks and filesystems (8)
Know what is plugged in and how full it is.
| Command | What it does | Example |
|---|---|---|
df | Show free space per filesystem | df -h |
du | Show space used by files and folders | du -sh * |
lsblk | List disks and partitions | lsblk |
blkid | Show UUIDs and filesystem types | sudo blkid |
mount | Attach a filesystem | sudo mount /dev/sdb1 /mnt |
umount | Detach a filesystem | sudo umount /mnt |
fdisk | Inspect or edit partition tables | sudo fdisk -l |
fsck | Check and repair a filesystem (unmounted only) | sudo fsck /dev/sdb1 |
Archives and compression (6)
Bundle, shrink and unpack.
| Command | What it does | Example |
|---|---|---|
tar | Bundle files into one archive | tar -czf backup.tar.gz project/ |
gzip | Compress a file | gzip logfile |
gunzip | Decompress a .gz file | gunzip logfile.gz |
zip | Create a ZIP archive | zip -r site.zip site/ |
unzip | Extract a ZIP archive | unzip site.zip -d out/ |
xz | Compress harder and slower than gzip | xz -9 big.tar |
Networking (11)
Talk to other machines and find out why you cannot.
| Command | What it does | Example |
|---|---|---|
ping | Test whether a host is reachable | ping -c 4 1.1.1.1 |
curl | Make HTTP requests and transfer data | curl -I https://example.com |
wget | Download files | wget https://example.com/file.iso |
ssh | Log in to a remote machine securely | ssh user@192.168.1.10 |
scp | Copy files over SSH | scp file.txt user@host:~/ |
rsync | Sync files efficiently, locally or remotely | rsync -avh src/ dest/ |
ip | Show and configure network interfaces | ip -br a |
ss | List sockets and listening ports | ss -tulpn |
dig | Look up DNS records | dig example.com +short |
traceroute | Trace the path packets take to a host | traceroute example.com |
nc | Netcat: read and write network connections | nc -zv host 22 |
Package managers (4)
Which one you use depends on your distro family.
| Command | What it does | Example |
|---|---|---|
apt | Debian, Ubuntu and Mint package manager | sudo apt install htop |
dnf | Fedora and RHEL-family package manager | sudo dnf install htop |
pacman | Arch-family package manager | sudo pacman -S htop |
flatpak | Distro-independent app installs | flatpak install flathub org.videolan.VLC |
Five habits that make the terminal easier
- Use Tab completion. Press Tab to finish file and command names. It saves typing and catches typos.
- Use the up arrow and
Ctrl+R. Reverse search finds any earlier command by a few letters. - Chain commands with pipes.
ps aux | grep ssh | wc -lturns three small tools into one answer. - Quote paths with spaces.
cd "My Documents"avoids a lot of confusing errors. - Read before you press Enter. Especially with
sudo. If you do not know what a command does, look it up first.
Where to go next
Once these feel natural, the best next steps are shell scripting (put commands in a .sh file and automate them), regular expressions for sharper grep and sed, and a version-control habit with git. Pick a small real project, such as backing up your documents with rsync on a schedule, and build it with the commands above.