Hi—this is Kisan from The Cloud Handbook. Each week I share about Cloud, DevOps, System Design deep dives and technologies around it. If you have not subscribed yet, you can subscribe here.
This is the Part 1 of the Linux Essential for Cloud series. There will be 3 parts where I will share the essential Linux knowledge and skill you will need in Cloud.
Let’s get started.
1. Linux Basics
Linux is an open-source, Unix-like operating system.
From official Linux.com website:
Just like Windows, iOS, and Mac OS, Linux is an operating system. In fact, one of the most popular platforms on the planet, Android, is powered by the Linux operating system. An operating system is software that manages all of the hardware resources associated with your desktop or laptop. To put it simply, the operating system manages the communication between your software and your hardware. Without the operating system (OS), the software wouldn’t function.
Linux kernel source code can be found at: https://www.kernel.org/
In cloud computing, Linux dominates for several key reasons:
Cost Effectiveness: No licensing fees make it ideal for large-scale deployments where hundreds or thousands of instances might be running simultaneously.
Performance and Resource Efficiency: Linux's lightweight nature means more resources are available for applications rather than the operating system overhead.
Security and Stability: The open-source nature allows for rapid security patches, and Linux systems can run for months without requiring restarts.
Containerization Ready: Linux provides native support for containers through features like namespaces and cgroups, making it the natural choice for Docker and Kubernetes deployments.
Automation Friendly: Linux's command-line interface and scripting capabilities make it perfect for Infrastructure as Code and automation workflows.
Linux Distributions Commonly Used in the Cloud
Ubuntu: The most popular choice for cloud deployments, especially for development and web applications. Ubuntu's Long Term Support (LTS) versions provide 5 years of security updates, making them ideal for production environments.
Amazon Linux: AWS's own distribution, optimized for EC2 instances. It comes pre-configured with AWS CLI tools and is tuned for optimal performance on AWS infrastructure.
Red Hat Enterprise Linux (RHEL): Enterprise-grade distribution favored by large organizations. Provides commercial support and is known for stability and security.
CentOS/Rocky Linux: Community-driven alternatives to RHEL, offering similar features without licensing costs. Popular for enterprise environments that need RHEL compatibility.
Alpine Linux: Ultra-lightweight distribution (typically 5MB base image) commonly used for containers and microservices due to its minimal attack surface.
Debian: Known for stability and security, often used as a base for other distributions. Popular for servers that need long-term reliability.
There are tens of thousands of Linux distros available today. You can learn more about distros at https://distrowatch.com/dwres.php?resource=popularity
Using SSH to Connect to Linux Servers
SSH (Secure Shell) is the primary method for connecting to Linux servers in the cloud. Understanding SSH is fundamental for cloud engineers.
Basic SSH Connection:
ssh username@server-ip-address
ssh ubuntu@192.168.1.100
Using SSH Keys (Recommended): SSH keys provide more security than passwords. Cloud providers typically use key-based authentication by default.
# Generate an SSH key pair
ssh-keygen -t rsa -b 4096 -C "your-email@example.com"
# Connect using a specific private key
ssh -i /path/to/private-key username@server-ip
ssh -i ~/.ssh/aws-key.pem ubuntu@ec2-instance-ip
SSH Configuration File: Create ~/.ssh/config
to simplify connections:
Host web-server
HostName 192.168.1.100
User ubuntu
IdentityFile ~/.ssh/web-server-key.pem
Port 22
SSH Security Best Practices:
Disable password authentication
Change default SSH port from 22
Regularly rotate SSH keys
Disable root login over SSH
The video tutorial below explains everything you need to know about SSH if you are still confused.
Terminal Essentials and Shell Overview
The shell is your primary interface for interacting with Linux systems. Understanding shell basics is crucial for cloud operations.
Bash (Bourne Again Shell): The default shell on most Linux distributions. Provides command history, tab completion, and extensive scripting capabilities.
Zsh (Z Shell): Popular alternative shell with enhanced features like better tab completion, spell correction, and theme support.
Essential Shell Concepts:
Command Prompt: Shows current user, hostname, and working directory
Command History: Access previous commands with up arrow or
history
commandTab Completion: Press Tab to auto-complete commands and file names
Pipes and Redirection: Combine commands and redirect output
Environment Variables: Store configuration and system information
2. Basic Linux Commands
You will use this basic commands frequently. So, understand this commands and what they do.
File and directory navigation:
ls
,cd
,pwd
,tree
File operations:
cp
,mv
,rm
,mkdir
,touch
Viewing and editing files:
cat
,less
,more
,head
,tail
,nano
,vim
Permissions and ownership:
chmod
,chown
,ls -l
,umask
3. Permissions and Ownership
Linux permissions are crucial for security, especially in cloud environments where multiple users and services interact.
Permission Types:
r (read): Permission to read file contents or list directory
w (write): Permission to modify file or create/delete files in directory
x (execute): Permission to run file as program or enter directory
chmod
- Change Permissions:
chmod 755 script.sh # rwxr-xr-x (owner: rwx, group: r-x, others: r-x)
chmod +x script.sh # Add execute permission for all
chmod u+w file.txt # Add write permission for owner
chmod go-r file.txt # Remove read permission for group and others
chmod -R 644 /var/www/html/ # Recursively set permissions
Common Permission Patterns:
644: Files (owner: rw-, group: r--, others: r--)
755: Directories and executables (owner: rwx, group: r-x, others: r-x)
600: Private files (owner: rw-, group: ---, others: ---)
700: Private directories (owner: rwx, group: ---, others: ---)
chown
- Change Ownership:
chown user:group file.txt # Change owner and group
chown user file.txt # Change only owner
chown :group file.txt # Change only group
chown -R user:group directory/ # Recursively change ownership
ls -l
- View Detailed File Information:
ls -l # Show permissions, ownership, size, date
ls -la # Include hidden files
If you are still confused, you can watch this tutorial here.
3. Process and Resource Management
Checking system usage:
top
,htop
,free
,uptime
Managing processes:
ps
,kill
,killall
,nice
,renice
Background jobs:
&
,jobs
,fg
,bg
,nohup
Checking System Usage
top
- Real-time System Monitor:
$ top # Interactive process viewer
# Press 'q' to quit, 'k' to kill process, '1' to show all CPU cores
htop
- Enhanced Process Viewer:
$ htop # More user-friendly than top
# Use arrow keys to navigate, F9 to kill, F10 to quit
free
- Memory Usage:
$ free # Show memory usage in KB
$ free -h # Human-readable format (MB/GB)
$ free -s 5 # Update every 5 seconds
uptime
- System Load and Uptime:
$ uptime # Show uptime and load averages
# Load averages: 1-minute, 5-minute, 15-minute
Managing Processes
ps
- List Running Processes:
ps # Show processes for current user
ps aux # Show all processes with detailed info
ps -ef # Show all processes in different format
ps -C nginx # Show processes by command name
kill
and killall
- Terminate Processes:
kill 1234 # Kill process by PID
kill -9 1234 # Force kill (SIGKILL)
kill -15 1234 # Graceful termination (SIGTERM)
killall nginx # Kill all processes named nginx
killall -9 nginx # Force kill all nginx processes
nice
and renice
- Process Priority:
nice -n 10 command # Start command with priority 10
renice -10 1234 # Change priority of existing process
# Priority range: -20 (highest) to 19 (lowest)
Background Jobs
Running Commands in Background:
command & # Run command in background
nohup command & # Run command immune to hangups
Job Control:
jobs # List active jobs
fg %1 # Bring job 1 to foreground
bg %1 # Send job 1 to background
disown %1
Conclusion
Basic Linux Commands, Process management, Permissions, ssh are non negotiable skills while you are getting started in cloud. You will require these concepts at work frequently.
In the Part II of this series, we will be talking about
File System and Storage
Users, Groups and Permissions
Package Management
System Logs and Troubleshooting
📬 Get in touch
Found something worth sharing? Reply to this email or tag me Kisan Tamang— I might feature it next week.
Liked this article? Feel free to drop ❤️ and Restack with your friends.
If you have any feedbacks or questions 💬, comment below. See you in the next one.
You can find me on Twitter, Linkedin.
If you want to work with me or want to sponsor The Cloud Handbook Newsletter, please email me at kisan.codes@gmail.com.
See you in the next one! Until then, keep learning and building.
Thanks 👍😊
thankyou