Phase 2: Mastering Linux System Insight Commands for DevOps & SysAdmins

  • Level: Beginner
  • Estimated Time: ~20โ€“25 minutes
  • Tools Used: Linux Terminal / CLI
  • Outcome: You'll gain visibility into your system's behavior, performance, and usage key for DevOps and DevSecOps work.

If youโ€™ve nailed Phase 1: File and Directory Mastery, take a moment to celebrate ๐ŸŽ‰. Youโ€™ve built your foundation. Now it's time to understand what your system is doing under the hood like checking your carโ€™s dashboard while driving.

Welcome to Phase 2: System Insight Tools, where youโ€™ll learn how to monitor system health, processes, and performance a must for every DevOps pro, SRE, or power user.


๐Ÿš€ Why This Phase Matters

โœ… Helps diagnose performance issues
โœ… Core foundation for DevOps & sysadmin tasks
โœ… Lets you observe, troubleshoot, and secure your system like a pro


๐Ÿ” What Youโ€™ll Learn

  • Monitor disk usage and free space
  • Understand RAM usage and availability
  • Visualize directory structure
  • List running processes and system activity
  • Identify logged-in users and user permissions

โœ… Start Here: Where Are You?

pwd

Always know where you're starting from especially when redirecting output.


๐ŸŒณ tree โ€“> Visualize Directory Structure

tree
tree -L 2

Get a visual map of your folders.

๐Ÿ’ก -L 2 limits depth great for big folders.

โš ๏ธ If not installed:

sudo apt install tree

๐Ÿ’ฝ du -sh * โ€“> Folder-by-Folder Disk Usage

du -sh *
  • -s: summary only
  • -h: human-readable sizes
  • *: all items in the directory

๐Ÿ”Ž Use this in your ~/Downloads or ~/Projects folder to spot heavy folders.


๐Ÿงฑ df -h โ€“ Disk Space on Mounted Devices

df -h

See total size, used, available, and usage % for your drives.

โš–๏ธ Use du for per-folder size; use df for whole disk partitions.


๐Ÿง  free -h โ€“> RAM & Swap Usage

free -h

Breaks down:

  • Total / Used / Free RAM
  • Swap memory usage

๐Ÿšจ Useful to check before/after running heavy scripts.


๐Ÿ” ps aux โ€“> All Running Processes

ps aux

See everything running in the background from apps to daemons.

๐Ÿง  Combine with grep:

ps aux | grep nginx

๐Ÿ“ˆ top / htop โ€“> Live System Monitor

top
htop  # If installed
  • top: default, updates every few seconds
  • htop: colorful, interactive (use arrow keys, F6 to sort)

โœ… Install htop:

sudo apt install htop

๐Ÿ‘ค whoami โ€“> Current User

whoami

See your current user crucial when working across user roles or sudo environments.


๐Ÿ†” id โ€“> User ID and Group Info

id

Displays:

  • UID (User ID)
  • GID (Group ID)
  • All groups the user belongs to

๐Ÿ” Understanding permissions starts here.


โš™๏ธ System Snapshot Script

Try running this full system snapshot in your terminal:

echo "--- System Health Check ---"
echo "Current Directory: $(pwd)"
echo ""
echo "--- Disk Usage (Current Folder) ---"
du -sh *
echo ""
echo "--- Overall Disk Space ---"
df -h
echo ""
echo "--- RAM Usage ---"
free -h
echo ""
echo "--- Top 5 CPU Processes ---"
ps aux --sort=-%cpu | head -n 6
echo ""
echo "--- Current User Info ---"
whoami
id
echo "--------------------------"

๐Ÿ“Š Summary Table

CommandWhat It DoesExample
pwdShow current directorypwd
treeVisualize folder structuretree -L 2
du -sh *Show size of each item in current dirdu -sh *
df -hDisk usage across all mounted devicesdf -h
free -hRAM and swap usagefree -h
ps auxAll active processesps aux
top / htopReal-time system monitorhtop
whoamiYour current userwhoami
idUser + group IDsid

๐Ÿงช Mini Challenge: Log Your System State

Try this workflow:

mkdir ~/sys-check
cd ~/sys-check

tree ~ > tree.txt
df -h > disk.txt
free -h > memory.txt
ps aux --sort=-%mem | head -n 10 > top-memory.txt

Then review the files using:

cat memory.txt
cat top-memory.txt

๐Ÿ”œ Whatโ€™s Next: Text Manipulation & Permissions

In Phase 3, you'll learn to:

  • View and edit text files
  • Chain commands with pipes
  • Manage file permissions (chmod, chown)
  • Start scripting automation basics

This is where the shell becomes your superpower. ๐Ÿ’ช


Author: Abdulrahman A. Muhamad
๐ŸŒ Portfolio โ€ข GitHub โ€ข LinkedIn

0
Subscribe to my newsletter

Read articles from Abdulrahman Ahmad directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Abdulrahman Ahmad
Abdulrahman Ahmad

๐Ÿš€ Code. Automate. Innovate. Hi, Iโ€™m Abdulrahman, a passionate DevOps Engineer and Software Developer on a mission to bridge the gap between code and production. With a love for automation, cloud-native solutions, and cutting-edge tech, I turn complex problems into seamless, scalable systems. ๐Ÿ’ก What I Do: Build robust CI/CD pipelines that deliver software at the speed of thought. Architect cloud infrastructure that scales with a single command. Transform manual processes into automated workflows that just work. Break down silos and foster collaboration between teams. ๐Ÿ”ง Tech Stack I โค๏ธ: Containers (Docker), Orchestration (Kubernetes), Infrastructure as Code (Terraform), CI/CD (Jenkins, GitLab), Cloud (AWS/GCP/Azure), and scripting like itโ€™s my superpower. ๐Ÿ“ Why This Blog? This is where I share my journey, lessons learned, and the latest trends in DevOps and software engineering. Whether you're a seasoned pro or just starting out, join me as we explore the tools, tricks, and best practices that make the tech world tick. ๐ŸŒŸ Letโ€™s Build the Future, One Pipeline at a Time. Connect with me, share your thoughts, and letโ€™s automate the world together!