Skip to main content

Top 200 Linux Commands for DevOps

 

Top 200 Linux Commands for DevOps: The Complete Reference Guide

📅 Published: June 2026
⏱️ Estimated Reading Time: 30 minutes
🏷️ Tags: Linux Commands, DevOps, Command Line, System Administration, Shell Scripting


Introduction: Why These Commands Matter

Linux is the operating system of the cloud. Over 90% of servers run Linux. Every DevOps engineer must be comfortable at the command line. You don't need to memorize every command, but you need to know what's possible and how to find what you need.

This guide organizes 200 essential Linux commands by category. Each command includes a practical example showing exactly how to use it.


Part 1: File System Navigation (15 commands)

CommandPurposeExample
pwdPrint working directorypwd/home/user
lsList files and directoriesls -la (detailed list)
cdChange directorycd /var/log
treeDisplay directory treetree -L 2 (2 levels deep)
mkdirCreate directorymkdir -p dir1/dir2 (create parents)
rmdirRemove empty directoryrmdir emptydir
touchCreate empty file or update timestamptouch newfile.txt
rmRemove files or directoriesrm -rf dir (force recursive)
cpCopy files or directoriescp -r source dest
mvMove or rename filesmv old.txt new.txt
lnCreate linksln -s target link (symbolic)
statDisplay file statusstat filename
fileDetermine file typefile script.sh
duDisk usagedu -sh * (human readable)
dfDisk free spacedf -h (human readable)

Part 2: File Viewing and Editing (15 commands)

CommandPurposeExample
catConcatenate and display filescat file.txt
lessView file page by pageless largefile.log
moreView file one screen at a timemore file.txt
headDisplay first lineshead -20 file.txt
tailDisplay last linestail -f app.log (follow)
tacDisplay file in reversetac file.txt
nlNumber linesnl file.txt
wcWord countwc -l file.txt (lines only)
grepSearch for patternsgrep -r "error" /var/log/
egrepExtended grepegrep "error|fail" log
fgrepFixed string grepfgrep "exact string" file
sedStream editorsed 's/old/new/g' file.txt
awkText processingawk '{print $1}' file.txt
sortSort linessort -rn file.txt (reverse numeric)
uniqRemove duplicate linessort file.txt | uniq -c

Part 3: File Permissions and Ownership (10 commands)

CommandPurposeExample
chmodChange file permissionschmod 755 script.sh
chownChange file ownerchown user:group file.txt
chgrpChange group ownershipchgrp developers file.txt
umaskSet default permissionsumask 022
lsattrList file attributeslsattr file.txt
chattrChange file attributeschattr +i file.txt (immutable)
getfaclGet file ACLgetfacl file.txt
setfaclSet file ACLsetfacl -m u:user:rw file.txt
sudoExecute as superusersudo systemctl restart nginx
suSwitch usersu - username

Part 4: Process Management (15 commands)

CommandPurposeExample
psProcess statusps aux (all users, detailed)
topDynamic process viewtop then M (sort by memory)
htopInteractive process viewerhtop (install if needed)
pgrepFind processes by namepgrep -l nginx
pidofFind PID of processpidof nginx
killTerminate processkill -9 PID (force)
pkillKill by namepkill -f "python app.py"
killallKill all processes by namekillall nginx
niceSet process prioritynice -n 19 slowjob
reniceChange process priorityrenice -n 10 -p 12345
nohupRun immune to hangupsnohup longjob &
bgSend to backgroundbg %1
fgBring to foregroundfg %1
jobsList background jobsjobs -l
waitWait for process to finishwait PID

Part 5: System Information (15 commands)

CommandPurposeExample
unameSystem informationuname -a (all)
hostnameShow/set hostnamehostname
whoamiCurrent userwhoami
idUser identityid
uptimeSystem uptime and loaduptime
wWho is logged inw
whoWho is logged inwho -a
lastLast loginslast -10
lastlogLast login per userlastlog
dmesgKernel messagesdmesg | tail -20
freeMemory usagefree -h
vmstatVirtual memory statsvmstat 2 5 (2 sec, 5 times)
iostatI/O statisticsiostat -x 1
lscpuCPU informationlscpu
lsblkBlock deviceslsblk

Part 6: Network Commands (20 commands)

