Skip to content
Open

Main #634

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
99b3507
Linux-architecture-notes
santosh-pathak-tedekstra Feb 8, 2026
6f1c4dc
Merge branch 'master' of https://github.com/Santosh-Pathak/90DaysOfDe…
santosh-pathak-tedekstra Feb 8, 2026
4a4932f
DevOps Essential Command Toolkit
santosh-pathak-tedekstra Feb 8, 2026
9fd126b
file-io-practice.md
santosh-pathak-tedekstra Feb 8, 2026
938af7d
day-07-linux-fs-and-scenarios.md
santosh-pathak-tedekstra Feb 16, 2026
d880976
santosh-pathak-tedekstra Feb 19, 2026
49919d9
Cloud Server Setup: Docker, Nginx & Web Deployment
santosh-pathak-tedekstra Feb 19, 2026
32f71aa
Feat : File and User Management
santosh-pathak-tedekstra Feb 20, 2026
cd3f46a
Feat : LVM and Basic of Networking Done
santosh-pathak-tedekstra Feb 20, 2026
67d4e96
DNS, IP Addressing, Subnets & Ports
santosh-pathak-tedekstra Feb 21, 2026
2227295
day-16-shell-scripting.md
santosh-pathak-tedekstra Feb 22, 2026
508d62a
Add Day 29 and Day 30 tasks on Docker fundamentals and container life…
santosh-pathak-tedekstra Feb 22, 2026
8057e28
Add Day 17 challenge on Shell Scripting: Loops, Arguments & Error Han…
santosh-pathak-tedekstra Feb 22, 2026
69e9d17
Merge branch 'master' of https://github.com/Santosh-Pathak/90DaysOfDe…
santosh-pathak-tedekstra Feb 25, 2026
7101216
Add Day 18 tasks on Shell Scripting: Functions & Intermediate Concepts
santosh-pathak-tedekstra Feb 26, 2026
93396c8
Add log analyzer script and shell scripting cheat sheet
santosh-pathak-tedekstra Mar 1, 2026
3a23871
Merge branch 'master' of https://github.com/Santosh-Pathak/90DaysOfDe…
santosh-pathak-tedekstra Mar 1, 2026
ce9ff89
Merge branch 'master' of https://github.com/Santosh-Pathak/90DaysOfDe…
santosh-pathak-tedekstra Mar 7, 2026
3dde534
Add backup script with 5-day rotation functionality
santosh-pathak-tedekstra Mar 8, 2026
28443ee
Add Day 22 notes and Git commands reference
santosh-pathak-tedekstra Mar 8, 2026
6d4356a
Add Day 23 notes on Git branching and commands reference
santosh-pathak-tedekstra Mar 8, 2026
d4e9f07
Add Day 24 notes on advanced Git concepts: merge, rebase, stash, and …
santosh-pathak-tedekstra Mar 9, 2026
12394ff
Add Day 25 notes on Git Reset vs Revert and Branching Strategies
santosh-pathak-tedekstra Mar 10, 2026
a6a8449
Merge branch 'master' of https://github.com/Santosh-Pathak/90DaysOfDe…
santosh-pathak-tedekstra Mar 21, 2026
f41abaa
Add Day 29 and Day 31 content on Docker basics and Dockerfile instruc…
santosh-pathak-tedekstra Mar 21, 2026
89a491d
Merge branch 'master' of https://github.com/Santosh-Pathak/90DaysOfDe…
santosh-pathak-tedekstra Mar 31, 2026
e1f3c34
Added day 32 and day 33 of Terraweek challenge: Docker Volumes & Netw…
santosh-pathak-tedekstra Mar 31, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 88 additions & 0 deletions 2026/day-02/linux-architecture-notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Linux Architecture, Processes, and systemd

## 1. Core Components of Linux

### Kernel (known as "Linux Kernel")
- The **core of the OS**(Heart)
- Manages:
- CPU scheduling
- Memory management
- Hardware access (drivers)
- Process lifecycle
- Runs in **kernel space** (full privileges)

### User Space
- Where **applications and users** operate
- Includes:
- Shells (bash, zsh)
- Utilities (`ls`, `ps`, `top`)
- Services (nginx, docker)
- Cannot access hardware directly → requests go via kernel

### Init System (systemd)
- First process started by the kernel (**PID 1**)
- Responsible for:
- Starting services
- Restarting failed services
- Managing logs and dependencies

---

## 2. How Processes Work in Linux

### Process Creation
- A new process is created using:
- `fork()` → creates a copy
- `exec()` → loads a new program
- Every process has:
- **PID** (Process ID)
- **PPID** (Parent PID)
- Owner (user)

### Process States
- **R (Running)** – Executing on CPU
- **S (Sleeping)** – Waiting for I/O or event
- **D (Uninterruptible Sleep)** – Waiting for disk/network (cannot be killed)
- **T (Stopped)** – Paused (e.g., Ctrl+Z)
- **Z (Zombie)** – Finished execution but parent hasn’t cleaned it up

> Zombies don’t use CPU/memory, but many zombies indicate a bug.

---

## 3. What systemd Does (and Why It Matters)

- Controls system services using **units**
- Common unit types:
- `service` – background services
- `timer` – cron replacement
- `target` – system states (multi-user, graphical)

### Why systemd is Important
- Automatically restarts crashed services
- Handles service dependencies
- Centralized logging with `journalctl`
- Faster boot and better observability

---

## 4. Daily Linux Commands (DevOps Essentials)

