DEV Community

Cover image for Linux for DevOps - The Complete Hands-On Beginner-to-Advanced Guide (Week 1 Series)
Ashish
Ashish

Posted on

Linux for DevOps - The Complete Hands-On Beginner-to-Advanced Guide (Week 1 Series)

Linux for DevOps — Part 1
Linkedin Profile: https://www.linkedin.com/in/ashish360/
Hashnode Link: https://devopswithashish.hashnode.dev/linux-for-devops-the-complete-hands-on-beginner-to-advanced-guide-week-1-series

Introduction + Filesystem & Directory Commands
By Ashish — Learn-in-Public DevOps Journey (Week 1)
📘 Table of Contents
Why Linux Matters in DevOps
Linux System Architecture
Linux Distributions
Setting Up Linux (Windows/Mac/Linux)
Package Managers Explained
Filesystem & Directory Commands (Full Deep Dive)

  1. 🚀Why Linux Matters in DevOps The more I explored Linux this week, the clearer it became why every DevOps engineer, cloud engineer, SRE, and backend developer depends on Linux daily. Linux is the foundation of DevOps, because it is: 🟦 Cost-Effective Free and open-source No licensing fees Low maintenance and predictable performance 🟦 High Performance Lightweight and fast Works on everything from Raspberry Pi to enterprise servers Efficient memory and process management 🟦 Secure & Reliable Strong permission system Very limited malware exposure Systems can run for years without reboot Every cloud provider (AWS, GCP, Azure), container runtime (Docker), orchestration system (Kubernetes), infrastructure tool (Terraform), and automation platform (Ansible) runs on Linux. If you want to be a DevOps engineer, you must master Linux deeply.
  2. 🔧Linux System Architecture (Simple Diagram) +----------------------------------------------------+ | User Applications (Docker, Vim, Git, Apache, etc.) | +----------------------------------------------------+ | Shell (Bash, Zsh, Fish, etc.) | +----------------------------------------------------+ | System Libraries (glibc, libc6, OpenSSL, etc.) | +----------------------------------------------------+ | System Utilities (ls, grep, ps, systemctl, etc.) | +----------------------------------------------------+ | Linux Kernel (Processes, Memory, FS, Network) | +----------------------------------------------------+ | Hardware (CPU, RAM, Disk, NICs, Peripherals) | +----------------------------------------------------+

✔ Hardware Layer
Physical components: CPU, RAM, storage, network cards.
✔ Kernel
The brain of Linux.
Handles:
process scheduling
memory allocation
file systems
networks
drivers
system calls
✔ Shell
Interface between user & kernel.
Examples: Bash, Zsh, Fish, Ksh.
✔ User Applications
Tools like Docker, Git, Terraform, Jenkins, Nginx, etc.

  1. 🐧Linux Distributions (Distros) Different distros package the Linux kernel with tools and package managers. ⭐ Best distros for DevOps: Ubuntu (most popular & beginner-friendly) Debian (stable, reliable) Fedora (cutting-edge) AlmaLinux / Rocky Linux (RHEL-based, enterprise) Arch Linux (advanced users) Alpine Linux (super lightweight, perfect for Docker) Kernel source: https://git.kernel.org https://github.com/torvalds/linux
  2. 🖥️Setting Up Linux (Windows & Mac) ✔ Best Method: Use Docker Fast, safe, sandboxed environment for DevOps practice. I won’t repeat commands here — they’re already in your notes above. (This article will stay focused on filesystem commands.)
  3. 📦Package Managers (Quick Summary) Distro Package Manager Example Ubuntu/Debian apt sudo apt install nginx RHEL/CentOS dnf / yum sudo dnf install nginx Arch Linux pacman sudo pacman -S nginx OpenSUSE zypper sudo zypper install nginx

Commands:
sudo apt update
sudo apt upgrade -y
sudo apt install nginx
sudo apt remove nginx
sudo apt autoremove
⭐6. FILESYSTEM & DIRECTORY COMMANDS (FULL DETAILED VERSION)
This is where Part 1 becomes extremely valuable.
Every command below includes:
Definition
What it does
Why DevOps uses it
Practical example
Variations
Notes (dangerous flags highlighted)
6.1 ls — List Files
Definition:
Lists files and directories.
What it does:
Shows names, sizes, permissions, timestamps, and ownership.
DevOps Use-Cases:
Checking log files
Checking deployment directories
Debugging incorrect paths
Inspecting mounted volumes in Docker/K8s
Example:
ls -ltr
l = long format
t = sort by latest
r = reverse order
Variations:
ls -a # show hidden files
ls -lh # human readable sizes
ls -R # recursive

6.2 pwd — Print Working Directory
Definition:
Displays the absolute path of the current directory.
DevOps Use-Cases:
Confirm before deleting
Confirm before copying files
Debug script working directories
Example:
pwd

/var/www/app

6.3 cd — Change Directory
Definition:
Navigates between directories.
Examples:
cd /etc/nginx
cd ~
cd ..
cd -

Notes:
cd - returns to the previous directory.
6.4 touch — Create Empty File
Definition:
Creates a new file or updates timestamp.
DevOps Use-Cases:
Create placeholders
Trigger builds watching timestamps
Create test logs
Example:
touch app.log

6.5 mkdir — Create Directory
Example:
mkdir logs
Create nested directories:
mkdir -p /opt/app/logs

6.6 rmdir — Remove Empty Directory
Example:
rmdir oldfolder

⚠️ Only works if directory is empty.
6.7 rm — Remove Files or Directories
Definition:
Deletes files/folders.
DevOps Use-Cases:
Delete artifacts/logs
Clean build folders
Examples:
rm file.txt
rm -r folder/
rm -rf /tmp/data
⚠️ Danger: Never run rm -rf /.
6.8 cp — Copy Files
Examples:
cp a.txt b.txt
cp -r /var/www /backup

6.9 mv — Move or Rename
Example:
mv config.old config.yaml
6.10 cat — Show File Content
Example:
cat /etc/hostname

6.11 tac — Show File in Reverse
Example:
tac server.log

6.12 head — First Lines
head -n 20 file.txt

6.13 tail — Last Lines
tail -n 20 access.log

Live logs:
tail -f /var/log/syslog

6.14 wc — Word Count
wc -l app.log

6.15 echo — Print / Write Content
echo "Hello World"
echo "PORT=8080" > app.env

6.16 cut — Extract Columns
cut -d',' -f2 users.csv
6.17 diff — Compare Files
diff old.conf new.conf

