Linux10 min read·

Linux Commands Cheat Sheet: 50 Essential Commands You Need to Know

Master the 50 most important Linux commands with examples. From file navigation to process management — the commands every Linux user needs.

File Operations

CommandDescriptionExample
lsList directory contentsls -la
cdChange directorycd /var/log
pwdPrint working directorypwd
cpCopy filescp file.txt /backup/
mvMove/rename filesmv old.txt new.txt
rmRemove filesrm -rf /tmp/cache/
mkdirCreate directorymkdir -p a/b/c
findSearch for filesfind / -name "*.log"
locateQuick file searchlocate nginx.conf
touchCreate empty filetouch file.txt

Text Processing

CommandDescriptionExample
catDisplay file contentscat /etc/hosts
lessPaginate file outputless /var/log/syslog
headShow first lineshead -n 20 file.txt
tailShow last linestail -f /var/log/app.log
grepSearch text patternsgrep -i "error" log.txt
awkText processingawk '{print $1}' file
sedStream editorsed 's/old/new/g' file
wcCount lines/wordswc -l file.txt
sortSort linessort -u file.txt
uniqRemove duplicates`sort file

Permissions & Ownership

CommandDescriptionExample
chmodChange permissionschmod 755 script.sh
chownChange ownerchown user:group file
sudoRun as superusersudo apt update
suSwitch usersu - root

Process Management

CommandDescriptionExample
psList processes`ps aux
topProcess monitortop
htopInteractive monitorhtop
killTerminate processkill -9 1234
bgResume in backgroundbg %1
fgBring to foregroundfg %1
nohupRun after logoutnohup ./script.sh &
systemctlManage servicessystemctl status nginx

Networking

CommandDescriptionExample
ipNetwork configurationip addr show
ssSocket statisticsss -tlnp
curlHTTP requestscurl -I https://example.com
wgetDownload fileswget https://example.com/file.zip
pingTest connectivityping google.com
tracerouteTrace packet pathtraceroute google.com
nmapNetwork scannernmap -sV 192.168.1.0/24
sshRemote loginssh user@192.168.1.10

System Information

CommandDescriptionExample
dfDisk usagedf -h
duDirectory sizedu -sh /var
freeMemory usagefree -m
unameSystem infouname -a
uptimeSystem uptimeuptime
journalctlView logsjournalctl -u nginx

Package Management

CommandDescriptionExample
aptDebian/Ubuntu packagessudo apt install nginx
yumCentOS/RHEL packagesyum install httpd
dnfModern Fedora packagesdnf install git
snapSnap packagessnap install code --classic

Master these 50 commands and you'll handle 95% of daily Linux tasks. Practice them in a real terminal — repetition builds muscle memory.

Ready to practice?

Apply what you learned with free hands-on labs on XpertClass. Deploy real Docker sandboxes — no setup required.