Over 90% of cloud infrastructure on Amazon Web Services (AWS), Google Cloud, and Microsoft Azure runs on Linux (Ubuntu, Amazon Linux 2023, RHEL, CentOS, Debian). For DevOps engineers, Site Reliability Engineers (SREs), and Cloud Administrators, fluent command-line interface (CLI) skills are essential to manage infrastructure, debug application failures, and automate CI/CD deployments.
1. System Information & Resource Monitoring Commands
When an AWS EC2 server experiences high latency or crashes, these commands help inspect CPU, RAM, and disk utilization instantly:
| Command | Description & Usage | DevOps Use Case |
|---|---|---|
top / htop |
Interactive real-time process viewer and system resource monitor. | Identify runaway processes consuming 100% CPU or RAM. |
free -h |
Displays total, used, and available RAM memory in human-readable format (MB/GB). | Diagnose Out-Of-Memory (OOM) killer application crashes. |
df -h |
Displays file system disk space usage across mounted storage partitions. | Check if root volume (/) is 100% full. |
du -sh * |
Shows total disk space consumed by directories in current folder. | Find ballooning log files or Docker cache taking up space. |
uptime |
Shows how long system has been running + 1, 5, and 15 minute load averages. | Check CPU load spikes on EC2 instances. |
uname -r / lscpu |
Displays Linux kernel version and CPU architecture info. | Verify x86_64 vs ARM64 (AWS Graviton) CPU setup. |
free -h
df -h
# Find top 5 largest directories in /var/log/
du -sh /var/log/* | sort -rh | head -n 5
2. File & Directory Operations
| Command | Example | Purpose |
|---|---|---|
ls -la |
ls -lah /var/www/ |
List all files including hidden files (.env) with sizes & permissions. |
mkdir -p |
mkdir -p /var/www/app/logs |
Create parent directories recursively without throwing errors if existing. |
find |
find /var/log -name "*.log" -mtime -1 |
Find all .log files modified in the last 24 hours. |
3. Text Processing & Log Inspection (`grep`, `awk`, `sed`, `tail`)
DevOps engineers spend hours debugging production application log files. Mastering log filter tools is crucial:
Log Inspection Examples:
1. Live Log Streaming (`tail -f`)
tail -f /var/log/nginx/access.log
# Follow last 100 lines of application error log
tail -n 100 -f /var/log/syslog
2. Pattern Search (`grep`)
grep -rnI "ERROR" /var/log/app/
# Filter out 200 OK responses to see failed status codes
grep -v "HTTP/1.1 200" /var/log/nginx/access.log
3. Column Filtering (`awk`) & Text Manipulation (`sed`)
awk '{print $1}' /var/log/nginx/access.log | sort | uniq -c | sort -nr | head -n 10
# Replace "staging.api.com" with "prod.api.com" in config file inline
sed -i 's/staging.api.com/prod.api.com/g' config.env
4. File Permissions & Security (`chmod`, `chown`, `sudo`)
Security misconfigurations are a leading cause of SSH login failures and vulnerability exploits in AWS.
| Command | Syntax / Example | DevOps Use Case |
|---|---|---|
chmod 400 |
chmod 400 my-key.pem |
Mandatory AWS step: Restrict AWS EC2 SSH key permissions so only owner can read it. |
chmod 755 |
chmod 755 script.sh |
Make shell deployment scripts executable (Read/Write/Execute for owner, Read/Execute for group/others). |
chown -R |
chown -R www-data:www-data /var/www/html |
Change file owner user and group recursively for web servers. |
5. Network Troubleshooting & Connectivity Commands
When microservices cannot talk to each other or an EC2 instance cannot connect to an RDS database, use these diagnostic tools:
curl -Iv https://api.teluguittutorials.com/health
# Check all open TCP/UDP listening ports and active process names
ss -tulpn
netstat -tulpn
# Check DNS resolution for domain
dig teluguittutorials.com +short
nslookup db.internal.vpc
# Test port connectivity to remote DB (e.g. AWS RDS port 5432)
nc -zv database.rds.amazonaws.com 5432
6. Process & Service Management (`systemctl`, `journalctl`, `ps`, `kill`)
In modern Linux distributions (Ubuntu, Debian, RHEL, Amazon Linux), system services are managed via systemd.
sudo systemctl status nginx
sudo systemctl restart docker
sudo systemctl enable nginx # Auto-start service on boot
# View systemd service logs using journalctl
sudo journalctl -u docker.service --since "1 hour ago" -f
# Find process ID (PID) and terminate unresponsive process
ps aux | grep node
sudo kill -9 <PID>
7. Secure Remote Connection & File Transfer (SSH, SCP, Rsync)
ssh -i /path/to/my-key.pem ubuntu@ec2-54-210-10-20.compute-1.amazonaws.com
# Copy local build artifact to remote EC2 server
scp -i my-key.pem build.tar.gz ubuntu@54.210.10.20:/var/www/
# Sync directory efficiently showing progress bar
rsync -avz -e "ssh -i my-key.pem" ./dist/ ubuntu@54.210.10.20:/var/www/html/
8. Storage & Archive Commands (`tar`, `zip`, `lsblk`)
tar -czvf app_backup.tar.gz /var/www/app/
# Extract tar.gz archive
tar -xzvf app_backup.tar.gz -C /opt/
# View AWS EBS block storage volumes attached to EC2
lsblk
Master Linux, DevOps & AWS in Telugu!
Want hands-on training in Linux server administration, AWS cloud infrastructure, Docker, Kubernetes, and Terraform? Join our upcoming live batch at Telugu IT Tutorials. View Courses & Enroll →