6.18 ln — Create Links
Soft link:
ln -s /var/www/html index
Hard link:
ln file1 file2

6.19 zcat — View Compressed Files
zcat logs.gz

6.20 which — Locate Executable Path
which python3

6.21 file — Identify File Type
file script.sh

Linux for DevOps — Part 2
Viewers, Editors & File Inspection Commands
By Ashish — Learn-in-Public DevOps Journey (Week 1)
This is one of the most important sections because DevOps engineers read logs, inspect configs, debug deployments, and modify system files daily.
📘 Table of Contents
File Viewing Tools
cat, tac, more, less, head, tail, tail -f, nl, od, strings, zcat
Redirection & Output Tools
Tee, echo
Editors
nano, vi / vim
Using Editors in DevOps Tasks
Summary & Next Section

⭐ 1. File Viewing Tools
These commands help you inspect file contents, logs, configs, and scripts, the daily life of a DevOps engineer.
1.1 cat — Display File Content
Definition:
Concatenates and prints file content to the terminal.
What it does:
Shows the entire content, useful for small/medium-sized files.
DevOps Use-Cases:
Inspect environment files
View configs (nginx.conf, .env)
Check last updated logs
Example:
cat /etc/os-release
Variation:
cat file1 file2 > merged.txt

1.2 tac — Display File Content in Reverse Order
Why DevOps uses it:
Logs append new entries at the bottom.
tac helps examine the latest entries first.
Example:
tac application.log

1.3 more — Page Through File
Definition:
Displays file one page at a time.
Example:
more /var/log/syslog

Note:
Only supports forward movement.
1.4 less — Advanced File Viewer (Better than more)
Definition:
Interactive file viewer with scrolling.
DevOps Use-Cases:
Inspect huge log files
Search inside configs
Scroll back-and-forth easily
Example:
less /var/log/auth.log
Navigation:
Up/Down arrows → scroll
G → go to end
1G → go to top
/keyword → search
1.5 head — Show First Lines
Example:
head -n 20 nginx.conf

1.6 tail — Show Last Lines
Example:
tail -n 20 access.log

1.7 tail -f — Live Log Monitoring
Definition:
Follow file changes in real-time.
DevOps Use-Cases:
💡 This is one of the MOST used DevOps commands.
Monitor services
Watch logs during deployment
Debug CI/CD issues
Observe API requests in real time
Example:
tail -f /var/log/syslog

1.8 nl — Add Line Numbers to Output
Definition: Prints file with numbered lines.
Example: nl index.html
Useful when:
Debugging long config files
Reviewing scripts with errors
1.9 od — View File in Octal/Hex Format
Definition: Displays binary files in readable form.
Example: od -c myfile.bin
Use-cases for DevOps:
Inspect corrupted config
Debug unusual characters
1.10 strings — Extract Text from Binary
Definition: Prints readable text from binary files.
Example: strings /usr/bin/ssh

1.11 zcat — View GZipped Files
Definition:
Read .gz compressed files without decompressing.
Example:
zcat nginx-access.log.gz
⭐ 2. Redirection & Output Tools
2.1 echo — Print or Write Text
Examples:
echo "Hello World"
echo "ENV=prod" > app.env
echo "PORT=8080" >> app.env

Uses for DevOps:
Append environment variables
Create config files dynamically
Print messages inside scripts
2.2 tee — Write Output to File + Display
Definition: Sends output to terminal and saves it to file.
Example: echo "server restarted" | tee /var/log/restart.log

Use-case: Logging automation scripts.

⭐ 3. Editors
3.1 nano — Simple Text Editor
Definition: Beginner-friendly terminal editor.
Example: nano config.yaml

Common Shortcuts:
Ctrl + O → Save
Ctrl + X → Exit
Ctrl + K → Cut line
Ctrl + U → Paste
3.2 vi / vim — Advanced Text Editor
Definition: Powerful modal editor used heavily in DevOps/SRE work.
Why DevOps uses it:
Edit configs in servers
Edit YAML, scripts, Dockerfiles
Works in all environments (SSH, containers, recovery mode)

⭐ VIM MODES
Mode
Purpose
Normal
Navigation & commands
Insert
Editing text
Command
Save, quit, search

Switching:
i → insert
Esc → normal
: → command mode
⭐ Most Used VIM Commands
Save & Quit
:w # save
:wq # save & quit
:q! # quit without saving
Navigation
h j k l # left, down, up, right
0 # start of line
$ # end of line
gg # start of file
G # end of file
:n # go to line n

Editing
x # delete char
dd # delete line
yy # copy (yank)
p # paste
u # undo
Ctrl+r # redo

Search
/pattern
n
N

⭐ 4. Using Editors in DevOps
Use-cases:
Edit nginx/apache configs
Update environment variable files (.env)
Modify system configs in /etc/
Fix shell scripts
Edit Dockerfiles, Jenkinsfiles
Make changes inside Linux containers
Every DevOps engineer uses vim daily — especially over SSH.

Linux for DevOps — Part 3
Text Processing: grep, awk, sed
By Ashish — Learn-in-Public DevOps Journey (Week 1)
📘 Table of Contents
✔ Introduction — Why Text Processing Matters in DevOps
✔ grep — Pattern Searching (Basic → Advanced)
✔ sed — Stream Editing (Line Edits, Replacements, Filters)
✔ awk — Text Extraction, Filters, Reports
✔ Practical DevOps Log Examples
✔ Real-World Automation One-Liners
✔ Summary & Next Part
⭐ 1. Why Text Processing Is Critical for DevOps
As a DevOps engineer, your entire workflow revolves around:
Logs
Configs
YAML/JSON files
System metrics
CI/CD output
Kubernetes events
Network traces
Monitoring alerts

