Linux Fundamentals

Essential Linux concepts, commands, and skills every cloud engineer needs to master infrastructure and automation.

Linux Fundamentals : Commands, File Systems, and Administration Essentials

Last Updated: October 2025

Linux powers the vast majority of cloud infrastructure. Whether you're provisioning AWS EC2 instances, managing Azure VMs, or deploying containers to Kubernetes, you'll interact with Linux systems daily. This guide covers the Linux fundamentals every cloud engineer needs: navigating the file system, managing processes, understanding permissions, working with package managers, and automating tasks with shell scripts.


Why Cloud Engineers Need Linux Skills

Every cloud platform supports Linux, most workloads run on Linux, and most cloud services are built on Linux. Even Windows-based cloud services often use Linux for orchestration layers, container runtimes, and infrastructure tooling. Here's why Linux matters:

  • Server management: Most cloud VMs, containers, and serverless runtimes use Linux distributions (Ubuntu, CentOS, Debian, RedHat).
  • Automation and scripting: Bash and shell scripting are essential for automating deployments, running cron jobs, and building CI/CD pipelines.
  • Troubleshooting: Diagnosing production issues requires reading logs, checking resource usage, inspecting network connections, and debugging running processes-- all done via the Linux command line.
  • Infrastructure as code: Tools like Terraform, Ansible, and Docker assume you're comfortable working in Linux environments.
  • Cost efficiency: Linux is open-source and widely supported, making it the default choice for cost-conscious cloud deployments.

If you're serious about cloud engineering, DevOps, or SRE roles, Linux proficiency is non-negotiable.


Essential Linux Concepts

The Linux File System Hierarchy

Everything in Linux is a file-- including devices, processes, and network sockets. The file system follows a hierarchical tree structure rooted at /:

  • / (root): The top-level directory containing all other directories.
  • /home: User home directories (e.g., /home/username).
  • /etc: System-wide configuration files (e.g., /etc/ssh/sshd_config, /etc/hosts).
  • /var: Variable data like logs (/var/log), web content (/var/www), and temporary files.
  • /usr: User-installed binaries and libraries (/usr/bin, /usr/local).
  • /bin and /sbin: Essential system binaries (e.g., ls, cp, sudo).
  • /tmp: Temporary files cleared on reboot.
  • /opt: Optional third-party software.
  • /proc and /sys: Virtual file systems exposing kernel and process information.

Understanding this hierarchy helps you locate config files, debug issues, and organize your own scripts and applications. If you're troubleshooting an error, it will save you time to know where to look for the files you need.

Users, Groups, and Permissions

Linux is a multi-user system with granular permission controls:

  • Users: Each user has a unique ID (uid) and home directory.
  • Groups: Users belong to groups (gid) for shared permissions (e.g., sudo, docker).
  • Permissions: Files and directories have read (r), write (w), and execute (x) permissions for the owner, group, and others.

Example permission string: drwxr-xr-x

  • d: Directory (or - for file).
  • rwx: Owner can read, write, execute.
  • r-x: Group can read and execute.
  • r-x: Others can read and execute.

Common permission commands:

  • chmod 755 script.sh – Give owner full permissions, others read/execute.
  • chmod +x script.sh – Make a file executable.
  • chown user:group file.txt – Change ownership.

Processes and Services

Every running program is a process with a unique Process ID (PID):

  • Viewing processes: ps aux lists all running processes; top or htop show real-time resource usage.
  • Managing processes: kill <PID> terminates a process; kill -9 <PID> forces termination.
  • Background jobs: Append & to run commands in the background (e.g., ./script.sh &).
  • System services: Managed by systemd on most modern distributions. Use systemctl status <service>, systemctl start <service>, systemctl enable <service> to control daemons like SSH, nginx, or Docker.

Core Linux Commands Every Cloud Engineer Must Know

Navigation and File Management

  • pwd: Print Working Directory (where you are).
  • ls: List directory contents. Common flags: ls -lah (long format, all files, human-readable sizes).
  • cd <directory>: Change Directory. Use cd ~ for home, cd - to go back, cd .. to go up one level.
  • mkdir <name>: Make a Directory. Use -p for nested directories (e.g., mkdir -p /path/to/dir).
  • touch <file>: Create an empty File or update timestamp.
  • cp <source> <dest>: Copy Files. Use -r for directories (e.g., cp -r /src /dest).
  • mv <source> <dest>: Move or rename files.
  • rm <file>: Remove (delete) files. Use -r for directories, -f to force.