CommandPurposeExample
ipShow/manage network interfacesip addr show
ifconfigConfigure network interfacesifconfig eth0 (legacy)
pingTest connectivityping -c 4 google.com
tracerouteTrace network pathtraceroute google.com
tracepathTrace path with MTU discoverytracepath google.com
mtrMy traceroute (ping + traceroute)mtr google.com
netstatNetwork statisticsnetstat -tulpn
ssSocket statisticsss -tulpn (modern netstat)
nmapNetwork scannernmap -p 80 192.168.1.1
ncNetcat (network tool)nc -zv google.com 80
telnetTest port connectivitytelnet google.com 80
curlTransfer datacurl -I https://example.com
wgetDownload fileswget https://example.com/file.zip
digDNS lookupdig google.com
nslookupDNS querynslookup google.com
hostDNS lookuphost google.com
arpARP cachearp -a
routeRouting tableroute -n
iptablesFirewall rulesiptables -L -n
ufwUncomplicated firewallufw status

Part 7: Package Management (15 commands)

Debian/Ubuntu (APT)

CommandPurposeExample
apt updateUpdate package listsudo apt update
apt upgradeUpgrade packagessudo apt upgrade -y
apt installInstall packagesudo apt install nginx
apt removeRemove packagesudo apt remove nginx
apt purgeRemove with configsudo apt purge nginx
apt searchSearch packagesapt search nginx
apt showShow package infoapt show nginx
apt listList installedapt list --installed
apt autoremoveRemove unusedsudo apt autoremove
dpkgPackage managerdpkg -l | grep nginx

Red Hat/CentOS (YUM/DNF)

CommandPurposeExample
yum updateUpdate packagessudo yum update
yum installInstall packagesudo yum install nginx
yum removeRemove packagesudo yum remove nginx
yum searchSearch packagesyum search nginx
yum infoPackage infoyum info nginx
dnfModern yumsudo dnf install nginx
rpmRPM package managerrpm -qa | grep nginx

Part 8: Compression and Archiving (10 commands)

CommandPurposeExample
tarArchive filestar -czf archive.tar.gz dir/
gzipCompress filesgzip file.txt
gunzipDecompress filesgunzip file.txt.gz
zipPackage and compresszip archive.zip file1 file2
unzipExtract zip filesunzip archive.zip
bzip2Compress (better ratio)bzip2 file.txt
bunzip2Decompress bzip2bunzip2 file.txt.bz2
xzCompress (high ratio)xz file.txt
unxzDecompress xzunxz file.txt.xz
zcatDisplay compressed filezcat file.gz

Part 9: Text Processing (20 commands)

CommandPurposeExample
cutExtract columnscut -d',' -f1,3 file.csv
pasteMerge linespaste file1 file2
trTranslate characterstr 'a-z' 'A-Z' < file.txt
sortSort linessort -k2 -n data.txt
uniqUnique linessort file | uniq -d (duplicates)
commCompare filescomm file1 file2
diffCompare files line by linediff -u file1 file2
cmpCompare files byte by bytecmp file1 file2
patchApply diff filepatch < file.patch
joinJoin lines from two filesjoin file1 file2
splitSplit file into piecessplit -l 1000 large.log
csplitSplit based on patterncsplit file '/pattern/'
expandConvert tabs to spacesexpand -t 4 file.txt
unexpandConvert spaces to tabsunexpand -t 4 file.txt
prFormat for printingpr -l 60 file.txt
fmtFormat text paragraphsfmt -w 80 file.txt
foldWrap linesfold -w 80 file.txt
revReverse linesrev file.txt
shufShuffle linesshuf file.txt
seqGenerate sequencesseq 1 10

Part 10: Finding and Searching (10 commands)

CommandPurposeExample
findFind filesfind /home -name "*.txt"
locateFind by databaselocate nginx.conf
updatedbUpdate locate DBsudo updatedb
whichLocate commandwhich nginx
whereisLocate binary/source/manwhereis nginx
typeCommand typetype ls
whatisOne-line descriptionwhatis ls
aproposSearch man pagesapropos "copy file"
grepSearch file contentgrep -r "TODO" --include="*.py"
ackBetter grep for codeack "function" (install)

Part 11: Environment and Shell (10 commands)

CommandPurposeExample
envShow environment variablesenv
exportSet environment variableexport PATH=$PATH:/usr/local/bin
unsetRemove variableunset TEMP_VAR
echoPrint to stdoutecho $PATH
printenvPrint environmentprintenv HOME
aliasCreate command aliasalias ll='ls -la'
unaliasRemove aliasunalias ll
sourceExecute file in current shellsource ~/.bashrc
.Same as source. ~/.bashrc
historyCommand historyhistory | grep ssh