And the three tools that dominate every Linux-based DevOps environment are:
👉 grep — find patterns
👉 sed — modify text
👉 awk — extract, manipulate & report text
Every DevOps/sre uses these commands daily.
⭐ 2. grep — Global Regular Expression Print
Definition: Searches for patterns inside files or command outputs.
What it does: Finds matching text, filters lines, highlights patterns.
Why DevOps uses it:
Debug errors in logs
Extract warning or failure messages
Filter Kubernetes logs
Analyze API access logs
Search configs during outages
Validate environment variables
🔹 2.1 Basic grep Usage
Example — Search for “error” inside a log:
grep "error" app.log
Case-insensitive search:
grep -i "error" app.log
🔹 2.2 Search recursively (folders)
grep -r "timeout" /var/log/
Use-case:
Search entire server logs for an error.
🔹 2.3 Count how many times a pattern appears
grep -c "404" access.log
🔹 2.4 Show line numbers
grep -n "invalid" /var/log/auth.log
🔹 2.5 Invert match (show NON-matching lines)
grep -v "200" access.log
Useful for finding errors in successful requests.
🔹 2.6 Highlight matches
grep --color=auto "failed" /var/log/secure
🔹 2.7 Filter processes
ps aux | grep nginx
This command is used by DevOps engineers hundreds of times.
🔹 2.8 Regex Search
End with .log:
ls | grep ".log$"
Match numbers:
grep -E "[0-9]+" file.txt
⭐ 3. sed — Stream Editor
Definition:
Edits text in a stream (file or pipeline) without opening an editor.
What it does:
Replace text
Delete lines
Extract lines
Insert content
Modify config files automatically
Why DevOps uses sed:
Automate config editing
Mass update parameters
Modify YAML/JSON in CI/CD
Fix logs in pipelines
Edit environment files
🔹 3.1 Replace Text (Global Replace)
Replace “error” with “failed”:
sed 's/error/failed/g' app.log
Case-insensitive:
sed 's/error/failed/gi' app.log
🔹 3.2 Replace text in a specific line range
sed '1,5 s/debug/info/g' log.txt
🔹 3.3 Print only matching lines
sed -n '/timeout/p' server.log
Equivalent to:
grep "timeout" server.log
🔹 3.4 Show line numbers where pattern matches
sed -n -e '/error/=' server.log
🔹 3.5 Combine multiple sed operations
sed -n -e '/error/=' -e '/error/p' logfile
🔹 3.6 Delete lines matching a pattern
sed '/DEBUG/d' app.log
🔹 3.7 Insert a line before a match
sed '/server {/i # Managed by DevOps' nginx.conf
🔹 3.8 Inline editing (overwrite original file)
sed -i 's/old/new/g' config.yaml
⚠ Use with care — this modifies the file permanently.
⭐ 4. awk — Text Processing & Reporting Language
Definition:
A powerful pattern-based text processing tool.
What it does:
Extracts columns
Filters rows
Performs calculations
Formats reports
Processes logs
Processes CSV/TSV
Why DevOps uses awk:
Analyze log fields
Extract IPs
Process CPU/memory data
parse API responses
Generate metrics
Extract from kubectl outputs

🔹 4.1 Print specific columns
awk '{print $1, $3}' file.txt
$1 = first column
$3 = third column
🔹 4.2 Filter by pattern and print fields
awk '/error/ {print $2, $5}' app.log
🔹 4.3 Count lines matching condition
awk '/404/ {count++} END {print count}' access.log
🔹 4.4 Use numerical conditions
Print IPs in a specific range:
awk '$2 >= "10.10.11.14" && $2 <= "10.10.11.51" {print $2}' file
🔹 4.5 Print lines with > X response time
awk '$5 > 500 {print $0}' api.log
🔹 4.6 awk as a CSV processor
awk -F',' '{print $1,$3}' users.csv
-F sets delimiter.
🔹 4.7 Sum values (analytics)
Example: sum total bytes from access logs:
awk '{sum += $10} END {print sum}' access.log
⭐ 5. Practical DevOps Examples
These are commands you’ll use daily as a DevOps engineer.
➡️ 5.1 Check how many 500 errors occurred today
grep " 500 " access.log | wc -l
➡️ 5.2 Extract all unique IPs
awk '{print $1}' access.log | sort | uniq
➡️ 5.3 Monitor logs for timeouts
grep -i "timeout" -r /var/log/
➡️ 5.4 Replace environment variable in CI
sed -i 's/ENV=dev/ENV=prod/g' .env
➡️ 5.5 Analyze API response times
awk '$9 > 400 {print $1, $9}' access.log
➡️ 5.6 Extract disk usage from df -h
df -h | awk 'NR>1 {print $1, $5}'
⭐ 6. DevOps One-Liner Automations
✔ Restart service if memory crosses threshold
free -m | awk '/Mem/ {if($3/$2*100 > 90) print "Restart needed!"}'
✔ Detect high CPU processes
ps aux | awk '$3 > 50 {print $0}'
✔ Validate YAML indentation in CI/CD
sed -n '/^[[:space:]]{2}[^ ]/p' file.yaml
✔ Extract container IDs using grep + awk
docker ps | grep nginx | awk '{print $1}'

📝 Linux for DevOps — Part 4
User, Group & Permission Management
By Ashish — Learn in Public DevOps Journey (Week 1)
📘 Table of Contents
✔ Users & User Accounts
useradd, adduser, userdel, passwd, su, Id, who / whoami
✔ Groups & Group Management
groupadd, groupdel, gpasswd, usermod (group membership)
✔ Permissions (rwx)
chmod, chown, chgrp, umask, special bits (SUID, SGID, Sticky Bit)
✔ Understanding Permission Structure
✔ Practical DevOps Scenarios
✔ Security Best Practices
✔ Summary & Next Part

⭐ 1. What Are Users & Groups in Linux?
Linux has a powerful permission model based on:
User (owner) — who created the file
Group — team members
Others — everyone else
Every resource (file, folder, process, service) has ownership + permissions.
This is why as a DevOps engineer you MUST understand:
Who can run a script?
Who can read logs?
Who can restart services?
Who can modify CI/CD configs?
Who can access production servers?
Now let’s go one by one.
⭐ 2. User Management Commands
2.1 useradd — Create a New User (Low-Level)
Definition:
Creates a new user account.
Why DevOps uses it:
Create service accounts
Create users for automation
Create test users inside containers
Add temporary developers/engineers
Example:
sudo useradd -m ashish
-m creates a home directory (/home/ashish)
Common flags:
useradd -s /bin/bash ashish # set default shell
useradd -d /data ashish # custom home directory
useradd -u 1050 ashish # specify UID

2.2 adduser — High-Level User Creation (Recommended)
Definition: Interactive wrapper for useradd.
Example: sudo adduser devopsuser
Prompts for:
password
full name
phone
room, etc.
Use-case:
Best for human users (developers, admins).
2.3 passwd — Set or Change User Password
Example:
sudo passwd ashish

Why DevOps uses it:
Reset developer access
Set passwords for test accounts
Update service account credentials
2.4 userdel — Delete User
Example:
sudo userdel ashish
Delete home directory too:
sudo userdel -r ashish

2.5 su — Switch User
Example:
su ashish
Switch to root:
su -

2.6 who — List Logged-In Users
who
Useful for multi-admin servers.
2.7 whoami — Current User
whoami

