$120 tested Claude codes · real before/after data · Full tier $15 one-timebuy --sheet=15 →
$Free 40-page Claude guide — setup, 120 prompt codes, MCP servers, AI agents. download --free →
clskills.sh — terminal v2.4 — 2,347 skills indexed● online
[CL]Skills_
LinuxbeginnerNew

Linux Process

Share

Monitor and manage processes with ps, top, htop, and signals

Works with OpenClaude

You are a Linux system administrator. The user wants to monitor and manage running processes using ps, top, htop, and process signals (SIGTERM, SIGKILL, etc.).

What to check first

  • Run ps aux to see if basic process listing works on your system
  • Check if top and htop are installed with which top and which htop (htop may need installation via apt install htop or yum install htop)

Steps

  1. Use ps aux to list all running processes with full details — the output shows USER, PID, CPU%, MEM%, COMMAND columns essential for identification
  2. Filter processes by name with ps aux | grep nginx to find specific processes (add -v grep to exclude the grep command itself)
  3. View process hierarchy and parent-child relationships with ps -ef --forest to understand dependencies
  4. Sort processes by memory usage with ps aux --sort=-%mem | head -20 to identify memory hogs
  5. Launch top for real-time monitoring — press q to quit, M to sort by memory, P to sort by CPU, k to kill a process interactively
  6. Use htop for a more user-friendly interface with color coding — arrow keys navigate, F9 sends signals, F10 quits
  7. Send signals to processes with kill -SIGTERM <PID> (graceful shutdown) or kill -SIGKILL <PID> (force kill, PID 9)
  8. Use pkill -f "process_name" to kill all processes matching a pattern without needing the exact PID

Code

#!/bin/bash
# Linux Process Monitoring and Management Script

# Function 1: List all processes sorted by memory usage
list_by_memory() {
    echo "=== Top 10 processes by memory usage ==="
    ps aux --sort=-%mem | head -11
}

# Function 2: Find process by name
find_process() {
    local process_name=$1
    echo "=== Searching for process: $process_name ==="
    ps aux | grep -E "^|$process_name" | grep -v grep
}

# Function 3: Show process tree for a specific process
show_process_tree() {
    local process_name=$1
    echo "=== Process tree for $process_name ==="
    ps -ef --forest | grep -E "^|$process_name" | head -20
}

# Function 4: Monitor CPU usage in real-time
monitor_cpu() {
    echo "=== Top 5 CPU consumers (updates every 2 seconds, press Ctrl+C to exit) ==="
    watch -n 2 'ps aux --sort=-%cpu | head -6'
}

# Function 5: Send signal to process by name
kill_process() {
    local process_name=$1
    local signal=${2:-SIGTERM}

Note: this example was truncated in the source. See the GitHub repo for the latest full version.

Common Pitfalls

  • Treating this skill as a one-shot solution — most workflows need iteration and verification
  • Skipping the verification steps — you don't know it worked until you measure
  • Applying this skill without understanding the underlying problem — read the related docs first

When NOT to Use This Skill

  • When a simpler manual approach would take less than 10 minutes
  • On critical production systems without testing in staging first
  • When you don't have permission or authorization to make these changes

How to Verify It Worked

  • Run the verification steps documented above
  • Compare the output against your expected baseline
  • Check logs for any warnings or errors — silent failures are the worst kind

Production Considerations

  • Test in staging before deploying to production
  • Have a rollback plan — every change should be reversible
  • Monitor the affected systems for at least 24 hours after the change

Quick Info

CategoryLinux
Difficultybeginner
Version1.0.0
AuthorClaude Skills Hub
linuxprocessesmonitoring

Install command:

curl -o ~/.claude/skills/linux-process.md https://clskills.in/skills/linux/linux-process.md

Related Linux Skills

Other Claude Code skills in the same category — free to download.

Want a Linux skill personalized to YOUR project?

This is a generic skill that works for everyone. Our AI can generate one tailored to your exact tech stack, naming conventions, folder structure, and coding patterns — with 3x more detail.