Part 12: User Management (10 commands)

CommandPurposeExample
useraddCreate usersudo useradd -m username
usermodModify usersudo usermod -aG sudo username
userdelDelete usersudo userdel -r username
passwdChange passwordpasswd (self) or sudo passwd user
groupaddCreate groupsudo groupadd developers
groupmodModify groupsudo groupmod -n newname oldname
groupdelDelete groupsudo groupdel groupname
groupsShow user groupsgroups username
idShow user identityid username
whoWho is logged inwho -a

Part 13: SSH and Remote Access (10 commands)

CommandPurposeExample
sshSecure shellssh user@hostname
ssh-keygenGenerate SSH keysssh-keygen -t rsa -b 4096
ssh-copy-idCopy public keyssh-copy-id user@host
scpSecure copyscp file.txt user@host:/path/
rsyncRemote syncrsync -avz /local/ user@host:/remote/
sftpSecure FTPsftp user@host
ssh-agentSSH key managereval $(ssh-agent)
ssh-addAdd key to agentssh-add ~/.ssh/id_rsa
ssh-keyscanGet host public keyssh-keyscan hostname
screenTerminal multiplexerscreen -S session

Part 14: System Administration (20 commands)

CommandPurposeExample
systemctlSystemd service managersystemctl status nginx
journalctlSystemd logsjournalctl -u nginx -f
serviceService managementservice nginx restart (legacy)
crontabSchedule jobscrontab -e
atOne-time scheduled jobecho "backup.sh" | at 2am
systemd-analyzeBoot performancesystemd-analyze blame
timedatectlTime and datetimedatectl set-timezone UTC
dateShow/Set datedate "+%Y-%m-%d"
calCalendarcal 2026
sleepDelay executionsleep 5 && echo "done"
watchExecute periodicallywatch -n 1 "df -h"
timeMeasure execution timetime ./script.sh
xargsBuild command linesfind . -name "*.log" | xargs rm
teeRedirect to file and stdoutecho "text" | tee file.txt
scriptRecord terminal sessionscript session.log
screenTerminal multiplexerscreen
tmuxTerminal multiplexertmux new -s mysession
loggerLog message to sysloglogger "Backup completed"
wallSend message to all userswall "System will reboot"
shutdownShutdown systemsudo shutdown -h now

Part 15: Disk and Filesystem (10 commands)

CommandPurposeExample
fdiskPartition table manipulatorsudo fdisk -l
lsblkList block deviceslsblk
blkidBlock device attributessudo blkid
mountMount filesystemmount /dev/sdb1 /mnt
umountUnmount filesystemumount /mnt
fsckFilesystem checksudo fsck /dev/sda1
mkfsCreate filesystemsudo mkfs.ext4 /dev/sdb1
ddConvert and copydd if=/dev/sda of=backup.img
badblocksCheck for bad blockssudo badblocks -v /dev/sda
smartctlSMART disk healthsudo smartctl -a /dev/sda

Part 16: Security Commands (10 commands)

CommandPurposeExample
opensslCryptography toolkitopenssl genrsa -out key.pem 2048
gpgGNU Privacy Guardgpg -c secret.txt (encrypt)
md5sumMD5 checksummd5sum file.txt
sha256sumSHA256 checksumsha256sum file.txt
chmodChange permissionschmod 600 ~/.ssh/id_rsa
chownChange ownershipchown user:group file
umaskDefault permissionsumask 027
fail2ban-clientFail2ban managerfail2ban-client status sshd
auditctlAudit system callsauditctl -l
selinuxSELinux commandsgetenforce

Part 17: Networking Advanced (5 commands)

CommandPurposeExample
tcpdumpPacket capturesudo tcpdump -i eth0 port 80
tcpflowTCP session capturetcpflow -i eth0 port 80
nethogsPer-process networksudo nethogs
iftopBandwidth usagesudo iftop
iptrafNetwork statisticssudo iptraf-ng

Part 18: Performance Monitoring (5 commands)

CommandPurposeExample
sarSystem activity reportersar -u 1 3 (CPU every 1 sec)
mpstatCPU statisticsmpstat -P ALL 1
pidstatProcess statisticspidstat 1
perfLinux profilingperf top
straceTrace system callsstrace -p PID

