Goal: āĻāĻāĻĻāĻŽ raw level āĻĨā§āĻā§ Linux āĻļāĻŋāĻā§ DevOps/SRE/Cloud/Kubernetes āĻāĻžāĻā§āϰ āĻāύā§āϝ production-ready foundation āϤā§āϰāĻŋ āĻāϰāĻžāĨ¤
đ Table of Contents
- Linux āĻā§?
- Linux Architecture
- Linux Distribution
- Terminal & Shell
- Filesystem
- Essential Commands
- File & Directory Management
- File Permissions
- Users & Groups
- Ownership
- Processes
- Jobs & Signals
- System Monitoring
- Package Management
- Environment Variables
- Shell & Bash
- Pipes & Redirection
- grep, sed, awk
- Networking
- Ports & Sockets
- DNS
- SSH
- SCP & Rsync
- File Compression
- Disk & Storage
- Mounting
-
/proc,/sys,/dev - systemd & Services
- Logs & journald
- Cron & Scheduling
- Linux Security
- Firewall
- TLS/SSL Basics
- Web Server Basics
- Reverse Proxy
- Linux for Docker
- Linux for Kubernetes
- Performance Troubleshooting
- Production Troubleshooting
- Bash Automation
- DevOps Practical Tasks
- Interview Questions
- Scenario-Based Interview
- Hands-on Projects
- Final Checklist
1. Linux āĻā§?
Linux āĻāĻāĻāĻŋ open-source Unix-like operating system kernelāĨ¤
Linux system āϏāĻžāϧāĻžāϰāĻŖāϤ:
User
â
Shell
â
System Calls
â
Linux Kernel
â
Hardware
Linux āĻā§āύ DevOps-āĻ āĻā§āϰā§āϤā§āĻŦāĻĒā§āϰā§āĻŖ?
āĻŦā§āĻļāĻŋāϰāĻāĻžāĻ:
- Cloud server
- Web server
- Docker container
- Kubernetes node
- CI/CD runner
- Database server
- Monitoring server
- Production infrastructure
Linux-āĻāϰ āĻāĻĒāϰ āĻāϞā§āĨ¤
āϤāĻžāĻ DevOps engineer-āĻāϰ āĻāύā§āϝ Linux āĻšāϞ⧠foundational skillāĨ¤
2. Linux Architecture
Basic architecture:
+-------------------------+
| Applications |
+-------------------------+
| Shell |
+-------------------------+
| System Libraries |
+-------------------------+
| Linux Kernel |
+-------------------------+
| Hardware |
+-------------------------+
Kernel
Kernel manage āĻāϰā§:
- CPU
- Memory
- Processes
- Filesystem
- Networking
- Devices
- Security
3. Linux Distribution
āĻāύāĻĒā§āϰāĻŋā§ distributions:
Ubuntu
Debian
Fedora
RHEL
Rocky Linux
AlmaLinux
Arch Linux
Amazon Linux
DevOps-āĻ āĻŦāĻŋāĻļā§āώāĻāĻžāĻŦā§:
Ubuntu
Amazon Linux
RHEL-based systems
Debian
āĻāĻžāύāĻž usefulāĨ¤
4. Terminal & Shell
Terminal āĻšāϞ⧠interface āϝā§āĻāĻžāύ⧠command āĻāĻžāϞāĻžāύ⧠āĻšā§āĨ¤
Shell command interpret āĻāϰā§āĨ¤
Popular shells:
bash
zsh
fish
sh
DevOps-āĻāϰ āĻāύā§āϝ Bash āĻ āĻŦāĻļā§āϝāĻ āĻļāĻŋāĻāϤ⧠āĻšāĻŦā§āĨ¤
Check:
echo $SHELL
Current shell:
ps -p $$
5. Linux Filesystem
Linux filesystem tree:
/
âââ bin
âââ boot
âââ dev
âââ etc
âââ home
âââ lib
âââ opt
âââ proc
âââ root
âââ run
âââ sbin
âââ srv
âââ sys
âââ tmp
âââ usr
âââ var
āĻā§āϰā§āϤā§āĻŦāĻĒā§āϰā§āĻŖ directories
/
Root filesystemāĨ¤
/home
User filesāĨ¤
/home/ragib
/etc
System configurationāĨ¤
Examples:
/etc/hosts
/etc/fstab
/etc/ssh/
/etc/systemd/
/var
Frequently changing dataāĨ¤
Examples:
/var/log
/var/cache
/var/lib
/tmp
Temporary filesāĨ¤
/usr
Applications, libraries, utilitiesāĨ¤
/opt
Optional/third-party applicationsāĨ¤
/dev
Device filesāĨ¤
/proc
Kernel/process informationāĨ¤
/sys
Kernel/device informationāĨ¤
6. Navigation Commands
Current directory:
pwd
List:
ls
Detailed:
ls -l
Hidden:
ls -la
Change directory:
cd /etc
Home:
cd ~
Previous directory:
cd -
Parent:
cd ..
7. File Management
Create file:
touch app.log
Create directory:
mkdir project
Nested directories:
mkdir -p project/src/app
Copy:
cp file.txt backup.txt
Copy directory:
cp -r project backup/
Move:
mv file.txt /tmp/
Rename:
mv old.txt new.txt
Delete:
rm file.txt
Delete directory:
rm -r directory/
Force:
rm -rf directory/
â ī¸
rm -rfproduction server-āĻ āĻ āϤā§āϝāύā§āϤ āϏāϤāϰā§āĻāϤāĻžāϰ āϏāĻžāĻĨā§ āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻāϰāϤ⧠āĻšāĻŦā§āĨ¤
8. Reading Files
Small file:
cat file.txt
Large file:
less file.txt
First lines:
head file.txt
Last lines:
tail file.txt
Last 100:
tail -n 100 app.log
Follow log:
tail -f app.log
9. Searching Files
Find:
find /var/log -name "*.log"
Search by type:
find . -type f
Search directory:
find . -type d
Search recently modified:
find . -mtime -1
10. grep
Text search:
grep "error" app.log
Case insensitive:
grep -i "error" app.log
Recursive:
grep -r "database" /etc/
Line number:
grep -n "error" app.log
Invert match:
grep -v "INFO" app.log
Multiple patterns:
grep -E "error|failed|critical" app.log
11. Pipes
Pipe āĻāĻāĻāĻŋ command-āĻāϰ output āĻ
āύā§āϝ command-āĻāϰ input āĻšāĻŋāϏā§āĻŦā§ āĻĻā§ā§āĨ¤
ps aux | grep nginx
Example:
cat app.log | grep ERROR
Better:
grep ERROR app.log
Multiple:
ps aux | grep python | grep -v grep
12. Redirection
Output file:
ls > files.txt
Append:
ls >> files.txt
Error redirect:
command 2> error.log
Both stdout + stderr:
command > output.log 2>&1
Modern Bash:
command &> output.log
13. Permissions
Linux permission:
r = read
w = write
x = execute
Example:
-rwxr-xr--
Breakdown:
Owner Group Others
rwx r-x r--
Numeric permissions:
r = 4
w = 2
x = 1
Examples:
7 = rwx
6 = rw-
5 = r-x
4 = r--
Therefore:
chmod 755 script.sh
Means:
Owner: rwx
Group: r-x
Others: r-x
14. chmod
Add execute:
chmod +x script.sh
Remove write:
chmod -w file.txt
Recursive:
chmod -R 755 directory/
Symbolic:
chmod u+x script.sh
15. chown
Change owner:
sudo chown user file.txt
Owner + group:
sudo chown user:group file.txt
Recursive:
sudo chown -R user:group directory/
16. Users
Current user:
whoami
User ID:
id
Logged-in users:
who
User information:
/etc/passwd
Password information:
/etc/shadow
/etc/shadowsensitive; normally readable only by privileged users.
17. Groups
Current groups:
groups
Add user:
sudo useradd -m devops
Set password:
sudo passwd devops
Add to group:
sudo usermod -aG docker devops
List groups:
getent group
18. sudo
sudo allows authorized users to execute commands with elevated privileges.
Example:
sudo systemctl restart nginx
Configuration:
/etc/sudoers
Edit safely:
sudo visudo
19. Processes
List processes:
ps
All processes:
ps aux
Tree:
pstree
Interactive:
top
Better interactive monitor:
htop
20. Process IDs
Every process has PID.
ps aux
Find process:
pgrep nginx
Process details:
ps -p 1234
21. kill
Terminate:
kill 1234
Force:
kill -9 1234
Important signals:
SIGTERM = 15
SIGKILL = 9
SIGHUP = 1
SIGINT = 2
Prefer:
kill PID
before:
kill -9 PID
because SIGTERM allows graceful shutdownāĨ¤
22. Background Processes
Run background:
command &
Jobs:
jobs
Bring foreground:
fg
Background:
bg
Detach process:
nohup command &
23. System Monitoring
CPU:
top
Memory:
free -h
Disk:
df -h
Directory size:
du -sh directory/
Load average:
uptime
System information:
uname -a
CPU:
lscpu
Memory:
free -h
24. Load Average
Check:
uptime
Example:
load average: 1.20, 0.80, 0.50
āĻāĻā§āϞ⧠āϏāĻžāϧāĻžāϰāĻŖāϤ:
1 minute
5 minutes
15 minutes
load averageāĨ¤
Interview-āĻ āĻŽāύ⧠āϰāĻžāĻāĻŦā§:
Load average āĻļā§āϧ⧠CPU utilization āύā§; runnable āĻāĻŦāĻ āĻāĻŋāĻā§ āĻā§āώā§āϤā§āϰ⧠uninterruptible tasks-āĻāϰ āĻāĻžāĻĒāĻ reflect āĻāϰāϤ⧠āĻĒāĻžāϰā§āĨ¤
25. Package Management
Ubuntu/Debian:
sudo apt update
sudo apt install nginx
sudo apt remove nginx
RHEL/Fedora:
dnf install nginx
Arch:
sudo pacman -S nginx
Package query:
pacman -Qs nginx
DevOps engineer-āĻāϰ āĻāύā§āϝ distribution āĻ āύā§āϝāĻžā§ā§ package manager āĻāĻžāύāĻž usefulāĨ¤
26. Environment Variables
Show:
env
Specific:
echo $PATH
Set:
export APP_ENV=production
Check:
echo $APP_ENV
Permanent shell variable āϏāĻžāϧāĻžāϰāĻŖāϤ:
~/.bashrc
~/.zshrc
server/application configuration-āĻāϰ āĻā§āώā§āϤā§āϰ⧠environment variables āĻā§āĻŦ āĻā§āϰā§āϤā§āĻŦāĻĒā§āϰā§āĻŖāĨ¤
27. PATH
Check:
echo $PATH
āĻā§āύ executable āĻā§āĻĨāĻžā§:
which python
āĻāϰāĻ reliable:
command -v python
PATH-āĻāϰ āĻĒā§āϰāϤāĻŋāĻāĻŋ directory:
echo $PATH | tr ':' '\n'
28. Bash Scripting
Basic:
#!/bin/bash
echo "Hello DevOps"
Variable:
NAME="DevOps"
echo "$NAME"
Condition:
if [ -f app.log ]; then
echo "File exists"
fi
Loop:
for file in *.log; do
echo "$file"
done
Function:
backup() {
echo "Running backup"
}
29. Exit Codes
āĻļā§āώ command-āĻāϰ exit code:
echo $?
Generally:
0 = success
non-zero = failure
Script:
command
if [ $? -ne 0 ]; then
echo "Command failed"
fi
Better:
if ! command; then
echo "Failed"
fi
Production scripts:
set -euo pipefail
āĻāϰ meaning āĻŦā§āĻāϤ⧠āĻšāĻŦā§āĨ¤
30. awk
Column processing:
awk '{print $1}' file.txt
Example:
ps aux | awk '{print $1, $2}'
Useful for:
- logs
- metrics
- CSV-like text
- command output
31. sed
Text replacement:
sed 's/old/new/g' file.txt
Delete line:
sed '3d' file.txt
Configuration automation-āĻ sed frequently āĻĻā§āĻāĻž āϝāĻžā§āĨ¤
32. cut
echo "devops:linux:docker" | cut -d ':' -f 1
Output:
devops
33. sort
sort file.txt
Reverse:
sort -r file.txt
Numeric:
sort -n numbers.txt
34. uniq
sort file.txt | uniq
Count:
sort file.txt | uniq -c
35. Networking Fundamentals
DevOps-āĻāϰ āĻāύā§āϝ networking āĻ āĻŦāĻļā§āϝāĻ āĻāĻžāύāϤ⧠āĻšāĻŦā§āĨ¤
āĻļāĻŋāĻāϤ⧠āĻšāĻŦā§:
IP
MAC
TCP
UDP
HTTP
HTTPS
DNS
DHCP
NAT
Routing
Ports
Sockets
Firewall
36. IP Address
IPv4 example:
192.168.1.10
Private ranges:
10.0.0.0/8
172.16.0.0/12
192.168.0.0/16
Interface:
ip addr
Short:
ip a
37. Routing
Routes:
ip route
Default route:
default via 192.168.1.1
Important interview concept:
Default gateway āĻšāϞ⧠āĻāĻŽāύ router āϝā§āĻāĻžāύ⧠system unknown destinations-āĻāϰ traffic āĻĒāĻžāĻ āĻžā§āĨ¤
38. Connectivity
Ping:
ping google.com
Trace:
traceroute google.com
āĻŦāĻž:
tracepath google.com
39. Ports
Listening ports:
ss -tulpn
Specific port:
ss -lntp | grep :8000
Common ports:
22 SSH
53 DNS
80 HTTP
443 HTTPS
3306 MySQL
5432 PostgreSQL
6379 Redis
8000 FastAPI
8080 Common HTTP alternative
40. DNS
DNS domain â IP resolve āĻāϰā§āĨ¤
Check:
dig google.com
āĻŦāĻž:
nslookup google.com
Simple:
getent hosts google.com
DNS configuration:
/etc/resolv.conf
Hosts:
/etc/hosts
41. curl
HTTP request:
curl https://example.com
Headers:
curl -I https://example.com
POST:
curl -X POST \
-H "Content-Type: application/json" \
-d '{"name":"Ragib"}' \
http://localhost:8000/predict
DevOps troubleshooting-āĻāϰ āĻāύā§āϝ curl āĻ
āϤā§āϝāύā§āϤ āĻā§āϰā§āϤā§āĻŦāĻĒā§āϰā§āĻŖāĨ¤
42. wget
Download:
wget https://example.com/file.zip
43. SSH
Remote server access:
ssh user@server-ip
Specific key:
ssh -i key.pem user@server-ip
SSH config:
~/.ssh/config
44. SSH Keys
Generate:
ssh-keygen -t ed25519
Public key:
~/.ssh/id_ed25519.pub
Private key:
~/.ssh/id_ed25519
Private key āĻāĻāύ⧠share āĻŦāĻž Git repository-āϤ⧠commit āĻāϰāĻž āϝāĻžāĻŦā§ āύāĻžāĨ¤
45. SCP
Copy local â remote:
scp file.txt user@server:/tmp/
Remote â local:
scp user@server:/tmp/file.txt .
46. rsync
Efficient synchronization:
rsync -av project/ server:/backup/project/
Delete destination extras:
rsync -av --delete source/ destination/
Production backup/deployment workflows-āĻ usefulāĨ¤
47. Compression
tar:
tar -cvf archive.tar directory/
Extract:
tar -xvf archive.tar
gzip:
tar -czvf archive.tar.gz directory/
Extract:
tar -xzvf archive.tar.gz
48. Disk Management
Disk usage:
df -h
Directory:
du -sh /var/*
Block devices:
lsblk
Partitions:
sudo fdisk -l
49. Mount
Mount filesystem:
sudo mount /dev/sdb1 /mnt
Unmount:
sudo umount /mnt
Persistent mounts:
/etc/fstab
50. Inodes
Filesystem āĻļā§āϧ⧠file size āĻĻāĻŋā§ā§ manage āĻāϰ⧠āύāĻž; inode-āĻ āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻāϰā§āĨ¤
Check:
df -i
Possible problem:
Disk space available
BUT
Inodes exhausted
āϤāĻāύ āύāϤā§āύ file āϤā§āϰāĻŋ āĻāϰāϤ⧠āϏāĻŽāϏā§āϝāĻž āĻšāϤ⧠āĻĒāĻžāϰā§āĨ¤
51. /proc
/proc virtual filesystemāĨ¤
Process:
/proc/<PID>/
CPU:
/proc/cpuinfo
Memory:
/proc/meminfo
Uptime:
/proc/uptime
52. /dev
Device filesāĨ¤
Examples:
/dev/sda
/dev/nvme0n1
/dev/null
/dev/zero
/dev/null:
command > /dev/null
53. /dev/null
Anything written āĻāĻāĻžāύ⧠discard āĻšā§āĨ¤
echo "hello" > /dev/null
Suppress output:
command > /dev/null 2>&1
54. systemd
Modern Linux systems-āĻ systemd service manager āĻšāĻŋāϏā§āĻŦā§ āĻŦā§āϝāĻŦāĻšā§āϤ āĻšā§āĨ¤
Service status:
systemctl status nginx
Start:
sudo systemctl start nginx
Stop:
sudo systemctl stop nginx
Restart:
sudo systemctl restart nginx
Enable on boot:
sudo systemctl enable nginx
Disable:
sudo systemctl disable nginx
55. systemd Logs
journalctl
Specific service:
journalctl -u nginx
Follow:
journalctl -u nginx -f
Recent:
journalctl --since "1 hour ago"
Boot logs:
journalctl -b
56. Linux Logs
Common location:
/var/log/
Examples:
/var/log/syslog
/var/log/auth.log
/var/log/nginx/
Distribution āĻ āύā§āϝāĻžā§ā§ filenames āĻāĻŋāύā§āύ āĻšāϤ⧠āĻĒāĻžāϰā§āĨ¤
57. Log Rotation
Long-running production systems-āĻ logs unlimited growth āĻāϰāϞ⧠disk full āĻšāϤ⧠āĻĒāĻžāϰā§āĨ¤
Concepts:
logrotate
rotation
compression
retention
Configuration:
/etc/logrotate.conf
/etc/logrotate.d/
58. Cron
Scheduled jobsāĨ¤
Edit:
crontab -e
Format:
minute hour day month weekday command
Example:
0 2 * * * /home/user/backup.sh
āĻŽāĻžāύ⧠āĻĒā§āϰāϤāĻŋāĻĻāĻŋāύ āϰāĻžāϤ ⧍āĻāĻžā§āĨ¤
59. Linux Security
Must know:
Users
Groups
Permissions
sudo
SSH
Firewall
SELinux/AppArmor
Secrets
Updates
Least privilege
60. Firewall
Common tools:
ufw
firewalld
nftables
iptables
Ubuntu example:
sudo ufw status
Allow SSH:
sudo ufw allow 22
Allow HTTP:
sudo ufw allow 80
61. SELinux / AppArmor
Linux security frameworksāĨ¤
Know the concepts:
Mandatory Access Control
Policies
Security Context
Least Privilege
RHEL ecosystem-āĻ SELinux āĻā§āϰā§āϤā§āĻŦāĻĒā§āϰā§āĻŖāĨ¤
Ubuntu-āϤ⧠AppArmor commonly āĻĻā§āĻāĻž āϝāĻžā§āĨ¤
62. Web Server Basics
Popular:
Nginx
Apache
Nginx can act as:
Web Server
Reverse Proxy
Load Balancer
TLS Termination
63. Reverse Proxy
Architecture:
Client
â
Nginx
â
FastAPI
â
ML Model
Nginx backend-āĻāϰ āϏāĻžāĻŽāύ⧠āĻĨāĻžāĻā§āĨ¤
Benefits:
- TLS termination
- routing
- load balancing
- buffering
- security controls
64. Linux + Docker
Docker Linux-āĻāϰ āύāĻŋāĻā§āϰ āĻ
āύā§āĻ core concept āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻāϰā§:
Namespaces
cgroups
filesystem layers
networking
process isolation
capabilities
āϤāĻžāĻ Docker āĻļā§āĻāĻžāϰ āĻāĻā§ Linux fundamentals āĻļāĻā§āϤ āĻšāĻā§āĻž āĻā§āĻŦ usefulāĨ¤
65. Docker-āĻāϰ āĻāύā§āϝ Linux Knowledge
āĻŦāĻŋāĻļā§āώāĻāĻžāĻŦā§ āĻāĻžāύāϤ⧠āĻšāĻŦā§:
- Process
- PID
- Namespace
- cgroups
- Filesystem
- permissions
- networking
- ports
- mounts
- signals
Container-āĻāϰ āĻāĻŋāϤāϰā§āϰ process āϏāĻžāϧāĻžāϰāĻŖāϤ host-āĻāϰ kernel āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻāϰā§āĨ¤
66. Linux + Kubernetes
Kubernetes node troubleshooting-āĻāϰ āĻāύā§āϝ:
ps
top
free
df
du
ss
ip
journalctl
systemctl
curl
grep
āĻā§āĻŦ āĻāĻžāϞā§āĻāĻžāĻŦā§ āĻāĻžāύāϤ⧠āĻšāĻŦā§āĨ¤
67. Kubernetes Troubleshooting Example
Pod:
CrashLoopBackOff
āϤāĻāύ:
kubectl logs pod-name
kubectl describe pod pod-name
āĻāĻŋāύā§āϤ⧠underlying node problem āĻšāϞ⧠Linux:
journalctl
df -h
free -h
top
systemctl
āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻāϰāϤ⧠āĻšāĻŦā§āĨ¤
68. CPU Troubleshooting
Problem:
CPU = 100%
Check:
top
āĻŦāĻž:
htop
Process:
ps aux --sort=-%cpu | head
āϤāĻžāϰāĻĒāϰ determine āĻāϰāϤ⧠āĻšāĻŦā§:
Which process?
Why?
Application issue?
Infinite loop?
Too much traffic?
CPU throttling?
69. Memory Troubleshooting
Check:
free -h
Processes:
ps aux --sort=-%mem | head
OOM-related logs:
dmesg | grep -i oom
āĻŦāĻž:
journalctl | grep -i oom
70. Disk Full Troubleshooting
āĻĒā§āϰāĻĨāĻŽ:
df -h
āϤāĻžāϰāĻĒāϰ:
du -sh /*
Specific:
du -sh /var/*
Large files:
find /var -type f -size +1G
Check inode:
df -i
Potential causes:
Huge logs
Docker images
Docker volumes
Deleted-but-open files
Temporary files
Backups
71. Deleted File Still Using Disk
āĻāĻāĻāĻŋ process file delete āĻāϰāĻžāϰ āĻĒāϰā§āĻ file descriptor open āϰāĻžāĻāϤ⧠āĻĒāĻžāϰā§āĨ¤
Check:
lsof +L1
āĻāĻāĻž production troubleshooting interview-āĻ useful scenarioāĨ¤
72. Port Already in Use
Error:
Address already in use
Check:
ss -lntp | grep :8000
āĻŦāĻž:
lsof -i :8000
Process identify āĻāϰ⧠graceful stop āĻāϰāϤ⧠āĻšāĻŦā§āĨ¤
73. Service Not Starting
āϧāĻžāĻĒ:
systemctl status service
āϤāĻžāϰāĻĒāϰ:
journalctl -u service
āϤāĻžāϰāĻĒāϰ:
systemctl cat service
āϤāĻžāϰāĻĒāϰ configuration validateāĨ¤
74. Server Reachable āĻāĻŋāύā§āϤ⧠Website āĻāĻžāĻ āĻāϰāĻā§ āύāĻž
Layer-by-layer troubleshoot:
1. DNS
2. Network
3. Port
4. Firewall
5. Web server
6. Reverse proxy
7. Application
8. Database
Commands:
dig domain.com
ping server
ss -lntp
curl localhost
curl backend:8000
75. HTTP Status Codes
Must know:
200 OK
201 Created
204 No Content
301/302 Redirect
400 Bad Request
401 Unauthorized
403 Forbidden
404 Not Found
405 Method Not Allowed
408 Request Timeout
409 Conflict
429 Too Many Requests
500 Internal Server Error
502 Bad Gateway
503 Service Unavailable
504 Gateway Timeout
76. 502 vs 503 vs 504
502 Bad Gateway
Proxy backend āĻĨā§āĻā§ valid response āĻĒāĻžā§āύāĻŋāĨ¤
503 Service Unavailable
Service available āύ⧠āĻŦāĻž overloaded āĻšāϤ⧠āĻĒāĻžāϰā§āĨ¤
504 Gateway Timeout
Upstream response āĻĻāĻŋāϤ⧠āĻŦā§āĻļāĻŋ āϏāĻŽā§ āύāĻŋā§ā§āĻā§āĨ¤
DevOps interview-āĻ āĻāĻā§āϞā§āϰ āĻĒāĻžāϰā§āĻĨāĻā§āϝ āĻāĻžāύāĻž āĻā§āϰā§āϤā§āĻŦāĻĒā§āϰā§āĻŖāĨ¤
77. TCP vs UDP
TCP
- Connection-oriented
- Reliable
- Ordered
- Retransmission
UDP
- Connectionless
- Lower overhead
- No guaranteed delivery
- Faster for suitable workloads
Examples:
TCP â HTTP/HTTPS, SSH
UDP â DNS queries commonly, streaming/real-time workloads
78. TCP Connection States
Know:
LISTEN
SYN-SENT
SYN-RECEIVED
ESTABLISHED
FIN-WAIT
TIME-WAIT
CLOSE-WAIT
Check:
ss -tan
79. TIME_WAIT
Connection close āĻšāĻā§āĻžāϰ āĻĒāϰ TCP āĻāĻŋāĻā§ āϏāĻŽā§ state āϧāϰ⧠āϰāĻžāĻā§ āϝāĻžāϤ⧠delayed packets āϏāĻŽāϏā§āϝāĻž āύāĻž āĻāϰā§āĨ¤
High traffic systems-āĻ āĻ āύā§āĻ TIME_WAIT āĻĻā§āĻāĻž āϝā§āϤ⧠āĻĒāĻžāϰā§āĨ¤
Interview-āĻ āĻļā§āϧ⧠âTIME_WAIT is badâ āĻŦāϞāĻž āĻā§āϞāĨ¤
80. File Descriptors
Linux-āĻ process files, sockets āĻāϤā§āϝāĻžāĻĻāĻŋ file descriptors āĻšāĻŋāϏā§āĻŦā§ handle āĻāϰā§āĨ¤
Check limits:
ulimit -n
Process open files:
lsof -p PID
81. Hard Link vs Soft Link
Soft link:
ln -s original.txt link.txt
Hard link:
ln original.txt hardlink.txt
Soft link
- āĻāϞāĻžāĻĻāĻž inode
- target-āĻāϰ path reference āĻāϰā§
- target delete āĻšāϞ⧠broken āĻšāϤ⧠āĻĒāĻžāϰā§
Hard link
- āĻāĻāĻ inode
- āĻāĻāĻ filesystem-āĻāϰ āĻŽāϧā§āϝ⧠āϏāĻžāϧāĻžāϰāĻŖāϤ
- original filename delete āĻšāϞā§āĻ data āĻĨāĻžāĻāϤ⧠āĻĒāĻžāϰā§
82. Symbolic Links in DevOps
Common examples:
/etc/nginx/sites-enabled/
Configuration management āĻāĻŦāĻ system files-āĻ symbolic links āĻĻā§āĻāϤ⧠āĻĒāĻžāĻŦā§āĨ¤
83. Process vs Thread
Process
Independent execution contextāĨ¤
Thread
āĻāĻāĻ process-āĻāϰ āĻŽāϧā§āϝ⧠execution unitāĨ¤
Threads āϏāĻžāϧāĻžāϰāĻŖāϤ āĻāĻāĻ process-āĻāϰ memory share āĻāϰā§āĨ¤
84. Zombie Process
Parent process child-āĻāϰ exit status collect āύāĻž āĻāϰāϞ⧠zombie process āĻšāϤ⧠āĻĒāĻžāϰā§āĨ¤
Check:
ps aux | grep Z
Zombie kill āĻāϰāĻžāϰ āĻŦāĻĻāϞ⧠āϏāĻžāϧāĻžāϰāĻŖāϤ parent process-āĻāϰ issue investigate āĻāϰāϤ⧠āĻšā§āĨ¤
85. Orphan Process
Parent process terminate āĻšāϞ⧠child orphan āĻšāϤ⧠āĻĒāĻžāϰ⧠āĻāĻŦāĻ system-āĻāϰ init/systemd process āϤāĻžāĻā§ adopt āĻāϰāϤ⧠āĻĒāĻžāϰā§āĨ¤
86. Context Switching
CPU āĻāĻ execution context āĻĨā§āĻā§ āĻ āύā§āϝāĻāĻŋāϤ⧠switch āĻāϰā§āĨ¤
Too many processes/threads context-switch overhead āϤā§āϰāĻŋ āĻāϰāϤ⧠āĻĒāĻžāϰā§āĨ¤
Tools:
vmstat
pidstat
87. vmstat
vmstat 1
Useful for:
CPU
memory
swap
processes
I/O
context switching
88. iostat
Disk I/O troubleshooting:
iostat
Useful metrics:
IOPS
throughput
utilization
latency
89. sar
Historical/current system performance statistics-āĻāϰ āĻāύā§āϝ usefulāĨ¤
sar
CPU:
sar -u
Memory:
sar -r
Network:
sar -n DEV
90. Network Troubleshooting Toolkit
Must know:
ip
ss
ping
traceroute
tracepath
dig
nslookup
curl
wget
nc
tcpdump
91. netcat
Port testing:
nc -zv server 8000
Useful for checking TCP connectivityāĨ¤
92. tcpdump
Packet capture:
sudo tcpdump -i any port 8000
HTTP traffic investigation:
sudo tcpdump -i any host 10.0.0.5
Advanced networking troubleshooting-āĻāϰ āĻāύā§āϝ āĻā§āϰā§āϤā§āĻŦāĻĒā§āϰā§āĻŖāĨ¤
93. Linux Security Checklist
Production server:
[ ] Disable unnecessary services
[ ] Use SSH keys
[ ] Avoid root login
[ ] Use least privilege
[ ] Keep packages updated
[ ] Configure firewall
[ ] Protect secrets
[ ] Monitor logs
[ ] Rotate credentials
[ ] Backup critical data
94. DevOps-āĻ Linux-āĻāϰ āϏāĻŦāĻā§ā§ā§ āĻā§āϰā§āϤā§āĻŦāĻĒā§āϰā§āĻŖ Commands
āĻāĻ commandāĻā§āϞ⧠āĻŽā§āĻāϏā§āĻĨ āύāĻž āĻšāϞā§āĻ confidently āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻāϰāϤ⧠āĻĒāĻžāϰāϤ⧠āĻšāĻŦā§:
pwd
ls
cd
cp
mv
rm
mkdir
touch
cat
less
head
tail
grep
find
awk
sed
cut
sort
uniq
chmod
chown
sudo
ps
top
htop
kill
pkill
pgrep
free
df
du
lsblk
mount
ip
ss
ping
curl
wget
dig
nc
tcpdump
ssh
scp
rsync
tar
systemctl
journalctl
crontab
lsof
uname
uptime
95. Production Troubleshooting Method
āĻāĻāύ⧠random command āĻāĻžāϞāĻžāύ⧠āĻāĻāĻŋāϤ āύā§āĨ¤
āĻāĻ framework follow āĻāϰāĻŦā§:
1. Identify the symptom
â
2. Determine scope
â
3. Check recent changes
â
4. Check logs
â
5. Check metrics
â
6. Check resource usage
â
7. Check network
â
8. Reproduce if possible
â
9. Fix
â
10. Verify
â
11. Document
96. DevOps Incident Example
Problem
Application suddenly slowāĨ¤
Step 1
Check CPU:
top
Step 2
Memory:
free -h
Step 3
Disk:
df -h
Step 4
Network:
ss -s
Step 5
Application logs:
journalctl -u app
Step 6
Recent deployment:
What changed?
Step 7
Check upstream/database.
āĻāĻāĻžāĻŦā§ systematic troubleshooting āĻāϰāϤ⧠āĻšāĻŦā§āĨ¤
97. Linux + ML Inference Platform
āϤā§āĻŽāĻžāϰ ML inference project-āĻ Linux knowledge āϏāϰāĻžāϏāϰāĻŋ āϞāĻžāĻāĻŦā§āĨ¤
Architecture:
Linux Server
â
Docker
â
Kubernetes
â
FastAPI
â
ML Model
Troubleshooting:
High CPU
â
top
High memory
â
free / ps
Disk full
â
df / du
Port issue
â
ss
Service issue
â
systemctl / journalctl
Network issue
â
ip / ss / curl / dig
Container issue
â
docker logs / docker stats
98. Interview Preparation â Basic Questions
Q1. Linux āĻā§?
Linux āĻāĻāĻāĻŋ open-source Unix-like operating system kernel; Linux distributions kernel-āĻāϰ āϏāĻžāĻĨā§ user-space tools āĻ package ecosystem āĻĒā§āϰāĻĻāĻžāύ āĻāϰā§āĨ¤
Q2. Kernel āĻā§?
Kernel hardware āĻāĻŦāĻ applications-āĻāϰ āĻŽāϧā§āϝ⧠āĻĒā§āϰāϧāĻžāύ interface āĻšāĻŋāϏā§āĻŦā§ āĻāĻžāĻ āĻāϰ⧠āĻāĻŦāĻ CPU, memory, processes, devices āĻ networking-āĻāϰ āĻŽāϤ⧠resources manage āĻāϰā§āĨ¤
Q3. Linux-āĻ /etc āĻā§?
System configuration files-āĻāϰ āĻĒā§āϰāϧāĻžāύ directoryāĨ¤
Q4. /var āĻā§?
Variable data āϝā§āĻŽāύ logs, caches āĻāĻŦāĻ application state-āĻāϰ āĻāύā§āϝ āĻŦā§āϝāĻŦāĻšā§āϤ āĻšā§āĨ¤
Q5. Process āĻā§?
Running program-āĻāϰ āĻāĻāĻāĻŋ execution instanceāĨ¤
Q6. PID āĻā§?
Process IdentifierāĨ¤
Q7. kill -9 āĻā§ āĻāϰā§?
SIGKILL āĻĒāĻžāĻ āĻžā§āĨ¤ Process graceful cleanup āĻāϰāĻžāϰ āϏā§āϝā§āĻ āĻĒāĻžā§ āύāĻžāĨ¤
Q8. chmod 755 āĻā§?
Owner = rwx
Group = r-x
Other = r-x
Q9. chmod 644 āĻā§?
Owner = rw-
Group = r--
Other = r--
Q10. sudo āĻā§?
Authorized user-āĻā§ privileged command execute āĻāϰāĻžāϰ āϏā§āϝā§āĻ āĻĻā§ā§āĨ¤
99. Intermediate Interview Questions
Q11. Hard link āĻāĻŦāĻ soft link-āĻāϰ difference?
Hard link āĻāĻāĻ inode-āĻāϰ āĻĻāĻŋāĻā§ āύāĻŋāϰā§āĻĻā§āĻļ āĻāϰā§; symbolic link āĻāĻāĻāĻŋ path reference āĻāϰ⧠āĻāĻŦāĻ āĻāϞāĻžāĻĻāĻž inode āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻāϰā§āĨ¤
Q12. Zombie process āĻā§?
Child process terminate āĻāϰā§āĻā§ āĻāĻŋāύā§āϤ⧠parent āϤāĻžāϰ exit status collect āĻāϰā§āύāĻŋâāϤāĻāύ zombie state āĻšāϤ⧠āĻĒāĻžāϰā§āĨ¤
Q13. Load average āĻā§?
System-āĻāϰ runnable āĻāĻŦāĻ āĻāĻŋāĻā§ uninterruptible work-āĻāϰ queue/load-āĻāϰ āĻāĻāĻāĻŋ time-windowed indicationāĨ¤
Q14. /proc āĻā§?
Kernel āĻāĻŦāĻ process information expose āĻāϰāĻž virtual filesystemāĨ¤
Q15. df āĻāĻŦāĻ du difference?
df â filesystem-level disk usage
du â directory/file-level usage
Q16. systemctl āĻā§?
systemd-managed services āĻāĻŦāĻ system state control āĻāϰāĻžāϰ commandāĨ¤
Q17. journalctl āĻā§?
systemd journal-āĻāϰ logs query āĻāϰāĻžāϰ toolāĨ¤
Q18. ss āĻā§?
Network sockets āĻāĻŦāĻ listening connections inspect āĻāϰāĻžāϰ toolāĨ¤
100. Advanced Interview Questions
Q19. Linux-āĻ āĻāĻāĻāĻŋ process CPU 100% āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻāϰāϞ⧠āĻā§āĻāĻžāĻŦā§ troubleshoot āĻāϰāĻŦā§?
top/htop
â
identify PID
â
ps
â
inspect process
â
logs
â
application behavior
â
profiling/metrics
Q20. Disk 100% fullāĨ¤ āĻā§ āĻāϰāĻŦā§?
df -h
du -sh /*
find /var -type f -size +1G
df -i
lsof +L1
āϤāĻžāϰāĻĒāϰ identify āĻāϰ⧠safe cleanupāĨ¤
Q21. Port 8080 already in useāĨ¤ āĻā§ āĻāϰāĻŦā§?
ss -lntp | grep :8080
āĻ
āĻĨāĻŦāĻž:
lsof -i :8080
āϤāĻžāϰāĻĒāϰ owning process identify āĻāϰ⧠root cause āĻ āύā§āϝāĻžā§ā§ āĻŦā§āϝāĻŦāϏā§āĻĨāĻž āύā§āĻŦāĨ¤
Q22. Server ping āĻāϰāĻž āϝāĻžāĻā§āĻā§ āĻāĻŋāύā§āϤ⧠application access āĻāϰāĻž āϝāĻžāĻā§āĻā§ āύāĻžāĨ¤ āĻā§āύ?
Possible layers:
DNS
Firewall
Port
Service
Application
Reverse Proxy
Routing
Security Group
Q23. Nginx 502 āĻĻāĻŋāĻā§āĻā§āĨ¤ āĻā§āĻāĻžāĻŦā§ troubleshoot āĻāϰāĻŦā§?
Nginx status
â
Nginx logs
â
Backend service
â
Backend port
â
curl backend directly
â
Application logs
Q24. Memory āĻļā§āώ āĻšā§ā§ āĻā§āϞ⧠Linux āĻā§ āĻāϰāϤ⧠āĻĒāĻžāϰā§?
System swap āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻāϰāϤ⧠āĻĒāĻžāϰā§; extreme memory pressure-āĻ OOM killer process terminate āĻāϰāϤ⧠āĻĒāĻžāϰā§āĨ¤
Q25. Docker container-āĻāϰ Linux process āĻā§āύ host-āĻāϰ kernel āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻāϰā§?
Containers āϏāĻžāϧāĻžāϰāĻŖāϤ full VM āύā§; Linux kernel-āĻāϰ isolation primitives āϝā§āĻŽāύ namespaces āĻāĻŦāĻ cgroups āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻāϰ⧠process/environment isolate āĻāϰā§āĨ¤
101. Scenario-Based Interview
Scenario 1
Production API suddenly returning 500.
āϤā§āĻŽāĻŋ āĻŦāϞāĻŦā§:
1. Check application logs
2. Check recent deployment
3. Check dependencies
4. Check CPU/memory/disk
5. Check database/network
6. Reproduce request
7. Rollback if necessary
8. Verify recovery
Scenario 2
API latency suddenly increased.
Check:
CPU
Memory
Load
Network
Disk I/O
Database latency
Upstream services
Application logs
Recent changes
Scenario 3
Server disk full.
Check:
df -h
du -sh /var/*
df -i
lsof +L1
Common causes:
Logs
Docker
Backups
Temporary files
Deleted open files
Scenario 4
Kubernetes Pod āĻŦāĻžāϰāĻŦāĻžāϰ restart āĻāϰāĻā§āĨ¤
Linux-level āĻāĻŦāĻ Kubernetes-level āĻĻā§āĻā§ āĻĻāĻŋāĻ:
kubectl logs
kubectl describe pod
â
Application logs
â
OOM?
CPU?
Configuration?
Dependency?
â
Node health
â
journalctl
102. Hands-on Lab 1 â Linux Server
āĻāĻāĻāĻŋ VM āĻŦāĻž cloud server āϤā§āϰāĻŋ āĻāϰā§:
Ubuntu
Install:
nginx
git
docker
curl
htop
āϤāĻžāϰāĻĒāϰ:
- SSH āĻāϰā§
- user āϤā§āϰāĻŋ āĻāϰā§
- permissions change āĻāϰā§
- Nginx āĻāĻžāϞāĻžāĻ
- logs āĻĻā§āĻā§
- port check āĻāϰā§
103. Hands-on Lab 2 â Nginx
Install:
sudo apt install nginx
Check:
systemctl status nginx
Test:
curl localhost
Port:
ss -lntp | grep :80
Logs:
journalctl -u nginx
104. Hands-on Lab 3 â Deploy FastAPI
Flow:
Linux VM
â
Python
â
FastAPI
â
Uvicorn
â
Nginx
â
Internet
āĻāĻāĻž āϤā§āĻŽāĻžāϰ ML inference platform-āĻāϰ foundation āĻšāĻŋāϏā§āĻŦā§ āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻāϰāϤ⧠āĻĒāĻžāϰā§āĨ¤
105. Hands-on Lab 4 â Monitoring
āĻāĻāĻāĻŋ application āĻāĻžāϞāĻŋā§ā§:
top
free -h
df -h
ss -lntp
observe āĻāϰāĻŦā§āĨ¤
āϤāĻžāϰāĻĒāϰ artificial load āϤā§āϰāĻŋ āĻāϰ⧠CPU/memory behavior āĻĻā§āĻāĻŦā§āĨ¤
106. Hands-on Lab 5 â Bash Automation
āĻāĻāĻāĻŋ script āĻŦāĻžāύāĻžāĻ:
backup.sh
āϝāĻž:
1. Application directory backup āĻāϰāĻŦā§
2. Timestamp āϝā§āĻ āĻāϰāĻŦā§
3. tar.gz āĻŦāĻžāύāĻžāĻŦā§
4. āĻĒā§āϰāύ⧠backup delete āĻāϰāĻŦā§
5. success/failure log āĻāϰāĻŦā§
āϤāĻžāϰāĻĒāϰ cron āĻĻāĻŋā§ā§ schedule āĻāϰā§āĨ¤
107. Hands-on Lab 6 â Linux Troubleshooting
āύāĻŋāĻā§ intentionally problem āϤā§āϰāĻŋ āĻāϰā§:
Stop nginx
Kill application
Fill temporary disk
Block a port
Wrong permissions
Wrong environment variable
Wrong DNS entry
āϤāĻžāϰāĻĒāϰ āύāĻŋāĻā§ troubleshoot āĻāϰā§āĨ¤
āĻāĻāĻž interview preparation-āĻāϰ āĻāύā§āϝ āϏāĻŦāĻā§ā§ā§ valuable exerciseāĻā§āϞā§āϰ āĻāĻāĻāĻŋāĨ¤
108. DevOps Linux Skill Matrix
| Topic | Priority |
|---|---|
| Linux basics | âââââ |
| Filesystem | âââââ |
| Permissions | âââââ |
| Users/Groups | âââââ |
| Processes | âââââ |
| Networking | âââââ |
| SSH | âââââ |
| systemd | âââââ |
| Logs | âââââ |
| Bash | âââââ |
| Docker/Linux relationship | âââââ |
| Troubleshooting | âââââ |
| Disk/storage | ââââ |
| Security | ââââ |
| DNS | ââââ |
| TCP/IP | ââââ |
| Nginx | ââââ |
| cron | âââ |
| awk/sed | âââ |
| tcpdump | âââ |
| SELinux/AppArmor | âââ |
109. 30-Day Linux â DevOps Foundation Plan
Week 1 â Linux Basics
Day 1
Linux + filesystem
Day 2
Navigation + file management
Day 3
Permissions + ownership
Day 4
Users + groups + sudo
Day 5
Processes + signals
Day 6
Package management
Day 7
Revision + practical lab
Week 2 â Linux Administration
Day 8
Environment variables
Day 9
Bash basics
Day 10
grep + pipes
Day 11
awk + sed
Day 12
systemd
Day 13
journalctl + logs
Day 14
cron + automation
Week 3 â Networking + Storage
Day 15
IP + subnet basics
Day 16
TCP/UDP + ports
Day 17
DNS
Day 18
SSH
Day 19
curl + wget + nc
Day 20
Disk + filesystem
Day 21
mount + inode + troubleshooting
Week 4 â DevOps Linux
Day 22
Nginx
Day 23
Reverse proxy
Day 24
Linux security
Day 25
Docker + Linux
Day 26
Kubernetes + Linux
Day 27
Performance troubleshooting
Day 28
Production troubleshooting
Day 29
Interview preparation
Day 30
Complete practical project
110. Final Linux Project
āĻāĻāĻāĻŋ complete mini-production environment āĻŦāĻžāύāĻžāĻ:
Internet
|
v
Nginx
|
v
FastAPI
|
v
ML Model
|
+----+----+
| |
Logs Metrics
Server-āĻ:
Ubuntu
Nginx
FastAPI
systemd
SSH
Firewall
Bash
cron
logging
monitoring
Implement:
- [ ] SSH authentication
- [ ] Non-root application user
- [ ] FastAPI service
- [ ] systemd service
- [ ] Nginx reverse proxy
- [ ] HTTPS
- [ ] firewall
- [ ] log rotation
- [ ] backup script
- [ ] cron
- [ ] monitoring
- [ ] troubleshooting documentation
111. Final Interview Checklist
Interview-āĻāϰ āĻāĻā§ confidently explain āĻāϰāϤ⧠āĻĒāĻžāϰāĻŦā§:
Linux
- [ ] Linux architecture
- [ ] Kernel
- [ ] Filesystem
- [ ]
/etc - [ ]
/var - [ ]
/proc - [ ] permissions
- [ ] users/groups
- [ ] sudo
Processes
- [ ] PID
- [ ] signals
- [ ] zombie
- [ ] orphan
- [ ] process vs thread
- [ ] CPU troubleshooting
- [ ] memory troubleshooting
Networking
- [ ] IP
- [ ] subnet
- [ ] routing
- [ ] TCP/UDP
- [ ] DNS
- [ ] ports
- [ ] sockets
- [ ] HTTP/HTTPS
- [ ] firewall
Administration
- [ ] SSH
- [ ] systemd
- [ ] journalctl
- [ ] cron
- [ ] package management
- [ ] storage
- [ ] mount
- [ ] inode
DevOps
- [ ] Linux + Docker
- [ ] Linux + Kubernetes
- [ ] Nginx
- [ ] reverse proxy
- [ ] Bash automation
- [ ] monitoring
- [ ] troubleshooting
- [ ] security
đ¯ Final Goal
Linux āĻļā§āĻāĻžāϰ āĻāĻĻā§āĻĻā§āĻļā§āϝ āĻļā§āϧ⧠command āĻŽā§āĻāϏā§āĻĨ āĻāϰāĻž āύā§āĨ¤
āϤā§āĻŽāĻžāϰ goal āĻšāĻŦā§:
"I can operate and troubleshoot a Linux production server."
āϤāĻžāϰāĻĒāϰ:
Linux
â
Git
â
Docker
â
Kubernetes
â
Terraform
â
GitHub Actions
â
ArgoCD
â
Prometheus/Grafana
â
Production DevOps
Linux-āĻāϰ āĻā§āώā§āϤā§āϰ⧠āĻŦāĻŋāĻļā§āώ āĻāϰ⧠command āĻŽā§āĻāϏā§āĻĨ āĻāϰāĻžāϰ āĻā§ā§ā§ troubleshooting skill āĻŦā§āĻļāĻŋ āĻā§āϰā§āϤā§āĻŦāĻĒā§āϰā§āĻŖāĨ¤
āĻāĻāĻāύ DevOps engineer āĻšāĻŋāϏā§āĻŦā§ āϤā§āĻŽāĻŋ āϝā§āύ āĻāĻāĻāĻŋ āϏāĻŽāϏā§āϝāĻž āĻĻā§āĻā§ āĻŦāϞāϤ⧠āĻĒāĻžāϰā§:
What is broken?
â
Where is it broken?
â
Why is it broken?
â
How can I verify it?
â
How can I fix it safely?
â
How can I prevent it from happening again?
āĻāĻāĻžāĻ āĻāĻ Linux roadmap-āĻāϰ āĻŽā§āϞ āϞāĻā§āώā§āϝāĨ¤
Top comments (0)