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 (usess
as 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
, orzypper
for 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)