Quick Reference: Most Important Commands

If you remember only 20 commands, make them these:

bash
# Navigation
ls -la          # List everything
cd /path        # Change directory
pwd             # Where am I?

# File operations
cat file        # View file
less file       # Page through file
tail -f log     # Follow log
grep pattern    # Search
cp -r src dst   # Copy
mv old new      # Move/rename
rm -rf dir      # Delete (careful!)

# Processes
ps aux          # See running processes
top             # Real-time processes
kill -9 PID     # Force kill

# Network
ping host       # Test connectivity
curl URL        # Test web endpoint
ss -tulpn       # See listening ports

# System
df -h           # Disk space
free -h         | Memory usage
uptime          # Load average

# Permissions
chmod 755 file  # Change permissions
sudo command    # Run as root

# Package management
apt update      # Update package list (Debian)
apt install pkg # Install package (Debian)
yum install pkg # Install package (RHEL)

# Help
man command     # Read manual
command --help  # Quick help

How to Remember Commands

Use man – The manual is your friend

bash
man ls

Use history – See what you've run before

bash
history | grep nginx

Use alias – Create shortcuts

bash
alias ll='ls -la'
alias gs='git status'

Use tldr – Simplified man pages (install first)

bash
tldr tar

Learn More

Practice Linux commands with hands-on exercises in our interactive labs:
https://devops.trainwithsky.com/

Comments

Popular posts from this blog

📊 Monitoring & Logging in Kubernetes – Tools like Prometheus, Grafana, and Fluentd

  Monitoring & Logging in Kubernetes – Tools like Prometheus, Grafana, and Fluentd Monitoring and logging are essential for maintaining a healthy and well-performing Kubernetes cluster. In this guide, we’ll cover why monitoring is important, key monitoring tools like Prometheus and Grafana, and logging tools like Fluentd to help you gain visibility into your cluster’s performance and logs. Shape Your Future with AI & Infinite Knowledge...!! Want to Generate Text-to-Voice, Images & Videos? http://www.ai.skyinfinitetech.com Read In-Depth Tech & Self-Improvement Blogs http://www.skyinfinitetech.com Watch Life-Changing Videos on YouTube https://www.youtube.com/@SkyInfinite-Learning Transform Your Skills, Business & Productivity – Join Us Today! 🚀 Introduction In today’s fast-paced cloud-native environment, Kubernetes has emerged as the de-facto container orchestration platform. But deploying and managing applications in Kubernetes is just half the ba...

How to Use SKY TTS: The Complete, Step-by-Step Guide for 2025

 What is SKY TTS? SKY TTS  is a free, next-generation  AI audio creation platform  that brings together high-quality  Text-to-Speech ,  Speech-to-Text , and a full suite of professional  audio editing tools  in one seamless experience. Our vision is simple — to make advanced audio technology  free, accessible, and effortless  for everyone. From creators and educators to podcasters, developers, and businesses, SKY TTS helps users produce  studio-grade voice content  without expensive software or technical skills. With support for  70+ languages, natural voices, audio enhancement, waveform generation, and batch automation , SKY TTS has become a trusted all-in-one toolkit for modern digital audio workflows. Why Choose SKY TTS? Instant Conversion:  Enjoy rapid text-to-speech generation, even with large documents. Advanced Voice Settings:   Adjust speed, pitch, and style for a personalized listening experience. Multi-...

Introduction to Terraform – The Future of Infrastructure as Code

  Introduction to Terraform – The Future of Infrastructure as Code In today’s fast-paced DevOps world, managing infrastructure manually is outdated . This is where Terraform comes in—a powerful Infrastructure as Code (IaC) tool that allows you to define, provision, and manage cloud infrastructure efficiently . Whether you're working with AWS, Azure, Google Cloud, or on-premises servers , Terraform provides a declarative, automation-first approach to infrastructure deployment. Shape Your Future with AI & Infinite Knowledge...!! Read In-Depth Tech & Self-Improvement Blogs http://www.skyinfinitetech.com Watch Life-Changing Videos on YouTube https://www.youtube.com/@SkyInfinite-Learning Transform Your Skills, Business & Productivity – Join Us Today! In today’s digital-first world, agility and automation are no longer optional—they’re essential. Companies across the globe are rapidly shifting their operations to the cloud to keep up with the pace of innovatio...