1. Introduction
In this post, I'll walk you through must-know Linux commands for both cloud beginners and advanced cloud engineers β with real-world use cases.
2. Basic Linux Commands for Cloud Beginners
These are the foundational commands used in almost every cloud instance:
πΉ Navigation & File Management
-
cd /var/logβ Navigate to log directory -
ls -lβ List files in long format -
pwdβ Print working directory -
mkdir /dataβ Create new directory -
cp file.txt /data/β Copy file -
mv file.txt /data/β Move file -
rm file.txtβ Remove file
πΉ File Viewing & Editing
-
cat file.txtβ View file contents -
less file.txtβ Scroll through long files -
tail -f app.logβ Live view of logs -
nano config.yamlβ Edit file with nano (press I for insert mode) -
vi config.yamlβ Edit file with vi (more advanced)
πΉ Logs & Troubleshooting
-
journalctl -xeβ View system logs (systemd) -
tail -f /var/log/syslogβ Live logs from syslog -
dmesgβ Kernel logs (often useful for hardware issues) -
cat /var/log/auth.logβ Authentication logs -
grep "ERROR" logfile.logβ Search for specific log lines
πΉ User and Permissions
-
adduser usernameβ Create new user -
passwd usernameβ Set/change password -
usermod -aG sudo userβ Add user to sudo group -
whoamiβ Show current user -
idβ Show user and group IDs -
chmod +x script.shβ Make script executable -
chown user:group file.txtβ Change ownership
πΉ System Info & Monitoring
-
df -hβ Disk space usage -
free -mβ Memory usage -
uptimeβ System load and uptime -
topβ Live process monitor -
ps auxβ List all processes
3. Advanced Linux Commands for Cloud & DevOps
πΈ Networking & Connectivity
-
ip aβ Show network interfaces and IPs -
ip rβ Show routing table -
netstat -tulnpβ Show listening ports (usessas alternative) -
curl https://example.comβ Make HTTP request (useful for testing) -
telnet host 80β Test connectivity to a port -
ping 8.8.8.8β Check internet connection -
traceroute google.comβ Track route to a host -
dig domain.comβ DNS lookup -
nslookup domain.comβ Another DNS lookup tool -
telnet host portβ Test if a port is open -
nmap hostβ Scan open ports (if installed)
πΈ Process & Resource Management
-
htopβ Better version oftop(if installed) -
kill -9 PIDβ Kill a process forcefully -
nice -n 10 cmdβ Run a command with a priority
πΈ Package Management (Ubuntu / Debian-based)
-
sudo apt update && sudo apt upgradeβ Update system -
apt install htopβ Install package -
apt remove <pkg>β Remove a package -
dpkg -lβ List installed packages -
which <command>β Show path of a binary (Useyum,dnf, orzypperfor RHEL/CentOS/openSUSE systems)
πΈ SSH & Remote Access
-
ssh user@ip-addressβ Connect to remote server -
scp file.txt user@host:/dirβ Copy file over SSH -
rsync -avz /src/ /dest/β Efficient file sync -
ssh-keygenβ Generate SSH key pair -
ssh-copy-id user@hostβ Add your key to remote authorized_keys
πΈ Disk and Filesystem
-
lsblkβ List block devices -
mount /dev/sdb1 /mnt/dataβ Mount a disk -
df -Thβ Show disk with filesystem types -
du -sh *β Show directory sizes
πΈ Systemd and Services
-
systemctl status nginxβ Check service status -
systemctl start nginxβ Start a service -
systemctl enable nginxβ Enable on boot -
journalctl -u nginxβ View logs for a service
4. Scripting & Automation in the Cloud
πΉ Shell Scripts for Automating Tasks
bash
#!/bin/bash
# update_and_restart.sh
sudo apt update && sudo apt upgrade -y
sudo systemctl restart nginx
Run it:
chmod +x update_and_restart.sh
./update_and_restart.sh
You can mention cron jobs (crontab -e) for scheduled tasks.
`crontab -e` --Edit cron jobs (automated tasks)
`env` --Show environment variables
`bash script.sh` --Run shell script
π§΅ ## 5. Real-World Use Cases (Optional Section)
Include mini examples like:
πΉ**Check disk space before deploying to EC2:**
ssh ec2-user@ip 'df -h'
πΉ**Copy logs from a VM to local:**
scp ec2-user@ip:/var/log/app.log ./logs/
πΉ**Restart a service via SSH:**
ssh user@host 'sudo systemctl restart nginx'
π§Ύ ## 6. Conclusion
Whether you're a junior developer learning cloud or a seasoned engineer managing production infrastructure, mastering Linux commands will save you time, stress, and mistakes.
These commands form the backbone of day-to-day tasks in cloud computing β from debugging apps to automating deployments.
π¬ Whatβs your go-to Linux command in the cloud? Share it below!
#linux #cloud #devops #cli #beginners #productivity
Top comments (0)