Pathubs Logo Mark
PATHUBSFREE CAREER ROADMAPS
HomeExploreDiscoverCompare ⚖️My Progress 📊Support
Student Support & Feedback

Have Questions or Need Help?

Have questions, feedback, or suggestions for new roadmaps and interactive tools? Reach out to our team — we review every message to make practical learning better for everyone.

supportpathubs@gmail.com Official Telegram Support (@PathubsSupport)
Pathubs

100% Free, Zero-Paywall Tech Career Roadmaps, In-Depth Practical Content, and Live Interactive Virtual Labs for Learners Worldwide.

Popular Careers

  • Frontend Development
  • Backend Development
  • AI & LLM Engineering
  • Full Stack Web Dev
  • Data Analytics

Platform Tools

  • Career Discovery Quiz
  • Compare Careers

Contact & Info

  • About Us
  • supportpathubs@gmail.com
  • Support Pathubs

© 2026 Pathubs. All Rights Reserved. Structured learning, practical content, and hands-on practice for learners worldwide.

AboutPrivacy PolicyTerms & ConditionsSitemapRobots
Backend Web Development RoadmapPhase 07: Containerization & OS • Linux Basics
Pathubs Backend Curriculum • Phase 07: Linux Fundamentals

Linux Basics for Backend & Full Stack Developers

Master server-side Linux from first principles. Understand the Unix philosophy, the Filesystem Hierarchy Standard (/etc, /var, /bin), stream redirection (stdin, stdout, stderr), Linux pipes, octal permissions (chmod 755 vs 600 vs 644), process lifecycle (ps, kill, signals), systemd daemons, environment variables, and production server incident debugging.

⏱️ Estimated Time:45 Minutes
🎯 Level:Beginner to Intermediate
📊 Track:Backend & DevOps Engineering
✨ Mode:Interactive Terminal & Permission Lab

Curriculum Outline

• 1. Why Linux? The OS Powering the Cloud• 2. The Linux Filesystem Hierarchy (FHS)• 3. Essential Navigation & File Operations• 4. Standard Streams & I/O Redirection• 5. The Power of Linux Pipes (|) & Text Tools⚡ 6. Interactive Permission Calculator (chmod)• 7. Process Lifecycle & Resource Monitoring⚡ 8. Interactive Process Monitor & Signal Lab• 9. Background Daemons with systemd• 10. Environment Variables & Shell Config• 11. 5 Critical Server Incidents & Traps⚡ 12. Interactive Linux CLI Sandbox• 13. Production Server Best Practices• 14. What You Should Know Now: Checklist🎯 15. Knowledge Assessment (Quiz)
1

Why Linux? The Operating System Powering the Cloud

Over 96% of the world's top 1 million web servers and virtually 100% of all public cloud infrastructure (AWS, Google Cloud, Azure, Docker containers, Kubernetes worker nodes) run on Linux. As a backend or full-stack developer, your code will ultimately run on a headless Linux machine.

Linux is built upon the classic Unix Philosophy established by Ken Thompson and Dennis Ritchie:

  • Everything is a file: Disks, network sockets, processes, and devices are represented as file streams in the filesystem.
  • Do one thing and do it well: Small, modular utilities (like grep, awk, sort, tail) designed to be combined.
  • Text streams are the universal interface: Programs communicate by passing plain text across pipelines without proprietary binary contracts.
2

The Linux Filesystem Hierarchy Standard (FHS)

Unlike Windows (which uses drive letters like C:\ and D:\), Linux uses a single unified tree starting at the root directory (/). Understanding where things live is crucial for configuring servers:

DirectoryStandard PurposeWhat Backend Engineers Find Here
/etcSystem-wide configuration filesnginx.conf, hosts, SSL certificate paths, systemd unit files
/var/logVariable runtime data & log filessyslog, nginx/access.log, application error logs, crash dumps
/bin & /usr/binStandard executable binariesSystem utilities: node, python3, git, curl, docker
/homeUser personal directories/home/deploy, developer SSH keys (~/.ssh/authorized_keys), .bashrc
/optOptional third-party software packagesStandalone enterprise applications and custom deployments
/tmpTemporary scratch filesEphemeral files automatically purged on server reboot
/procVirtual kernel process filesystemIn-memory pseudo-files exposing CPU, RAM, and active process states (/proc/cpuinfo)
3

Essential Navigation & File Operations

These are the primary commands every backend engineer executes daily when SSH'd into a remote server:

Essential Bash Commands
# Print Current Working Directory
pwd

