- DevOps Lifecycle -Newspaper WordPress Theme
Linux35 Must-Know Linux Commands Every DevOps Engineer Should Master (with Real DevOps...

35 Must-Know Linux Commands Every DevOps Engineer Should Master (with Real DevOps Use Cases)


Introduction

As a DevOps engineer, mastering Linux is non-negotiable. Whether you’re deploying microservices, debugging performance issues, managing cloud infrastructure, or building CI/CD pipelines, Linux commands are at the core of your workflow. This guide walks you through 35 essential Linux commands, each with real-world use cases tailored for DevOps.


🔧 File & Directory Operations

  1. ls – List files and directories.
    • ls -lah shows file sizes and permissions.
  2. cd – Change directories.
    • Navigate efficiently in scripts: cd /var/www/html.
  3. pwd – Print working directory.
    • Useful for debugging scripts.
  4. mkdir – Create directories.
    • Example: mkdir -p /opt/myapp/logs creates nested folders.
  5. touch – Create empty files.
    • Used to create .env or placeholder files in pipelines.
  6. rm – Remove files and directories.
    • Caution: rm -rf /some/path can be destructive. Automate cleanup jobs.
  7. cp – Copy files and directories.
    • Example: cp config.yaml config.yaml.bak before updates.
  8. mv – Move or rename files.
    • Use in deployment steps: mv new.html index.html
  9. find – Search for files.
    • find /var/log -name "*.log" to identify large log files.
  10. du – Estimate file space usage.
    • du -sh * shows space used by directories.

📁 File Viewing & Manipulation

  1. cat – View file contents.
    • Combine with grep for quick searches.
  2. less / more – Page through text.
    • less /var/log/syslog to view logs comfortably.
  3. head / tail – View the start or end of files.
    • tail -f /var/log/nginx/access.log for live logs.
  4. grep – Search text with patterns.
    • Example: grep "ERROR" /var/log/app.log
  5. awk – Pattern scanning and data extraction.
    • Real use: awk -F":" '{ print $1 }' /etc/passwd to list usernames.
  6. sed – Stream editor for modifying files.
    • Replace text in files: sed -i 's/foo/bar/g' config.txt
  7. cut – Extract fields from text.
    • cut -d':' -f1 /etc/passwd
  8. sort – Sort lines in text files.
    • Useful in processing pipeline logs or output.
  9. uniq – Filter out repeated lines.
    • sort data.txt | uniq -c shows duplicates.

🔐 Permissions & Ownership

  1. chmod – Change file permissions.
    • chmod 755 script.sh makes it executable.
  2. chown – Change file owner and group.
    • chown www-data:www-data /var/www/html -R
  3. umask – Set default permissions.
    • Often set in init scripts.
  4. stat – Display detailed file info.
    • Helps in debugging file access issues.

📊 Process & Resource Management

  1. ps – Display current processes.
    • ps aux | grep nginx to locate specific services.
  2. top / htop – Monitor system resource usage.
    • htop is interactive and user-friendly.
  3. kill / killall – Terminate processes.
    • kill -9 <PID> to forcefully stop rogue processes.
  4. nice / renice – Set process priority.
    • Adjust priority for resource-hungry tasks.
  5. lsof – List open files.
    • Debug file locks: lsof | grep deleted
  6. strace – Trace system calls.
    • Debug startup issues: strace ./myapp

🚀 Networking & Troubleshooting

  1. curl – Transfer data to/from a server.
    • Test APIs: curl -X POST -d '{}' https://api.example.com
  2. wget – Non-interactive file download.
    • wget https://downloads.example.com/tool.sh
  3. netstat / ss – Network statistics.
    • ss -tulnp shows listening ports.
  4. tcpdump – Capture network traffic.
    • Debug latency: tcpdump -i eth0 port 80
  5. ping / traceroute – Network connectivity.
    • Identify broken routes or DNS issues.

🔄 Automation & Scripting

  1. xargs – Build and execute commands from input.
    • Bulk operations: cat urls.txt | xargs wget

🔹 Real DevOps Use Case Highlights:

  • Using awk in CI/CD: Extract version info from files and pass it to Docker.
  • lsof to troubleshoot: Find services holding deleted files and causing disk bloat.
  • sed in automation: Replace environment variables during deployment.
  • tail -f in monitoring: View live logs in Kubernetes pods.
  • xargs for batch tasks: Automate bulk log rotation or file downloads.

Conclusion

Mastering these 35 Linux commands will not only boost your productivity but also help you troubleshoot and automate your infrastructure with confidence. Bookmark this list and start integrating these commands into your daily workflow. Want more DevOps content? Follow me on LinkedIn and stay tuned for upcoming posts on Ansible, Docker, Kubernetes, and Terraform!

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Subscribe Today

GET EXCLUSIVE FULL ACCESS TO PREMIUM CONTENT

SUPPORT NONPROFIT JOURNALISM

EXPERT ANALYSIS OF AND EMERGING TRENDS IN CHILD WELFARE AND JUVENILE JUSTICE

TOPICAL VIDEO WEBINARS

Get unlimited access to our EXCLUSIVE Content and our archive of subscriber stories.

Exclusive content

- Advertisement -Newspaper WordPress Theme

Latest article

More article