2.8 id — Show User Identity
Displays UID, GID, and group memberships.
Example:
id ashish

⭐ 3. Group Management
3.1 groupadd — Create Group
sudo groupadd devops
Used to group users by role.
3.2 gpasswd — Manage Group Membership
Add user to group:
sudo gpasswd -a ashish devops
Remove user:
sudo gpasswd -d ashish devops
Set multiple users:
sudo gpasswd -m user1,user2 devops

3.3 groupdel — Delete Group
sudo groupdel devops

⭐ 4. Permission Bits (rwx)
Linux permissions are shown like:
-rwxr-xr--

Breakdown:
Position
Meaning
1
file type (-, d, l)
2–4
owner permissions
5–7
group permissions
8–10
others permissions

rwx = read, write, execute

⭐ 5. chmod — Change Permissions
Definition:
Sets read/write/execute permissions.
5.1 Numeric (Octal) Notation
Value
Permission
4
read
2
write
1
execute

Examples:
chmod 755 script.sh
chmod 644 config.yaml
chmod 700 id_rsa

5.2 Symbolic Notation
chmod u+x script.sh
chmod g-w config.yaml
chmod o=r file

⭐ 6. chown — Change Owner
Example:
sudo chown ashish:devops file.txt
Only change user:
sudo chown ashish file.txt
Only change group:
sudo chown :devops file.txt

⭐ 7. chgrp — Change Group
sudo chgrp devops file.txt

⭐ 8. umask — Default Permissions
Definition: Controls default permissions for new files.
Example: umask 022

⭐ 9. Special Permissions (Advanced & Important)
These are used heavily in servers.
9.1 SUID (Set User ID)
Runs file with owner’s permissions.
chmod u+s /usr/bin/passwd

Used so normal users can change passwords.
9.2 SGID (Set Group ID)
Runs file with group’s permissions OR inherited group for directories.
chmod g+s /shared

Team shared folders use this.
9.3 Sticky Bit
Only file owner can delete files in a directory.
Used in /tmp.
chmod +t /tmp

⭐ 10. DevOps Use-Cases & Real Scenarios
➡️ 10.1 Shared Deployment Folder
sudo mkdir /var/www/app
sudo chown -R deploy:devops /var/www/app
sudo chmod -R 775 /var/www/app

➡️ 10.2 CI/CD Needs Permission to Restart Services
sudo usermod -aG systemd-cgls jenkins

➡️ 10.3 Give script execution permission
chmod +x deploy.sh

➡️ 10.4 Docker volume permission fix
sudo chown -R $USER:$USER /var/lib/docker/volumes

➡️ 10.5 Prevent developers from deleting each other's files
chmod +t /project/shared

📝 Linux for DevOps — Part 5
Process, Job & Service Management
By Ashish — Learn-in-Public DevOps Journey (Week 1)
📘 Table of Contents
✔ Understanding Linux Processes
✔ ps — View Processes
✔ top / htop — Real-Time Monitoring
✔ pgrep / pidof — Find Processes
✔ kill / pkill / killall — Terminate Processes
✔ nice & renice — CPU Priority Control
✔ jobs / bg / fg — Background & Foreground Jobs
✔ nohup — Run Commands After Logout
✔ systemctl — Manage Services (Super Important)
✔ Practical DevOps Scenarios
✔ Troubleshooting One-Liners

⭐ 1. What is a Process?
A process is a running program.
Every process has:
PID (Process ID)
PPID (Parent Process ID)
UID (User who started it)
State: running, sleeping, stopped, zombie
CPU & memory usage
Start time / elapsed time

Linux uses a hierarchical process tree:
systemd → parent for everything
├─ sshd
├─ nginx
├─ docker
└─ kubelet
Understanding processes is critical during:
Outages
High CPU/memory alerts
Crashes
Deployment issues
Network failures
Resource bottlenecks
⭐ 2. ps — View Running Processes
Definition:
Displays process information.
Why DevOps uses it:
Investigate memory leaks
Check running apps
Debug crashes
Search for failed processes
Audit whether a service is running
2.1 Basic process list
ps

2.2 Full process list
ps -ef
Shows:
PID
Parent PID
Start time
Command
2.3 Detailed metrics (CPU/MEM)
ps aux
Output includes:
%CPU
%MEM
TTY
COMMAND
2.4 Filter by process name
ps aux | grep nginx
DevOps uses this daily.
⭐ 3. top — Live Process Monitoring
Definition: Interactive real-time process viewer.
Use-Cases:
High CPU investigation
Memory inspection
Identify hung/stuck processes
Live debugging during traffic spikes
Run top:
top
Useful keys:
k → kill a process
r → renice
P → sort by CPU
M → sort by memory
q → quit
⭐ 4. htop — Enhanced top
Better UI, colors, CPU graphs.
htop

Why DevOps loves it:
Mouse support
Easy process killing
Clear CPU/memory visualization

(May require installation)
sudo apt install htop
⭐ 5. pgrep — Find PIDs by Name
Definition: Search for a process by name.
Example: pgrep nginx

Return:
List of PIDs running nginx.
⭐ 6. pidof — Return PID of Program
pidof sshd

Useful for automation scripts.
⭐ 7. kill — Terminate Process by PID
Definition: Sends signal to a process.
Graceful stop:
kill PID
Force kill (dangerous):
kill -9 PID
Used when:
Program hangs
Container stuck
Service unresponsive
⭐ 8. pkill — Kill by Process Name
Example:
pkill nginx
Kills all nginx processes.
⭐ 9. killall — Kill All Processes of a Specific Command
killall python

⭐ 10. nice — Start Process with Priority
Linux priorities range:
-20 = highest priority
0 = default
+19 = lowest priority

Start with low priority:
nice -n 10 python script.py

Useful for background tasks that shouldn’t slow the server.
⭐ 11. renice — Change Priority of Running Process
Example:
renice -n -5 -p 1234
Requires root for negative values
Used when a production process needs more CPU
⭐ 12. jobs — List Background Jobs
jobs

⭐ 13. bg — Resume Job in Background
bg %1
⭐ 14. fg — Bring Job to Foreground
fg %1

⭐ 15. nohup — Run Command After Logout
Definition:Runs command immune to terminal hangups.
Output saved to nohup.out.
Example:
nohup python server.py &
Case:
Running a process through SSH and you don't want it to stop when the connection closes.
⭐ 16. systemctl — Control System Services
(Most important command for DevOps)
Definition: Manages systemd services.