# List files in long format (-l), showing hidden files (-a), human-readable sizes (-h)
ls -lah

# Create nested directory trees without erroring if parents exist
mkdir -p /app/backend/config

# View the live end of an application log file as requests arrive
tail -f /var/log/app.log
4

Standard Streams (stdin, stdout, stderr) & I/O Redirection

Every Linux process is automatically initialized with three standard I/O communication streams represented by integer file descriptors:

  • stdin (FD 0): Standard input (keyboard or incoming data stream)
  • stdout (FD 1): Standard output (normal application output and success messages)
  • stderr (FD 2): Standard error (warning and error messages, kept separate from data)
SyntaxStream TargetReal Production Example
> fileRedirect stdout (overwrite file)node build.js > build.log
>> fileRedirect stdout (append to file)echo "[INFO] Worker booted" >> /var/log/worker.log
2> fileRedirect stderr onlynode server.js 2> errors.log
> file 2>&1Combine stdout AND stderr into same file./deploy.sh > deploy.log 2>&1
> /dev/null 2>&1Discard both stdout and stderr silently (Black hole)crontab job: * * * * * python cleanup.py > /dev/null 2>&1
5

The Power of Linux Pipes (|) & Text Processing

A pipe (|) connects the stdout of one command directly into the stdin of the next command in memory without writing temporary files to disk. Chaining commands is the superpower of backend debugging:

Real Incident Debugging Pipeline
# Find the top 5 client IP addresses causing HTTP 500 Internal Server Errors
cat /var/log/nginx/access.log \
  | grep " 500 " \
  | awk '{print $1}' \
  | sort \
  | uniq -c \
  | sort -nr \
  | head -n 5

This pipeline reads the access log, filters only HTTP 500 lines, extracts the client IP column (field $1), sorts them, counts occurrences, sorts numerically in descending order, and displays the top 5 IPs triggering errors!

6

⚡ Live Interactive Lab: Linux Permissions & Octal Calculator (chmod)

Linux file security is based on three entity scopes: Owner (u), Group (g), and Others (o). Each scope has three permissions: Read (4), Write (2), and Execute (1). Toggle the checkboxes below to understand how permissions calculate:

Interactive chmod Octal & Symbolic Generator
Adjust permission bits for Owner, Group, and Others or choose a real-world security preset.
👤 Owner (User)Val: 7
👥 GroupVal: 5
🌐 Others (Public)Val: 5
Numeric Octal
chmod 755 filename
Symbolic Representation
-rwxr-xr-x
7

Process Lifecycle & Resource Monitoring (ps, top, kill)

Every running program is assigned a unique numeric Process ID (PID) by the Linux kernel. Understanding process management lets you diagnose server CPU spikes and gracefully terminate runaway scripts:

CommandWhat It DoesWhen to Use It
ps aux | grep nodeLists all active processes filtering for 'node'Find PID and RAM consumption of your backend server
top or htopLive interactive CPU and memory dashboardIdentify runaway processes eating 100% CPU in real-time
kill -15 <PID>Sends SIGTERM (Graceful Termination request)Standard way to stop services cleanly
kill -9 <PID>Sends SIGKILL (Immediate Kernel force-kill)Last resort for frozen, unresponsive zombie processes
8

⚡ Live Interactive Lab: Process Monitor & Signal Dispatcher

Interact with this simulated server process table. Test the difference between graceful SIGTERM (15) and forceful SIGKILL (9):

Live Process Manager & Signal Dispatcher
Inspect active server processes and dispatch termination signals.
PIDUSERCPUMEMCOMMANDSTATUSACTIONS
1402node1.2%68MBnode /app/server.js (Express)RUNNING
1420postgres0.4%142MBpostgres -D /data (Database)RUNNING
1511redis0.1%34MBredis-server --port 6379RUNNING
1899deploy88.4%412MBpython leaky_worker.py (High CPU)RUNNING
Process monitor initialized. Click SIGTERM or SIGKILL to test process signals.
9

Background Daemons & Service Units with systemd

In production, you cannot simply run node server.js in your SSH terminal—because when you close your laptop, the SSH session terminates and your server dies. On modern Linux, systemd is the standard init system that runs background services, restarts them on failure, and manages logs:

/etc/systemd/system/backend.service (Systemd Unit Configuration)
[Unit]
Description=Production Express API Service
After=network.target postgresql.service

[Service]
Type=simple
User=deploy
WorkingDirectory=/app/backend
ExecStart=/usr/bin/node src/server.js
# Automatically restart backend if it crashes
Restart=always
RestartSec=5
Environment=NODE_ENV=production PORT=3000

