DEV Community

Cover image for A Glimpse into Essential Linux Commands for DevOps & Cloud Computing
Muhammad Hanzala
Muhammad Hanzala

Posted on

A Glimpse into Essential Linux Commands for DevOps & Cloud Computing

Linux is the backbone of modern DevOps and cloud computing, playing a crucial role in infrastructure management, automation, and container orchestration. Whether you're working with AWS, Azure, or Google Cloud, having a strong command of Linux is essential for managing virtual machines, optimizing performance, and automating workflows. Here's a list of must-know commands tailored for DevOps and cloud engineers.

1. System Monitoring & Performance Tuning

Monitoring system performance is critical for identifying issues and ensuring smooth cloud operations.

  • Interactive process viewer:
htop 
Enter fullscreen mode Exit fullscreen mode
  • Real-time system monitoring:
top 
Enter fullscreen mode Exit fullscreen mode
  • Check memory usage:
free -m 
Enter fullscreen mode Exit fullscreen mode
  • Monitor disk I/O performance:
iostat -x 1 
Enter fullscreen mode Exit fullscreen mode
  • Check disk usage:
df -h 
Enter fullscreen mode Exit fullscreen mode

2. User & Permission Management

Securing cloud instances requires proper user and permission management.

  • Add a new user:
useradd -m username passwd username 
Enter fullscreen mode Exit fullscreen mode
  • Modify user permissions:
usermod -aG sudo username 
Enter fullscreen mode Exit fullscreen mode
  • Change file ownership:
chown user:group filename 
Enter fullscreen mode Exit fullscreen mode
  • Modify file permissions:
chmod 755 filename 
Enter fullscreen mode Exit fullscreen mode

3. Process & Service Management

Managing services and processes is crucial for cloud uptime and performance.

  • List running processes:
ps aux 
Enter fullscreen mode Exit fullscreen mode
  • Kill a process by ID:
kill -9 PID 
Enter fullscreen mode Exit fullscreen mode
  • Check open ports and active connections:
netstat -tulnp netstat -tulnp | grep -i <port num> 
Enter fullscreen mode Exit fullscreen mode
  • Start, stop, and check service status:
systemctl start service_name systemctl stop service_name systemctl status service_name 
Enter fullscreen mode Exit fullscreen mode

4. Networking Commands

Networking is fundamental for managing cloud-based and distributed environments.

  • Check IP configuration:
ip a 
Enter fullscreen mode Exit fullscreen mode

Test network connectivity:

ping google.com ping 1.1.1.1 ping 8.8.8.8 ping <ip > 
Enter fullscreen mode Exit fullscreen mode
  • Trace network routes:
traceroute google.com 
Enter fullscreen mode Exit fullscreen mode
  • Check firewall rules:
iptables -L 
Enter fullscreen mode Exit fullscreen mode

5. Cloud Storage & File Management

Efficient file management ensures seamless cloud storage operations.

  • List files in a directory:
ls -lah 
Enter fullscreen mode Exit fullscreen mode
  • Find files by name:
find /path/to/search -name filename 
Enter fullscreen mode Exit fullscreen mode
  • Copy, move, and delete files:
#COPY : cp source destination #MOVE : mv source destination #REMOVE : rm filename 
Enter fullscreen mode Exit fullscreen mode
  • Extract compressed files:
tar -xvf archive.tar.gz 
Enter fullscreen mode Exit fullscreen mode
  • Mount cloud storage (AWS S3 example):
s3fs mybucket /mnt/mountpoint -o iam_role=myrole 
Enter fullscreen mode Exit fullscreen mode

6. Automation & Scheduling

Automating cloud tasks improves efficiency and reduces manual overhead.

  • Schedule a cron job:
crontab -e 
Enter fullscreen mode Exit fullscreen mode
  • Run a command at system startup:
0 0 * * * /path/to/backup.sh 
Enter fullscreen mode Exit fullscreen mode
  • Automate cloud deployments (Ansible example):
ansible-playbook deploy.yml 
Enter fullscreen mode Exit fullscreen mode

7. Logging & Debugging

Monitoring logs helps detect and resolve issues in cloud environments.

  • View system logs:
journalctl -xe 
Enter fullscreen mode Exit fullscreen mode
  • Check authentication logs:
journalctl -xecat /var/log/auth.log 
Enter fullscreen mode Exit fullscreen mode
  • Monitor logs in real-time:
tail -f /var/log/syslog 
Enter fullscreen mode Exit fullscreen mode
  • Check AWS CloudWatch logs:
aws logs describe-log-groups 
Enter fullscreen mode Exit fullscreen mode

Conclusion

Mastering these Linux commands is essential for DevOps and cloud engineers looking to optimize infrastructure, troubleshoot issues, and automate cloud operations. What are your must-know Linux commands for cloud computing? Let's discuss in the comments! 🚀

Top comments (0)