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 2limits 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
~/Downloadsor~/Projectsfolder to spot heavy folders.
๐งฑ df -h โ Disk Space on Mounted Devices
df -h
See total size, used, available, and usage % for your drives.
โ๏ธ Use
dufor per-folder size; usedffor 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 secondshtop: 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
| Command | What It Does | Example |
pwd | Show current directory | pwd |
tree | Visualize folder structure | tree -L 2 |
du -sh * | Show size of each item in current dir | du -sh * |
df -h | Disk usage across all mounted devices | df -h |
free -h | RAM and swap usage | free -h |
ps aux | All active processes | ps aux |
top / htop | Real-time system monitor | htop |
whoami | Your current user | whoami |
id | User + group IDs | id |
๐งช 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