Viewing and Editing Files

  • cat <file>: Display file contents.
  • less <file>: Paginated file viewer (use / to search, q to quit).
  • head <file>: Show first 10 lines (use -n to specify count).
  • tail <file>: Show last 10 lines. Use tail -f to follow live logs.
  • grep <pattern> <file>: Search for text patterns. Example: grep "error" /var/log/syslog.
  • nano <file> or vim <file>: Text editors. Nano is beginner-friendly; Vim is powerful but has a learning curve. Spending a few weeks learning Vim can save you time in the long run.

System Information and Monitoring

  • df -h: Disk space usage (human-readable).
  • du -sh <directory>: Directory size.
  • free -h: Memory usage.
  • uptime: System uptime and load average.
  • top or htop: Real-time process and resource monitoring.
  • ps aux: Snapshot of running processes.
  • systemctl status <service>: Check service status (e.g., systemctl status nginx).

Networking Commands

  • ifconfig or ip addr: Display network interfaces and IP addresses.
  • ping <host>: Test connectivity (e.g., ping google.com).
  • curl <url>: Fetch web content or test APIs. Example: curl https://api.example.com.
  • wget <url>: Download files (e.g., wget https://example.com/file.zip).
  • netstat -tuln: Show listening ports.
  • ss -tuln: Modern replacement for netstat.
  • ssh user@host: Connect to remote servers securely.
  • scp <file> user@host:/path: Securely copy files over SSH.

Package Management

Package managers install, update, and remove software. The command varies by distribution:

Debian/Ubuntu (apt):

  • sudo apt update – Refresh package index.
  • sudo apt upgrade – Upgrade installed packages.
  • sudo apt install <package> – Install software (e.g., sudo apt install nginx).
  • sudo apt remove <package> – Uninstall software.

Red Hat/CentOS/Amazon Linux (yum or dnf):

  • sudo yum update – Update packages.
  • sudo yum install <package> – Install software.
  • sudo yum remove <package> – Uninstall software.

File Permissions and Ownership

  • chmod <permissions> <file>: Change file permissions. Example: chmod 644 file.txt (owner read/write, others read-only).
  • chown <user>:<group> <file>: Change ownership. Example: chown ubuntu:ubuntu /var/www/html.
  • sudo <command>: Execute commands with superuser privileges (requires user in sudo group).

Shell Scripting Basics for Automation

Bash scripting automates repetitive tasks, deployment steps, and infrastructure management. Here's a crash course:

Writing Your First Script

Create a file called hello.sh:

#!/bin/bash
# This is a comment
echo "Hello, Cloud Engineer!"

Make it executable and run it:

chmod +x hello.sh
./hello.sh

Variables and User Input

#!/bin/bash
NAME="CloudJobs"
echo "Welcome to $NAME"

# Read user input
read -p "Enter your name: " USERNAME
echo "Hello, $USERNAME!"

Conditionals

#!/bin/bash
read -p "Enter a number: " NUM

if [ $NUM -gt 10 ]; then
  echo "Number is greater than 10"
elif [ $NUM -eq 10 ]; then
  echo "Number is 10"
else
  echo "Number is less than 10"
fi

Loops

#!/bin/bash
# For loop
for i in {1..5}; do
  echo "Iteration $i"
done

# While loop
COUNT=1
while [ $COUNT -le 5 ]; do
  echo "Count: $COUNT"
  COUNT=$((COUNT + 1))
done

Functions

#!/bin/bash
function greet() {
  echo "Hello, $1!"
}

greet "Cloud Engineer"

Practical Use Cases

Backup script:

#!/bin/bash
BACKUP_DIR="/backup"
SOURCE_DIR="/var/www"
DATE=$(date +%Y%m%d)

tar -czf $BACKUP_DIR/backup-$DATE.tar.gz $SOURCE_DIR
echo "Backup completed: backup-$DATE.tar.gz"

Check disk space and alert:

#!/bin/bash
THRESHOLD=80
USAGE=$(df / | tail -1 | awk '{print $5}' | sed 's/%//')

if [ $USAGE -gt $THRESHOLD ]; then
  echo "WARNING: Disk usage is at ${USAGE}%"
fi

Working with Logs and Troubleshooting

Logs are your best friend when debugging cloud infrastructure. Most logs live in /var/log/:

  • System logs: /var/log/syslog (Debian/Ubuntu) or /var/log/messages (Red Hat/CentOS).
  • Authentication logs: /var/log/auth.log.
  • Application logs: Often in /var/log/<service>/ (e.g., /var/log/nginx/).

Common log commands:

  • tail -f /var/log/syslog – Follow logs in real time.
  • grep "error" /var/log/nginx/error.log – Search for errors.
  • journalctl -u nginx -f – Follow systemd service logs (replaces traditional log files on modern systems).
  • dmesg – Kernel ring buffer (hardware and driver messages).

Troubleshooting checklist:

  1. Is the service running? systemctl status <service>
  2. Check recent logs: journalctl -u <service> --since "10 minutes ago"
  3. Inspect config files: Look in /etc/<service>/
  4. Verify network connectivity: ping, curl, netstat -tuln
  5. Check disk space: df -h
  6. Review resource usage: top, free -h, ps aux

SSH: Secure Remote Access

SSH (Secure Shell) is how you connect to cloud VMs, EC2 instances, and remote servers.

Basic SSH connection:

ssh username@hostname

Using SSH keys (recommended): Generate a key pair:

ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

Copy public key to server:

ssh-copy-id username@hostname

SSH config file (~/.ssh/config):

Host myserver
  HostName 192.168.1.100
  User ubuntu
  IdentityFile ~/.ssh/id_rsa

Now you can connect with just ssh myserver.

Transferring files:

  • scp localfile.txt user@host:/remote/path – Copy file to server.
  • scp user@host:/remote/file.txt . – Copy file from server.

Cron Jobs: Scheduling Tasks

Cron automates recurring tasks (backups, log rotation, health checks). Edit your cron table:

crontab -e

Cron syntax: minute hour day month weekday command

Examples:

  • 0 2 * * * /home/user/backup.sh – Run backup.sh daily at 2 AM.
  • */5 * * * * curl https://api.example.com/health – Check API health every 5 minutes.
  • 0 0 * * 0 apt-get update && apt-get upgrade -y – Update packages weekly on Sunday at midnight.

View current cron jobs:

crontab -l

Environment Variables and Configuration

Environment variables store configuration like API keys, database URLs, and paths.

View all variables:

env

Set a variable:

export API_KEY="your-secret-key"

Make it permanent (add to ~/.bashrc or ~/.bash_profile):

echo 'export API_KEY="your-secret-key"' >> ~/.bashrc
source ~/.bashrc

Common variables:

  • PATH: Directories searched for executable files.
  • HOME: User's home directory.
  • USER: Current username.

Linux Distributions

Different distributions have different strengths:

  • Ubuntu: Most popular for cloud VMs; great community support, frequent updates.
  • CentOS/Rocky Linux: Enterprise-focused; Red Hat-compatible; favored in corporate environments.
  • RedHat: Enterprise-focused; Red Hat-compatible; favored in corporate environments.
  • Debian: Stable and lightweight; popular for servers.

Most cloud platforms default to Ubuntu or RedHat. Learn one distribution deeply, then transferable skills apply across others. If your company uses one distribution, don't worry about learning a second. You're better off focusing on other skills.


Learning Path: From Beginner to Proficient

  1. First: Master navigation (cd, ls, pwd), file management (cp, mv, rm), and viewing files (cat, less, grep).
  2. Second: Learn permissions (chmod, chown), users, and package managers (apt, yum).
  3. Third: Set up SSH keys, configure cron jobs, and automate a deployment script.
  4. Fourth: Write basic Bash scripts with variables, conditionals, and loops.
  5. Fifth: Practice process management (ps, top, kill), services (systemctl), and log inspection (tail, journalctl).

Practical Exercises - The best way to learn is by doing

  1. Set up a web server: Install nginx, configure it to serve a static site, and access it via a browser.
  2. Automate backups: Write a script that tars a directory and uploads it to cloud storage (S3, Azure Blob).
  3. Monitor disk usage: Create a cron job that emails you if disk usage exceeds 80%.
  4. Deploy an app: Clone a GitHub repo, install dependencies, and run a Node.js or Python app as a systemd service.
  5. Debug a broken service: Intentionally misconfigure nginx, then use logs and systemctl to diagnose and fix it.

The Bottom Line: Linux Is Your Foundation

Linux fluency separates hobbyists from professional cloud engineers. You don't need to memorize every command-- Google and man pages exist for that-- but you do need comfort navigating the terminal, managing services, automating tasks, and troubleshooting production issues. Start with the basics, practice on real cloud VMs, and build muscle memory through repetition. These skills can be a bit frustrating at the start, but if you're using them every day, they'll become second nature, maybe even fun.

For more cloud engineering guidance, check out what does a cloud engineer do and how to get a cloud engineering job with no experience.

← Back to Insights