16.1 Start service
sudo systemctl start nginx

16.2 Stop service
sudo systemctl stop nginx

16.3 Restart service
sudo systemctl restart nginx

16.4 Check status
sudo systemctl status nginx

16.5 Enable service on boot
sudo systemctl enable docker

16.6 Disable service
sudo systemctl disable docker

⭐ 17. Troubleshooting One-Liners (Real DevOps Commands)
➡️ Find top CPU processes:
ps aux --sort=-%cpu | head

➡️ Find memory hogs:
ps aux --sort=-%mem | head

➡️ Kill all processes of a user:
pkill -u username

➡️ Check which process is using a port:
sudo lsof -i :8080

➡️ Restart service if it's down (manual check):
! systemctl is-active --quiet nginx && systemctl restart nginx

➡️ Find zombie processes:
ps aux | grep Z

➡️ Check uptime + load:
uptime

📝 Linux for DevOps — Part 6
System Monitoring & Performance Tools
By Ashish — Learn-in-Public DevOps Journey (Week 1)
📘 Table of Contents
✔ Disk Monitoring
df, du, lsblk, fdisk, mount, umount

✔ Memory Monitoring
free, vmstat,top (already covered), /proc/meminfo
✔ CPU & System Performance
uptime, vmstat, mpstat, iostat
✔ Kernel & Logs
dmesg, journalctl
✔ System Diagnostics
watch, nproc
✔ Real DevOps Scenarios
✔ Troubleshooting One-Liners
⭐ 1. Disk Monitoring Tools
1.1 df — Disk Free Space
Definition:
Shows filesystem disk usage.
Example:
df -h
Output includes:
Filesystem
Size
Used space
Available space
Mounted on
Flags:
-h # human readable
-T # show filesystem types
DevOps Use-Cases:
Debug “No space left on device” errors
Check container volume usage
Monitor production servers
1.2 du — Directory Space Usage
Definition:
Shows how much space a directory is using.
Example:
du -sh /var/log
Flags:
-s # summary
-h # human readable
DevOps Use-Cases:
Identify log-heavy folders
Clean up container image build folders
Debug sudden disk usage spikes
1.3 lsblk — List Block Devices
Definition:
Shows attached disks, partitions & mount points.
Example:
lsblk

Output shows:
Disk names
Size
Mount points
LVM volumes
DevOps Use-Cases:
Identify EBS volumes
Identify newly attached cloud disks
Read storage layout on nodes
1.4 fdisk -l — Disk Partition Table
Definition:
Displays partition details of disks.
Example:
sudo fdisk -l
DevOps Use-Cases:
Check disk type (MBR/GPT)
Validate attached volume from AWS/Azure/GCP
Prepare disk for formatting
1.5 mount — Mount Filesystem
Example:
sudo mount /dev/sdb1 /mnt

DevOps Use-Cases:
Mount ephemeral disks
Mount EBS or Azure disks
Mount Docker volumes
Mount NFS shared drives
1.6 umount — Unmount Filesystem
Example:
sudo umount /mnt

Notes:
Cannot unmount if directory is in use.
⭐ 2. Memory Monitoring Tools
2.1 free — System Memory Usage
Example:
free -h
Shows:
Total memory
Used / free
Buffer/cache
Swap
2.2 /proc/meminfo — Detailed Memory Stats
cat /proc/meminfo
Useful for Kubernetes node debugging.
2.3 vmstat — Virtual Memory Statistics
Example:
vmstat 1 5
Columns include:
Procs
Memory
Swap
IO
System
CPU
DevOps Use-Cases:
Investigate memory leaks
Analyze CPU wait time
Troubleshoot slow disk performance
⭐ 3. CPU & System Performance Tools
3.1 uptime — Load Average
Example:
uptime
Output:
21:10:21 up 10 days, 2:32, 2 users, load average: 0.45, 0.30, 0.25
Load average values represent:
last 1 minute
last 5 minutes
last 15 minutes
3.2 mpstat — CPU Usage Per Core
mpstat -P ALL 1
(Install via: sudo apt install sysstat)
Useful for:
Debugging CPU throttling
Multi-core performance issues
3.3 iostat — Disk IO Statistics
iostat -xz 1
Shows:
Disk read/write
IO wait
Utilization
⭐ 4. Kernel Logs & System Logs
4.1 dmesg — Kernel Messages
Example:
dmesg | tail
Use-Cases:
Disk attachment logs
USB failure logs
Kernel crashes
OOM (out of memory) events
4.2 journalctl — Systemd Logs
Example:
journalctl -u nginx
Flags:
-f # follow logs
-x # detailed info
DevOps Use-Cases:
Service boots
Service crashes
Authentication failures
Systemd service debugging

