BlogBeast
Linux

Linux 101: Top 101 Essential Linux Commands

By BlogBeast · · 7 min read

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.

CommandWhat it doesExample
echoPrint text or a variableecho $HOME
dateShow or format the date and timedate +%F
historyList the commands you have typedhistory | tail
aliasCreate a shortcut for a longer commandalias ll='ls -lah'
exportSet an environment variable for child processesexport EDITOR=nano
envPrint all environment variablesenv | sort
manOpen the manual page for a commandman tar
unameShow kernel and system informationuname -a
uptimeShow how long the system has been running, plus loaduptime
freeShow memory and swap usagefree -h
systemctlStart, stop and inspect systemd servicessudo systemctl status ssh
journalctlRead the systemd logsjournalctl -u ssh -n 50
crontabSchedule recurring jobscrontab -e

Files and navigation (13)

Moving around and managing files is 80% of daily terminal life.

CommandWhat it doesExample
pwdPrint the directory you are inpwd
lsList directory contentsls -lah
cdChange directorycd ~/Documents
mkdirCreate directoriesmkdir -p projects/blog/images
rmdirRemove empty directoriesrmdir old-folder
touchCreate an empty file or update its timestamptouch notes.txt
cpCopy files and folderscp -r photos/ backup/
mvMove or renamemv draft.txt final.txt
rmDelete files (there is no trash can)rm -i junk.txt
lnCreate links between filesln -s /var/log/syslog ~/syslog
treeShow a directory as a treetree -L 2
statShow size, permissions and timestampsstat report.pdf
fileIdentify what kind of file something isfile mystery.bin

Viewing files (9)

Read files without opening an editor.

CommandWhat it doesExample
catPrint a file to the screencat /etc/os-release
lessScroll through a file; press q to quitless /var/log/syslog
moreA simpler, older pagermore README.md
headShow the first lines of a filehead -n 20 access.log
tailShow the last lines; -f follows new onestail -f /var/log/syslog
wcCount lines, words and byteswc -l notes.txt
diffCompare two filesdiff -u old.conf new.conf
tacPrint a file with the lines reversedtac log.txt | head
stringsPull readable text out of a binarystrings /bin/ls | head

Searching (7)

Finding files and finding text inside them.

CommandWhat it doesExample
findSearch for files by name, size or agefind ~ -name "*.pdf" -mtime -7
locateFast filename search using an indexlocate nginx.conf
grepSearch inside files with patternsgrep -rn "TODO" src/
whichShow which executable will runwhich python3
whereisLocate the binary, source and man pagewhereis ssh
typeTell how the shell interprets a nametype ll
whatisShow a one-line description of a commandwhatis chmod

Text processing (9)

Small tools that become powerful when chained with pipes.

CommandWhat it doesExample
sortSort linessort -n scores.txt
uniqCollapse or count adjacent duplicate linessort names.txt | uniq -c
cutExtract columns or fieldscut -d: -f1 /etc/passwd
trTranslate or delete charactersecho Hello | tr a-z A-Z
awkScan and report on structured textawk '{print $1}' access.log
sedStream editor, often used for find and replacesed -i 's/foo/bar/g' config.txt
teeWrite output to a file and the screen at oncemake 2>&1 | tee build.log
xargsBuild commands from standard inputfind . -name "*.tmp" | xargs rm
pasteMerge lines of files side by sidepaste names.txt emails.txt

Permissions and users (11)

Who can do what on the system.

CommandWhat it doesExample
chmodChange file permissionschmod 755 script.sh
chownChange file ownersudo chown alex:alex file.txt
chgrpChange file groupchgrp developers project/
umaskSet default permissions for new filesumask 022
sudoRun a command as another user, usually rootsudo apt update
suSwitch to another usersu - alex
idShow your user and group IDsid
whoamiPrint your usernamewhoami
groupsList the groups a user belongs togroups
passwdChange a passwordpasswd
useraddCreate a new usersudo useradd -m -s /bin/bash sam

Processes (10)

See what is running and stop what should not be.

CommandWhat it doesExample
psTake a snapshot of running processesps aux | grep firefox
topLive view of processes and loadtop
htopA friendlier top (usually installed separately)htop
killSend a signal to a process by PIDkill -15 1234
killallSignal processes by namekillall firefox
pkillSignal processes by patternpkill -f "python app.py"
bgResume a stopped job in the backgroundbg %1
fgBring a job to the foregroundfg %1
jobsList jobs started from this shelljobs
nohupKeep a command running after you log outnohup ./backup.sh &

Disks and filesystems (8)

Know what is plugged in and how full it is.

CommandWhat it doesExample
dfShow free space per filesystemdf -h
duShow space used by files and foldersdu -sh *
lsblkList disks and partitionslsblk
blkidShow UUIDs and filesystem typessudo blkid
mountAttach a filesystemsudo mount /dev/sdb1 /mnt
umountDetach a filesystemsudo umount /mnt
fdiskInspect or edit partition tablessudo fdisk -l
fsckCheck and repair a filesystem (unmounted only)sudo fsck /dev/sdb1

Archives and compression (6)

Bundle, shrink and unpack.

CommandWhat it doesExample
tarBundle files into one archivetar -czf backup.tar.gz project/
gzipCompress a filegzip logfile
gunzipDecompress a .gz filegunzip logfile.gz
zipCreate a ZIP archivezip -r site.zip site/
unzipExtract a ZIP archiveunzip site.zip -d out/
xzCompress harder and slower than gzipxz -9 big.tar

Networking (11)

Talk to other machines and find out why you cannot.

CommandWhat it doesExample
pingTest whether a host is reachableping -c 4 1.1.1.1
curlMake HTTP requests and transfer datacurl -I https://example.com
wgetDownload fileswget https://example.com/file.iso
sshLog in to a remote machine securelyssh user@192.168.1.10
scpCopy files over SSHscp file.txt user@host:~/
rsyncSync files efficiently, locally or remotelyrsync -avh src/ dest/
ipShow and configure network interfacesip -br a
ssList sockets and listening portsss -tulpn
digLook up DNS recordsdig example.com +short
tracerouteTrace the path packets take to a hosttraceroute example.com
ncNetcat: read and write network connectionsnc -zv host 22

Package managers (4)

Which one you use depends on your distro family.

CommandWhat it doesExample
aptDebian, Ubuntu and Mint package managersudo apt install htop
dnfFedora and RHEL-family package managersudo dnf install htop
pacmanArch-family package managersudo pacman -S htop
flatpakDistro-independent app installsflatpak install flathub org.videolan.VLC

Five habits that make the terminal easier

  1. Use Tab completion. Press Tab to finish file and command names. It saves typing and catches typos.
  2. Use the up arrow and Ctrl+R. Reverse search finds any earlier command by a few letters.
  3. Chain commands with pipes. ps aux | grep ssh | wc -l turns three small tools into one answer.
  4. Quote paths with spaces. cd "My Documents" avoids a lot of confusing errors.
  5. 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.