Skip to main content

Linux Commands Reference

Ask in plain English. Like "how to create user" or "check disk space".

...

Essential Linux Commands for DevOps

Linux command-line proficiency is the foundation of DevOps, SRE, and cloud engineering. Whether you are SSH-ing into production servers, writing shell scripts for automation, debugging containerized applications, or managing Kubernetes nodes, the Linux CLI is your primary interface for system interaction.

This reference covers the commands DevOps engineers use most frequently in real production environments, organized by task rather than alphabetically.

File Management Commands

CommandWhat It DoesProduction Example
ls -laList all files with permissions and hidden filesls -la /etc/nginx/sites-enabled/
findSearch for files with complex filtersfind /var/log -name '*.log' -mtime +30 -delete
cp -rCopy files and directories recursivelycp -r /app/config /app/config.bak
chmodChange file permissionschmod 600 ~/.ssh/id_rsa
tar -czfCreate compressed archivetar -czf backup.tar.gz --exclude='.git' /app/
tail -fFollow file output in real-timetail -f /var/log/app/error.log | grep Exception

Process Management Commands

CommandWhat It DoesProduction Example
ps auxShow all running processes with resource usageps aux --sort=-%mem | head -15
top -bn1One-shot system resource snapshottop -bn1 -o %MEM | head -15
kill -9Force terminate a processkill -9 $(lsof -t -i:8080)
lsof -iList processes using network portslsof -i :443 -sTCP:LISTEN
systemctlManage system servicessystemctl restart nginx && systemctl status nginx

Network Troubleshooting Commands

CommandWhat It DoesProduction Example
curl -IFetch HTTP headers from a URLcurl -sI https://api.example.com/health
ss -tlnpShow listening TCP ports with process namesss -tlnp | grep :443
digDNS lookup and resolution testingdig +short A api.example.com @8.8.8.8
tracerouteTrace packet path to destinationtraceroute -n api.example.com
tcpdumpCapture and analyze network packetstcpdump -i eth0 port 443 -c 100

Disk and Storage Commands

CommandWhat It DoesProduction Example
df -hTShow disk usage with filesystem typedf -hT | grep -v tmpfs
du -shShow directory size summarydu -sh /var/lib/docker/* | sort -rh | head
df -iCheck inode usagedf -i / | awk 'NR==2'
mountShow mounted filesystemsmount | grep -E '^/dev' | column -t

Frequently Asked Questions

What are the most used Linux commands for DevOps engineers?

The most essential Linux commands for DevOps include: ls (list files), grep (search text), find (locate files), ps and top (monitor processes), df and du (check disk usage), curl and ss (network diagnostics), chmod and chown (permissions), systemctl (service management), tail -f (log monitoring), and tar (archiving). These commands form the daily toolkit for server administration, troubleshooting, and automation.

How do you check disk space in Linux?

Use df -hT to see filesystem usage in human-readable format with filesystem type. To find which directories consume the most space, use du -sh /* | sort -rh | head -20. For Docker-specific disk usage, check docker system df. If disk shows full but files were deleted, run lsof +D /partition | grep deleted to find processes holding the space.

How to find which process is using a specific port in Linux?

Run lsof -i :8080 or ss -tlnp | grep 8080 to identify which process is bound to port 8080. To kill the process occupying the port, use kill -9 $(lsof -t -i:8080). The ss command is faster than netstat on modern Linux systems and shows both listening and established connections.

How to monitor Linux server performance in real-time?

Use top or htop for real-time CPU and memory monitoring. For a one-shot snapshot suitable for scripting, use top -bn1 | head -20. Monitor disk I/O with iostat -x 1, network throughput with iftop, and system load with uptime. Combine these for production incident investigation.

How to search for text inside files recursively in Linux?

Use grep -rn 'ERROR' /var/log/ to recursively search for "ERROR" in all files under /var/log with line numbers. For faster searching in large codebases, use grep -rn --include='*.log' 'pattern' /path/ to limit by file extension. The -C 3 flag shows 3 lines of context around each match for better debugging.