[Install]
WantedBy=multi-user.target
# Core systemd management commands
sudo systemctl daemon-reload         # Reload systemd configs
sudo systemctl enable backend         # Start automatically on boot
sudo systemctl start backend          # Start service now
sudo systemctl status backend         # Check health & active PID
sudo journalctl -u backend -f         # Stream live logs
10

Environment Variables & Shell Configuration (.bashrc)

Environment variables configure application behavior without code changes. In Linux:

# Set an environment variable for the current terminal session only
export DATABASE_URL="postgres://user:pass@localhost:5432/app"

# Print all current environment variables
printenv

# Inspect the executable binary search path
echo $PATH

To make environment variables or command aliases permanent for a user, append them to ~/.bashrc and run source ~/.bashrc to reload the shell.

11

5 Critical Production Server Incidents & Fixes

Incident 1: “No space left on device” (Disk 100% Full)
Diagnosis: Run df -h to see which disk partition is full. Then run du -sh /var/log/* | sort -hr | head -n 10 to find bloated log files eating all disk space.
Fix: Truncate bloated logs with > /var/log/app.log and configure logrotate.
Incident 2: “Port 3000 already in use” (EADDRINUSE)
Diagnosis: Run lsof -i :3000 or sudo netstat -tulpn | grep 3000 to identify the lingering PID.
Fix: Gracefully terminate the old process with kill -15 <PID>.
Incident 3: “Permission denied” on Deployment Script
Diagnosis: A newly cloned script deploy.sh is not marked executable.
Fix: Run chmod +x deploy.sh (adds execute bit).
Incident 4: Windows Line Endings Break Bash Scripts ("\r: command not found")
Diagnosis: Script was edited on Windows with CRLF line endings instead of Unix LF.
Fix: Run dos2unix script.sh or sed -i -e 's/\r$//' script.sh.
Incident 5: Memory Exhaustion & Linux OOM Killer
Diagnosis: Run free -m and check dmesg -T | grep -i oom to see if the Linux Out-Of-Memory killer terminated your backend node process.
Fix: Increase server RAM, configure a 2GB Swap file, or add memory limits to the service.
12

⚡ Live Interactive Lab: Interactive Linux CLI Sandbox

Execute everyday server diagnostic commands in this simulated production Debian terminal:

deploy@prod-node-01: ~
Click preset command:
deploy@prod-node-01:~$ uname -a
Linux prod-node-01 6.1.0-18-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.76-1 (2024-02-01) x86_64 GNU/Linux
13

Industry Production Best Practices & Security

  • Disable Direct Root SSH Login: Edit /etc/ssh/sshd_config and set PermitRootLogin no. Always log in as a dedicated user and use sudo.
  • Enforce SSH Key-Based Authentication: Set PasswordAuthentication no to protect against automated brute-force password scanners.
  • Enable the UFW Firewall: Block all inbound ports except SSH (22), HTTP (80), and HTTPS (443): sudo ufw default deny incoming && sudo ufw allow 22 && sudo ufw allow 80 && sudo ufw allow 443 && sudo ufw enable.
  • Automate Security Patches: Install unattended-upgrades on Debian/Ubuntu servers to receive kernel security patches automatically.
  • Implement Logrotate: Configure /etc/logrotate.d/ to compress and truncate server logs before disks fill up.
14

What You Should Know Now: Core Checklist

  • ✓FHS Hierarchy: Configurations live in /etc, logs live in /var/log, binaries in /bin.
  • ✓Redirection: > overwrites, >> appends, 2>&1 merges stderr into stdout.
  • ✓Linux Pipes: | passes stdout of one tool into stdin of the next.
  • ✓Octal Permissions: chmod 755 (executable), 644 (file), 600 (secret SSH key). Never use 777.
  • ✓Signals: kill -15 (SIGTERM graceful), kill -9 (SIGKILL force).
  • ✓systemd: Use systemctl to run, enable, and restart persistent background services.
Knowledge Assessment

Linux Basics Mastery Quiz

Test your real-world understanding of the Linux filesystem, bash redirection, pipes, octal permissions, process signals, and production incident recovery.

Question 1 of 8Score: 0 / 0
Q1: Under the Linux Filesystem Hierarchy Standard (FHS), in which directory should static application configuration files (like nginx.conf or database configs) be placed?
Previous: Docker Basics & ContainerizationNext: Deploying Backend to Production