DEV Community

Abdul Rub
Abdul Rub

Posted on

1

Day 1: Linux Basics – The Power of Commands πŸ§πŸ’»

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

  1. 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:

Image description

  • 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:

Image description

  • 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:

Image description

  • 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:

Image description

  • 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:

Image description

  • 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:

Image description

  • 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:

Image description

  • 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:

Image description

  • 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:

Image description

  • 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:

Image description

11 . ss – Modern netstat

What it does: Faster socket statistics.

When to use:

Image description

  • 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:

Image description

  • 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:

Image description

  • 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:

Image description

  • 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:

Image description

  • When a script won’t run due to "Permission denied".

Top comments (0)