Welcome back to my #DevOpsJourney! π Yesterday, we explored what DevOps is, why cloud computing is a game-changer, and why Linux is the backbone of DevOps. Today, we dive into Linux commandsβthe essential tools that make Linux a powerhouse for DevOps.
Think of Linux commands like kitchen tools π³βeach has a specific purpose, and mastering them lets you cook up amazing automation, troubleshooting, and system management recipes!
π 1. System Monitoring & Resource Management
- top β The Real-Time System Monitor
What it does: Displays CPU, memory, and process stats.
Real-life analogy: Like checking your carβs dashboard while driving (speed, fuel, engine health).
When to use:
- When your server is slow.
- To find which process is consuming max CPU/RAM.
2 . htop β Supercharged top
What it does: Colorful, interactive process viewer.
Real-life analogy: Upgrading from a bicycle speedometer to a Teslaβs touchscreen.
When to use:
- When you need a clearer view of processes.
- To kill processes with F9.
3 . ps β Process Snapshot
What it does: Lists running processes.
Real-life analogy: Taking a roll call in a classroom.
When to use:
- Debugging crashes.
- Checking if a service (e.g., MySQL) is running.
4 . free β Memory Checker
What it does: Shows RAM and swap usage.
Real-life analogy: Checking your wallet (RAM) and emergency cash (swap).
When to use:
- When apps crash due to "Out of Memory" errors.
5 . df β Disk Space Analyzer
What it does: Shows disk usage per partition.
Real-life analogy: Checking storage on your phone ("Is there space for an update?").
When to use:
- Before installing large software.
- If your server logs complain about "No space left".
6 . du β Directory Space Hog Finder
What it does: Checks file/folder sizes.
Real-life analogy: Finding which app is eating your phoneβs storage.
When to use:
- Locating large log files to clean up.
7 . uptime β Server Lifespan Check
What it does: Shows how long the system has been running.
Real-life analogy: Checking your laptopβs uptime since last reboot.
When to use:
- Debugging unexpected reboots.
π 2. Networking β The Digital Highway
8 . ping β Network Connectivity Test
What it does: Checks if a server/website is reachable.
Real-life analogy: Knocking on a neighborβs door to see if theyβre home.
When to use:
- Testing if the internet works.
- Troubleshooting "Server not found" errors.
9 . curl β API/Data Fetcher
What it does: Transfers data via URLs (APIs, downloads).
Real-life analogy: Ordering food via an app (GET/POST requests).
When to use:
- Testing REST APIs.
- Downloading files in scripts.
10 . netstat β Network Statistician (Legacy, use ss instead)
What it does: Lists active connections and ports.
Real-life analogy: Checking whoβs calling your phone.
When to use:
11 . ss β Modern netstat
What it does: Faster socket statistics.
When to use:
- Debugging "Port already in use" errors.
12 . traceroute β Network Path Tracer
What it does: Maps the route packets take to a host.
Real-life analogy: Tracking your pizza delivery route.
When to use:
- Diagnosing slow network speeds.
π 3. File & Directory Management
13 . ls β The Folder Explorer
What it does: Lists files/directories.
Real-life analogy: Opening a drawer to see whatβs inside.
When to use:
- Always. Basic navigation.
14 . grep β The Text Detective
What it does: Searches for patterns in files.
Real-life analogy: Ctrl+F in a document.
When to use:
- Parsing logs.
- Filtering command outputs.
15 . chmod β Permission Manager
What it does: Changes file permissions (read/write/execute).
Real-life analogy: Setting a locker combo.
When to use:
- When a script wonβt run due to "Permission denied".
Top comments (0)