
Every major cloud platform runs Linux. Docker containers run Linux. Kubernetes nodes run Linux. CI/CD pipelines run on Linux. If you are going to work in DevOps, you will spend a large part of your career working on Linux systems, often remotely via SSH. Being fluent in Linux is not optional -- it is the foundation everything else is built on.
When I first connected to an AWS EC2 instance via SSH and found myself at a bare terminal with no GUI, no mouse, no file browser, I felt lost. Within a few weeks of daily practice, that terminal became home. Now navigating, debugging, and configuring Linux systems is faster and more powerful than any GUI could be.
pwd # Print working directory
ls # List files
ls -la # List all files with details and hidden files
ls -lh # Human-readable sizes (KB, MB, GB)
cd /home/ubuntu # Change directory (absolute path)
cd .. # Go up one directory
cd ~ # Go to home directory
cd - # Go back to previous directory
# Finding files
find /etc -name "*.conf" # Find conf files in /etc
find /var/log -mtime -7 # Files modified in last 7 days
find / -size +100M # Files larger than 100MB
locate nginx.conf # Fast find (uses database)
which python3 # Where is this command?
type docker # What kind of command is this?
mkdir -p /app/logs/2025 # Create nested directories
touch file.txt # Create empty file / update timestamp
cp file.txt backup.txt # Copy file
cp -r dir/ backup/ # Copy directory recursively
mv file.txt /tmp/ # Move file
mv old-name.txt new-name.txt # Rename file
rm file.txt # Delete file (permanent!)
rm -rf /tmp/old-dir/ # Delete directory recursively
# View file contents
cat file.txt # Print entire file
less file.txt # Scroll through file (q to quit)
head -20 file.txt # First 20 lines
tail -20 file.txt # Last 20 lines
tail -f /var/log/nginx/access.log # Follow live log output
Linux permissions control who can read, write, and execute files. Every file has three permission sets: owner, group, and others.
ls -la
# -rw-r--r-- 1 suraj devs 1234 Jan 1 12:00 config.txt
# drwxr-xr-x 2 root root 4096 Jan 1 12:00 scripts/
# Permissions breakdown: rwxrwxrwx = owner group others
# r=4 w=2 x=1
# chmod: change permissions
chmod 755 script.sh # rwxr-xr-x -- owner full, others read+exec
chmod 644 config.txt # rw-r--r-- -- owner read+write, others read
chmod +x deploy.sh # Add execute permission to all
chmod -R 750 /app/ # Recursive: apply to all files in directory
# chown: change ownership
chown ubuntu:ubuntu /app
chown -R www-data:www-data /var/www/html
ps aux # All running processes
ps aux | grep nginx # Find nginx process
top # Live process monitor
htop # Better live monitor (install: apt install htop)
# Kill processes
kill 1234 # Send SIGTERM (graceful)
kill -9 1234 # Send SIGKILL (force kill)
pkill nginx # Kill by name
killall python3 # Kill all processes with name
# Background processes
./long-script.sh & # Run in background
nohup ./script.sh & # Run immune to hangups (survives SSH disconnect)
jobs # List background jobs
fg 1 # Bring job 1 to foreground
# grep: search for patterns
grep "ERROR" /var/log/app.log
grep -i "error" log.txt # Case-insensitive
grep -r "password" /etc/ # Recursive search
grep -v "DEBUG" app.log # Show lines NOT matching
grep -c "ERROR" app.log # Count matching lines
grep -A 3 "FATAL" app.log # Show 3 lines AFTER match
# awk: process columns
awk '{print $1, $3}' file.txt # Print columns 1 and 3
awk -F: '{print $1}' /etc/passwd # Print usernames (: separator)
awk '$3 > 1000 {print $1}' /etc/passwd # UIDs above 1000
# sed: stream editor (find and replace)
sed 's/localhost/production.db/g' config.txt
sed -i 's/DEBUG/INFO/g' app.conf # Edit file in-place
Ubuntu LTS (Long Term Support) for learning and development. Amazon Linux 2 or Ubuntu on AWS EC2 for production. Most concepts transfer between distributions. Ubuntu is the best choice to start because documentation and community support are excellent.
sudo (superuser do) runs a command with root/administrator privileges. Use it when commands require elevated access: sudo apt install, sudo systemctl restart nginx. Avoid running everything as root -- use sudo only when necessary for security.
journalctl -xe for systemd logs. tail -f /var/log/syslog for system log. tail -f /var/log/nginx/error.log for nginx. dmesg for kernel messages. journalctl -u nginx for a specific service.
./ runs a file from the current directory. Commands like ls, grep are in /usr/bin/ and /usr/sbin/ which are in your PATH -- so you can run them from anywhere without ./ prefix. Run which nginx to find where any command lives.
df -h shows disk usage by filesystem (h for human readable). du -sh * shows size of each item in current directory. du -sh /var/log/* shows what is filling up /var/log. ncdu is an interactive disk usage viewer (install: apt install ncdu).
In Part 3, we cover Git and version control -- the foundation of all modern software development and DevOps workflows.
pwd # Print working directory
ls # List files
ls -la # List all files with details and hidden files
ls -lh # Human-readable sizes (KB, MB, GB)
cd /home/ubuntu # Change directory (absolute path)
cd .. # Go up one directory
cd ~ # Go to home directory
cd - # Go back to previous directory
# Finding files
find /etc -name "*.conf" # Find conf files in /etc
find /var/log -mtime -7 # Files modified in last 7 days
find / -size +100M # Files larger than 100MB
locate nginx.conf # Fast find (uses database)
which python3 # Where is this command?
type docker # What kind of command is this?
mkdir -p /app/logs/2025 # Create nested directories
touch file.txt # Create empty file / update timestamp
cp file.txt backup.txt # Copy file
cp -r dir/ backup/ # Copy directory recursively
mv file.txt /tmp/ # Move file
mv old-name.txt new-name.txt # Rename file
rm file.txt # Delete file (permanent!)
rm -rf /tmp/old-dir/ # Delete directory recursively
# View file contents
cat file.txt # Print entire file
less file.txt # Scroll through file (q to quit)
head -20 file.txt # First 20 lines
tail -20 file.txt # Last 20 lines
tail -f /var/log/nginx/access.log # Follow live log output
Linux permissions control who can read, write, and execute files. Every file has three permission sets: owner, group, and others.
ls -la
# -rw-r--r-- 1 suraj devs 1234 Jan 1 12:00 config.txt
# drwxr-xr-x 2 root root 4096 Jan 1 12:00 scripts/
# Permissions breakdown: rwxrwxrwx = owner group others
# r=4 w=2 x=1
# chmod: change permissions
chmod 755 script.sh # rwxr-xr-x -- owner full, others read+exec
chmod 644 config.txt # rw-r--r-- -- owner read+write, others read
chmod +x deploy.sh # Add execute permission to all
chmod -R 750 /app/ # Recursive: apply to all files in directory
# chown: change ownership
chown ubuntu:ubuntu /app
chown -R www-data:www-data /var/www/html
ps aux # All running processes
ps aux | grep nginx # Find nginx process
top # Live process monitor
htop # Better live monitor (install: apt install htop)
# Kill processes
kill 1234 # Send SIGTERM (graceful)
kill -9 1234 # Send SIGKILL (force kill)
pkill nginx # Kill by name
killall python3 # Kill all processes with name
# Background processes
./long-script.sh & # Run in background
nohup ./script.sh & # Run immune to hangups (survives SSH disconnect)
jobs # List background jobs
fg 1 # Bring job 1 to foreground
# grep: search for patterns
grep "ERROR" /var/log/app.log
grep -i "error" log.txt # Case-insensitive
grep -r "password" /etc/ # Recursive search
grep -v "DEBUG" app.log # Show lines NOT matching
grep -c "ERROR" app.log # Count matching lines
grep -A 3 "FATAL" app.log # Show 3 lines AFTER match
# awk: process columns
awk '{print $1, $3}' file.txt # Print columns 1 and 3
awk -F: '{print $1}' /etc/passwd # Print usernames (: separator)
awk '$3 > 1000 {print $1}' /etc/passwd # UIDs above 1000
# sed: stream editor (find and replace)
sed 's/localhost/production.db/g' config.txt
sed -i 's/DEBUG/INFO/g' app.conf # Edit file in-place
Ubuntu LTS (Long Term Support) for learning and development. Amazon Linux 2 or Ubuntu on AWS EC2 for production. Most concepts transfer between distributions. Ubuntu is the best choice to start because documentation and community support are excellent.
sudo (superuser do) runs a command with root/administrator privileges. Use it when commands require elevated access: sudo apt install, sudo systemctl restart nginx. Avoid running everything as root -- use sudo only when necessary for security.
journalctl -xe for systemd logs. tail -f /var/log/syslog for system log. tail -f /var/log/nginx/error.log for nginx. dmesg for kernel messages. journalctl -u nginx for a specific service.
./ runs a file from the current directory. Commands like ls, grep are in /usr/bin/ and /usr/sbin/ which are in your PATH -- so you can run them from anywhere without ./ prefix. Run which nginx to find where any command lives.
df -h shows disk usage by filesystem (h for human readable). du -sh * shows size of each item in current directory. du -sh /var/log/* shows what is filling up /var/log. ncdu is an interactive disk usage viewer (install: apt install ncdu).
In Part 3, we cover Git and version control -- the foundation of all modern software development and DevOps workflows.
" style="max-width:100%;height:auto;border-radius:12px;" loading="lazy" width="680"/>