1. `ps aux` – View running processes
2. `top` / `htop` – Monitor CPU & memory usage
3. `systemctl status <service>` – Check service health
4. `journalctl -u <service>` – View service logs
5. `kill -9 <PID>` – Force stop a stuck process

---

## 5. DevOps Takeaway

- Kernel = control
- Processes = workload
- systemd = reliability

If you understand these three:
- You can debug crashes
- Fix performance issues
- Confidently manage production servers
161 changes: 161 additions & 0 deletions 2026/day-03/linux-commands-cheatsheet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
# Linux Commands Cheat Sheet
**DevOps Essential Command Toolkit**

--
## 📊 Process Management

| Command | Usage |
|---------|-------|
| `ps aux` | Display all running processes with detailed info |
| `top` | Real-time process monitoring and system stats |
| `htop` | Interactive process viewer (better than top) |
| `kill <PID>` | Terminate process by Process ID |
| `kill -9 <PID>` | Force kill a process (SIGKILL) |
| `killall <name>` | Kill all processes by name |
| `pgrep <name>` | Find process ID by name |
| `bg` | Resume suspended job in background |
| `fg` | Bring background job to foreground |
| `jobs` | List all background jobs |
| `nohup <command> &` | Run command immune to hangups |
| `systemctl status <service>` | Check service status |
| `systemctl start <service>` | Start a service |
| `systemctl stop <service>` | Stop a service |
| `systemctl restart <service>` | Restart a service |

---

## 📁 File System Commands

| Command | Usage |
|---------|-------|
| `df -h` | Show disk usage in human-readable format |
| `du -sh <directory>` | Show directory size summary |
| `ls -lah` | List files with hidden items and human-readable sizes |
| `find / -name <filename>` | Search for file by name from root |
| `find . -type f -size +100M` | Find files larger than 100MB |
| `tail -f <logfile>` | Follow log file in real-time |
| `tail -n 50 <file>` | Display last 50 lines of file |
| `head -n 20 <file>` | Display first 20 lines of file |
| `grep -r "error" /var/log/` | Search for "error" recursively in logs |
| `chmod 755 <file>` | Change file permissions (rwxr-xr-x) |
| `chown user:group <file>` | Change file ownership |
| `ln -s <source> <link>` | Create symbolic link |
| `tar -czf archive.tar.gz <dir>` | Create compressed archive |
| `tar -xzf archive.tar.gz` | Extract compressed archive |
| `mount /dev/sdb1 /mnt` | Mount a disk partition |

---

## 🌐 Networking & Troubleshooting

| Command | Usage |
|---------|-------|
| `ping <host>` | Test connectivity to host |
| `ip addr` | Show all network interfaces and IP addresses |
| `ip route` | Display routing table |
| `curl <URL>` | Transfer data from/to servers |
| `curl -I <URL>` | Fetch HTTP headers only |
| `wget <URL>` | Download files from web |
| `netstat -tulpn` | Show listening ports and services |
| `ss -tulpn` | Modern alternative to netstat |
| `dig <domain>` | DNS lookup and query details |
| `nslookup <domain>` | Query DNS name servers |
| `traceroute <host>` | Trace packet route to destination |
| `ifconfig` | Display/configure network interfaces (legacy) |
| `tcpdump -i eth0` | Capture network packets on interface |
| `iptables -L` | List firewall rules |
| `hostname -I` | Show all IP addresses of host |

---

## 🔍 System Information

| Command | Usage |
|---------|-------|
| `uname -a` | Display system information |
| `uptime` | Show system uptime and load average |
| `free -h` | Display memory usage in human-readable format |
| `lsblk` | List block devices (disks and partitions) |
| `lscpu` | Display CPU architecture information |
| `vmstat` | Report virtual memory statistics |

---

## 📝 Log Analysis Quick Commands

```bash
# Check system logs
journalctl -xe # Recent logs with explanations
journalctl -u nginx.service # Logs for specific service
journalctl --since "1 hour ago" # Logs from last hour

# Apache/Nginx logs
tail -f /var/log/nginx/error.log
tail -f /var/log/apache2/access.log

# System logs
tail -f /var/log/syslog
grep -i "error" /var/log/syslog | tail -20
```

---

## 🚨 Emergency Troubleshooting Workflow

```bash
# 1. Check system resources
top # CPU and memory
df -h # Disk space
free -h # Memory

# 2. Check service status
systemctl status <service>
journalctl -u <service> -n 50

# 3. Check network
ip addr # IP configuration
ss -tulpn # Open ports
ping 8.8.8.8 # External connectivity

# 4. Check logs
tail -f /var/log/syslog
grep -i error /var/log/syslog
```

---

## 💡 Pro Tips

- Use `Ctrl + R` for reverse search in command history
- Combine commands with `|` (pipe) for powerful workflows
- Use `&&` to chain commands (runs second only if first succeeds)
- Press `Tab` for auto-completion
- Use `man <command>` to read manual pages
- Add `| less` to paginate long outputs
- Use `watch -n 2 <command>` to run command every 2 seconds

---

## 🎯 Common Real-World Scenarios

**Scenario 1: Server running slow**
```bash
top # Check CPU/memory
df -h # Check disk space
ps aux | grep <service> # Find problematic process
```

**Scenario 2: Service not responding**
```bash
systemctl status <service> # Check service status
journalctl -u <service> -n 50 # Check recent logs
ss -tulpn | grep <port> # Check if port is listening
```

**Scenario 3: Network connectivity issues**
```bash
ping 8.8.8.8 # Test internet
ip addr # Check IP config
dig google.com # Test DNS
traceroute <destination> # Find where packets drop
```
Loading