Prerequisites
Before viewing processes, make sure you have:
- SSH access to your VPS
- Your server IP address and password
What are Processes?
Processes are running programs on your server - web servers, databases, cron jobs, user sessions, and system services.
Method 1: Using the ps Command
Connect to your VPS:
ssh hxroot@YOUR_SERVER_IP -p 22View all processes:
ps auxOutput columns:
- USER - Who owns the process
- PID - Process ID number
- %CPU - CPU usage percentage
- %MEM - Memory usage percentage
- VSZ/RSS - Virtual/Physical memory used
- STAT - Process state (R=running, S=sleeping, Z=zombie)
- START - When process started
- TIME - Total CPU time used
- COMMAND - The command that started it
Common ps Filters
Show processes by user:
ps -u usernameShow process hierarchy (tree view):
ps auxfShow only your processes:
ps xShow all processes with full format:
ps -efFind a specific process (e.g., nginx):
ps aux | grep nginxMethod 2: Using the top Command (Interactive)
topTop shows real-time updating process list. Keyboard shortcuts:
- q - Quit
- P - Sort by CPU usage
- M - Sort by memory usage
- k - Kill a process (enter PID)
- r - Renice (change priority)
- 1 - Show each CPU core individually
- c - Show full command path
Method 3: Using htop (Better Alternative)
Install htop first:
apt install htop -yRun htop:
htophtop features:
- Color-coded output
- Mouse support
- Easier process killing (F9)
- Tree view (F5)
- Search processes (F3)
Method 4: Using pgrep (Find Process by Name)
Get PID of a process:
pgrep nginxGet PID with process name:
pgrep -l nginxMethod 5: Check Your Own Processes Only
ps uCount Total Running Processes
ps aux | wc -lSort Processes by Memory Usage
ps aux --sort=-%mem | head -10Sort Processes by CPU Usage
ps aux --sort=-%cpu | head -10Show Process Tree (pstree)
pstreeWith PIDs:
pstree -pUnderstanding Process States
- R - Running or runnable
- S - Sleeping (waiting for event)
- D - Uninterruptible sleep (usually disk I/O)
- Z - Zombie (dead but not cleaned up)
- T - Stopped (by job control)
- I - Idle kernel thread
⚠️ High number of zombie processes (Z) indicates an issue that may require reboot.
Real-time Process Monitoring Script
#!/bin/bash
while true; do
clear
echo "=== Top 5 CPU Processes ==="
ps aux --sort=-%cpu | head -6
echo ""
echo "=== Top 5 Memory Processes ==="
ps aux --sort=-%mem | head -6
sleep 2
done✅ You can now view and monitor all running processes on your Hostxpeed VPS.