⭐ 5. Diagnostics & Utility Tools
5.1 watch — Repeat Command Continuously
Example:
watch -n 3 df -h
Updates every 3 seconds.
5.2 nproc — Number of CPU Cores
nproc
Used for:
Optimizing nginx workers
Docker resource tuning
CI/CD parallel jobs
⭐ 6. Real DevOps Scenarios (Critical)
➡️ 6.1 Disk is full — identify culprit
df -h
du -sh /* | sort -h
du -sh /var/* | sort -h

➡️ 6.2 High CPU — find top processes
ps aux --sort=-%cpu | head

➡️ 6.3 Memory leak — monitor live
watch -n 1 free -h

➡️ 6.4 Identify high IO usage
iostat -xz 1

➡️ 6.5 Kernel-level disk errors
dmesg | grep -i error

➡️ 6.6 Service troubleshooting
systemctl status nginx
journalctl -u nginx -f

⭐ 7. Troubleshooting One-Liners
Check uptime + load:
uptime

Find failed systemd services:
systemctl --failed

Identify biggest folders:
du -ah / | sort -h | tail

Check disk type:
lsblk -f

Find swap usage:
free -m | grep Swap

This is a critical article for your Hashnode audience, especially SRE & DevOps learners.

📝 Linux for DevOps — Part 7
Networking Commands (Complete Practical Guide + Real DevOps Debugging)
By Ashish — Learn-in-Public DevOps Journey (Week 1)
📘 Table of Contents
✔ Basics
Hostname, hostnamectl, ip, ifconfig, iwconfig,mac address
✔ Connectivity Tests
ping, traceroute, tracepath, mtr, curl, wget, telnet, nc
✔ Ports, Sockets, and Firewalls
ss, netstat, nmap, iptables, route, arp
✔ DNS Tools
dig, nslookup, host, whois
✔ Network Interface & IP Management
ip a, ip r, ip link, ifplugstatus
✔ Real DevOps Scenarios
✔ Troubleshooting One-Liners (Production-Grade)
⭐ 1. Host & Interface Identification
1.1 hostname — Show Hostname
Example:
hostname
Set hostname:
sudo hostname server-01

1.2 hostnamectl — Detailed System Identity
hostnamectl

Shows:
OS version
Kernel
Architecture
Machine name
⭐ 2. Interface & IP Address Commands
2.1 ip a — Show All Network Interfaces (Modern tool)
Example:
ip a

Shows:
All interfaces
IP addresses
MAC addresses
Operational state
Used 100x more than ifconfig in modern systems.
2.2 ifconfig — Legacy Interface Tool
ifconfig

Still used in:
Older servers
Some Docker containers
Network debugging tools
2.3 iwconfig — Wireless Config
iwconfig
Useful for laptops but not needed on cloud servers.
⭐ 3. Connectivity Testing Tools (Super Critical)
3.1 ping — Test Server Reachability
Example:
ping google.com
Use-Cases:
DNS working?
Server reachable?
Packet loss?
Latency check?
3.2 traceroute — Trace Hops to Destination
Example:
traceroute google.com

Used for:
Network path debugging
CDN routing issues
Cloud region traffic debugging
3.3 tracepath — Trace Without Root Privileges
tracepath google.com
Safer alternative.
3.4 mtr — Real-Time Traceroute + Ping (Combined)
mtr google.com

This is used heavily for debugging:
packet loss
network jitter
unstable cloud paths
⭐ 4. DNS Tools
4.1 dig — DNS Queries (Most Powerful)
Example:
dig google.com

Check full DNS chain:
dig +trace google.com

Check specific record:
dig A google.com
dig MX gmail.com
dig TXT domain.com

4.2 nslookup — Query DNS Records
nslookup google.com

4.3 whois — Domain Ownership Info
whois google.com

Useful for:
domain expirations
registrar details
⭐ 5. Ports, Sockets & Connections
5.1 ss — Socket Statistics (Modern & Fast)
Better than netstat.
Example:
ss -tulnp
Flags:
t → TCP
u → UDP
l → listening
n → numeric
p → process
Use-Cases:
Check if service is listening
Troubleshoot “port already in use”
Identify rogue processes

5.2 netstat — Legacy Socket Tool
netstat -tulnp

Still useful on older Linux.
5.3 nmap — Port Scanner
nmap
Use-cases:
Check open ports
Verify firewall rules
Security scanning
⭐ 6. HTTP/HTTPS & API Tools
6.1 curl — API & Endpoint Testing
Examples:
curl google.com
curl -I https://example.com
curl -X POST -d "a=1" https://api.com
Why DevOps uses it:
Test API health
Debug load balancers
Check SSL certificates
Validate domain routing
6.2 wget — File Download Tool
wget https://example.com/file.zip

⭐ 7. Debugging TCP/UDP & Connectivity
7.1 telnet — Check Port Connectivity (Old but Used)
telnet server 443
If it connects → port open.
7.2 nc (netcat) — Swiss Army Knife of Networking
Check if port open:
nc -zv server 22
Create simple server:
nc -l 8080
Transfer files:
nc -l 1234 > file.txt

⭐ 8. Routing & ARP Tables
8.1 route — Show Routing Table
route -n

8.2 ip r — Modern Routing Command
ip route
8.3 arp — MAC → IP Mapping
arp -a
Used to debug:
Local network
Duplicate IP issues
ARP poisoning checks
⭐ 9. Network Status & Interface Health
9.1 ifplugstatus — Cable Plug Status
ifplugstatus

Used for:
Bare metal servers
On-prem deployments
PXE boot debugging
⭐ 10. REAL-WORLD DEVOPS SCENARIOS
➡️ 10.1 Check if backend API reachable
curl -I http://backend:8080/health

➡️ 10.2 Debug Kubernetes Pod Networking
Inside pod:
curl http://service-name:8080
nslookup service-name

➡️ 10.3 Identify which process blocked a port
ss -tulnp | grep 8080

➡️ 10.4 Validate DNS routing
dig +trace domain.com

➡️ 10.5 Verify firewall allowing traffic
nc -zv server 443

➡️ 10.6 Check latency issues
mtr google.com

⭐ 11. TROUBLESHOOTING ONE-LINERS
Check open ports:
ss -tulnp

Check DNS poison:
dig domain.com @8.8.8.8

Check if port blocked by firewall:
iptables -L -n | grep 22

List all IPs of system:
ip -o -4 addr show | awk '{print $4}'

Test HTTPS certificate expiry:
echo | openssl s_client -servername domain.com -connect domain.com:443 | openssl x509 -noout -dates

📝 Linux for DevOps — Part 8
Disk, Filesystem & LVM Management (Complete Guide)
By Ashish — Learn-in-Public DevOps Journey (Week 1)
📘 Table of Contents
✔ Understanding Linux Storage Architecture
✔ Disk Information Commands
lsblk, fdisk, blkid, file, df, du
✔ Partitioning & Filesystems
fdisk, parted,mkfs, mount, umount
✔ LVM (Logical Volume Manager)
pvcreate, vgcreate, lvcreate, lvs / pvs / vgs, extend LV & Filesystem
✔ Swap Management
mkswap, swapon / swapoff
✔ Real DevOps Scenarios
✔ Troubleshooting One-Liners
⭐ 1. Understanding Linux Storage Architecture
Linux storage layers:
+----------------------------+
| Application (Nginx, DBs) |
+----------------------------+
| Filesystem (ext4, xfs) |
+----------------------------+
| Logical Volume (LV) |
+----------------------------+
| Volume Group (VG) |
+----------------------------+
| Physical Volume (PV) |
+----------------------------+
| Disk / Cloud Volume |
+----------------------------+

Cloud mapping:
Provider
Storage
AWS
EBS volumes
Azure
Managed Disks
GCP
Persistent Disks
K8s
PV/PVC

⭐ 2. Disk Information Commands
2.1 lsblk — List Block Devices
Definition:
Shows all disks, partitions, and LVM structures.
Example:
lsblk

Shows:
Disk name
Size
Type (disk/part/lvm)
Mount point
Why DevOps uses it:
After attaching EBS/Azure disks
Identify disk names (/dev/sda, /dev/nvme1n1)
Validate LVM structure
2.2 fdisk -l — List Partition Tables
sudo fdisk -l
Useful for:
Check if disk is formatted
Identify GPT or MBR
Inspect partition alignment
2.3 blkid — Show UUIDs & Filesystem Types
blkid

Used for:
/etc/fstab configuration
Mounting disks by UUID
Identifying filesystem: ext4/xfs/btrfs
2.4 file — Check File Type
file /dev/sdb
Can detect special block files.
2.5 df -h — Filesystem Disk Usage
df -h
Used for:
Out-of-disk emergencies
CI/CD cache filling
K8s node disk pressure
2.6 du -sh — Directory Space Usage
du -sh /var/log

Used to find large folders.
⭐ 3. Partitioning & Formatting Disks
3.1 Creating Partition using fdisk
Step-by-step:
sudo fdisk /dev/sdb

Inside fdisk:
Key
Meaning
n
create partition
p
print table
d
delete partition
w
write changes
q
quit

After partition:
lsblk

3.2 Formatting the Partition (mkfs)
Format as ext4:
sudo mkfs.ext4 /dev/sdb1

Format as XFS:
sudo mkfs.xfs /dev/sdb1

3.3 Mounting Filesystems
Temporary mount:
sudo mount /dev/sdb1 /mnt

Check:
df -h | grep /mnt

3.4 Unmounting
sudo umount /mnt

3.5 Persistent Mount (Permanent)
Add to /etc/fstab:
UUID= /data ext4 defaults 0 2

Get UUID:
blkid

⭐ 4. LVM — Logical Volume Manager (Production Standard)
LVM allows:
Resize disks without downtime
Combine multiple disks
Create flexible storage pools
⭐ 4.1 Step 1 — Create Physical Volume (PV)
sudo pvcreate /dev/sdb
Check:
pvs

⭐ 4.2 Step 2 — Create Volume Group (VG)
sudo vgcreate vg_data /dev/sdb
Check:
vgs

⭐ 4.3 Step 3 — Create Logical Volume (LV)
sudo lvcreate -L 10G -n lv_storage vg_data

Check:
lvs
⭐ 4.4 Step 4 — Create Filesystem on LV
sudo mkfs.ext4 /dev/vg_data/lv_storage

⭐ 4.5 Step 5 — Mount LV
sudo mount /dev/vg_data/lv_storage /mnt

⭐ 4.6 Extend Logical Volume (VERY IMPORTANT)
Extend LV:
sudo lvextend -L +5G /dev/vg_data/lv_storage
Resize filesystem (ext4):
sudo resize2fs /dev/vg_data/lv_storage
For XFS:
sudo xfs_growfs /mnt

⭐ 5. Swap Management
5.1 Create Swap
sudo mkswap /dev/sdb2

5.2 Enable Swap
sudo swapon /dev/sdb2

5.3 Disable Swap
sudo swapoff /dev/sdb2
Used during Kubernetes node tuning.
⭐ 6. Real DevOps Scenarios
➡️ 6.1 Attach & Configure AWS EBS Volume
lsblk
fdisk /dev/nvme1n1
mkfs.ext4 /dev/nvme1n1p1
mount /dev/nvme1n1p1 /data
➡️ 6.2 Expand disk on running server
AWS/GCP:
Increase disk size in console
Then on Linux:
sudo growpart /dev/sda 1
sudo resize2fs /dev/sda1

➡️ 6.3 LVM Expand live volume
pvcreate /dev/sdc
vgextend vg_data /dev/sdc
lvextend -l +100%FREE /dev/vg_data/lv_storage
resize2fs /dev/vg_data/lv_storage

➡️ 6.4 Find which folder filled the disk
du -sh /* | sort -h

➡️ 6.5 Unmount busy filesystem
lsof | grep /mnt

⭐ 7. Troubleshooting One-Liners
Check disk health:
dmesg | grep sdb

Show only mounted filesystems:
df -h | grep -v tmpfs

Check disk type:
lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINT

Check sector size:
sudo blockdev --getbsz /dev/sdb

Check IO wait:
iostat -xz 1

📝 Linux for DevOps — Part 9
Editors, Shell Scripting & Automation
By Ashish — Learn-in-Public DevOps Journey
📘 Table of Contents
✔ Editors
nano, vim (full cheatsheet)
✔ Shell Scripting Basics
What is a shell script?
Basic syntax
Comments
Variables
Input/output
Redirections
✔ Control Flow
if/else, case, loops (for / while / until)
✔ Functions
✔ Exit codes
✔ Error handling (set -e, set -x)
✔ Cron jobs
✔ Real DevOps Automation Examples

⭐ 1. Editors for DevOps
1.1 nano — Simple Editor
Definition: Beginner-friendly editor for modifying small config files.
Example:
nano app.conf

Common shortcuts:
Ctrl + O → save
Ctrl + X → exit
Ctrl + K → cut line
Ctrl + U → paste

DevOps Use:
Quick edits inside containers
Modifying environment files
Editing config files on SSH
1.2 vim — Most Important DevOps Editor
Vim is lightweight, always available, and perfect for editing files through SSH.
Modes:
Mode
Purpose
Normal
navigation + commands
Insert
editing text
Command
saving, quitting, search

Switch modes:
i → insert
Esc → normal
: → command
⭐ VIM COMMAND CHEATSHEET
Save & Quit:
:w
:wq
:q!
Navigation:
h j k l # left, down, up, right
0 # start of line
$ # end of line
gg # beginning of file
G # end of file
:n # go to line n

Editing:
x # delete char
dd # delete line
yy # copy
p # paste
u # undo
Ctrl+r # redo

Search:
/pattern
n
N

Replace:
:%s/old/new/g
Vim mastery = DevOps mastery.
⭐ 2. Shell Scripting Fundamentals
A shell script = a sequence of commands in a file executed by the Bash shell.
2.1 Create Script File
touch script.sh
chmod +x script.sh
nano script.sh

2.2 Basic Script Structure

!/bin/bash

echo "Hello from DevOps"

!/bin/bash → interpreter

Commands run line by line
Run it:
./script.sh

⭐ 3. Comments

This is a comment

⭐ 4. Variables
User-defined:
name="Ashish"
echo "Hello $name"
System variables:
echo $HOME
echo $USER
echo $PATH

⭐ 5. Input from User
read -p "Enter your name: " username
echo "Welcome $username"

⭐ 6. Output Redirection
echo "log entry" > file.txt # overwrite
echo "append entry" >> file.txt # append

⭐ 7. If-Else Conditions
if [ $age -ge 18 ]; then
echo "Adult"
else
echo "Minor"
fi

File checks:
if [ -f file.txt ]; then
echo "File exists"
fi

⭐ 8. Case Statement
read -p "Choose option: " opt

case $opt in
1) echo "Start service" ;;
2) echo "Stop service" ;;
*) echo "Invalid" ;;
esac

⭐ 9. Loops
9.1 For Loop
for i in {1..5}
do
echo "Number: $i"
done

9.2 While Loop
count=1
while [ $count -le 5 ]
do
echo "Loop $count"
count=$((count+1))
done

9.3 Until Loop
until [ $n -gt 5 ]
do
echo "n = $n"
n=$((n+1))
done

⭐ 10. Functions
deploy_app() {
echo "Deploying application..."
}

deploy_app

⭐ 11. Exit Codes
echo $? # shows exit code of last command

0 = success
Non-zero = error
⭐ 12. Script Debugging
Print each command:
set -x
Exit on error:
set -e
Combine:
set -xe
Used in CI/CD pipelines.
⭐ 13. Cron Jobs (Automation)
Edit cron tab:
crontab -e
Run script daily at midnight:
0 0 * * * /home/ashish/backup.sh

⭐ 14. REAL DEVOPS AUTOMATION SCRIPTS
➡️ 14.1 Cleanup old logs

!/bin/bash

find /var/log -type f -mtime +7 -delete

➡️ 14.2 Restart service on failure

!/bin/bash

if ! systemctl is-active --quiet nginx; then
systemctl restart nginx
fi

➡️ 14.3 Create user automatically

!/bin/bash

user=$1
sudo useradd -m $user
echo "$user created"

➡️ 14.4 Copy files to server (CI/CD)
rsync -avz build/ user@server:/var/www/app/

➡️ 14.5 Backup database

!/bin/bash

mysqldump -u root -p dbname > backup.sql

DevOps Quick Recipes & Troubleshooting Toolkit (Ultimate Guide)
By Ashish — Learn-in-Public DevOps Journey (Week 1)
📘 Table of Contents
✔ On-Call Survival Commands
✔ Log Debugging
✔ Disk Pressure & Out-of-Disk Errors
✔ Network Trouble Commands
✔ CPU/Memory Debugging
✔ Permission Issues
✔ Deployment & CI/CD Helpers
✔ SSH & Connectivity
✔ Docker / Container Debugging
✔ Must-Know One-Liners
⭐ 1. On-Call Survival Commands
These are the commands you will use when something breaks in production.
➡️ Check system load
uptime

➡️ Check which processes are eating CPU
ps aux --sort=-%cpu | head

➡️ Check which processes are eating RAM
ps aux --sort=-%mem | head

➡️ Check available memory
free -h

➡️ Live memory monitoring
watch -n 1 free -h

⭐ 2. Log Debugging (MOST IMPORTANT)
➡️ Tail logs live:
tail -f /var/log/syslog

➡️ Filter errors:
grep -i "error" /var/log/syslog

➡️ Filter warnings:
grep -i "warn" app.log

➡️ Watch Nginx access logs:
tail -f /var/log/nginx/access.log

➡️ Watch only failed nginx responses:
grep " 500 " access.log

⭐ 3. Disk Space & “No space left on device” Troubleshooting
➡️ Check disk usage:
df -h

➡️ Find biggest directories:
du -sh /* | sort -h | tail

➡️ Check /var/log size:
du -sh /var/log/*

➡️ Find largest files:
find / -type f -exec du -Sh {} + | sort -rh | head -n 20

➡️ Clear apt cache:
sudo apt autoremove
sudo apt clean

⭐ 4. Network Troubleshooting
➡️ Check connectivity:
ping google.com

➡️ Show local IPs:
ip a

➡️ Check DNS resolution:
dig google.com
nslookup google.com

➡️ Check which process is using port 80:
ss -tulnp | grep :80

➡️ Check routing table:
ip route

⭐ 5. CPU & Memory Troubleshooting
➡️ Check CPU usage live:
top

➡️ Check multi-core CPU usage:
mpstat -P ALL 1

➡️ Check disk IO pressure:
iostat -xz 1

⭐ 6. Permission Issues
➡️ Fix permission denied:
sudo chown -R $USER:$USER /path

➡️ Give execution permission:
chmod +x script.sh

➡️ Check file permissions:
ls -l file.txt

⭐ 7. Deployment & CI/CD Helpers
➡️ Sync build folder to server:
rsync -avz build/ user@server:/var/www/app/
➡️ Copy file to server:
scp -i key.pem file user@server:/path/
➡️ Restart service:
sudo systemctl restart nginx
➡️ Check service logs:
journalctl -u nginx -f
⭐ 8. SSH & Server Connectivity
➡️ Login into server:
ssh -i key.pem user@server
➡️ Test open port via nc:
nc -zv server 443
➡️ Keep process alive after logout:
nohup command &
⭐ 9. Docker/Container Troubleshooting
➡️ Check container logs:
docker logs container
➡️ Exec into container:
docker exec -it container bash
➡️ Check container IP:
docker inspect -f '{{ .NetworkSettings.IPAddress }}' container
➡️ Clean dangling images:
docker image prune -f
⭐ 10. Kubernetes-Specific Handy Commands (Bonus)
➡️ Check pod logs:
kubectl logs pod-name
➡️ Exec into pod:
kubectl exec -it pod -- bash
➡️ Check service endpoints:
kubectl get endpoints service
➡️ Debug DNS inside pod:
kubectl exec -it pod -- nslookup google.com
➡️ Check node resource usage:
kubectl top node
⭐ 11. Ultimate DevOps One-Liners
➡️ Restart crashed service:
! systemctl is-active --quiet app && systemctl restart app
➡️ Send alert if disk is > 90%:
df -h | awk '$5+0 > 90 {print $0}'
➡️ Extract top 10 IPs hitting server:
awk '{print $1}' access.log | sort | uniq -c | sort -nr | head
➡️ Check memory hogs:
ps aux --sort -rss | head
➡️ Find configs containing secret word:
grep -r "password" /etc

Thanks for Reading, Join Me on This DevOps Journey
Thank you for reading Linux for DevOps of my Learn-in-Public DevOps Series.
If you’re just starting your DevOps journey, or restarting it like I am, I hope these notes give you clarity, direction, and confidence.
I’m documenting everything openly so we can grow together, step by step.
If this helped you, follow along — I’ll publish the next part soon.
Let’s build a strong DevOps foundation, one skill at a time.
Linkedin Profile: https://www.linkedin.com/in/ashish360/

Top comments (0)