Htop Remote, Container, and Server Recipes

Common htop workflows for SSH sessions, containers, services, and production troubleshooting on Linux hosts.

View
StandardDetailedCompact
Export
Copy the compact sheet, download it, or print it.
Download
`D` dense toggle · `C` copy all
## Remote SSH workflows
Run htop over SSH
ssh user@server 'htop'

# Open a remote session directly into htop.

Run htop inside tmux on a remote host
ssh user@server 'tmux new-session -A -s ops htop'

# Keep monitoring alive if your connection drops.

Run with elevated privileges
sudo htop

# See more processes and use all process actions.

Run read-only with sudo
sudo htop --readonly

# Full visibility without accidental mutations.

Focus on PostgreSQL processes
sudo htop -u postgres -t

# Monitor a database host by user.

## Containers and services
Run htop inside a running container
docker exec -it web htop

# Inspect the process table from the container's perspective.

Run htop in a Kubernetes pod
kubectl exec -it deploy/api -- htop

# Attach an interactive process view to a pod shell.

Watch only systemd-managed service processes by pattern
htop -p "$(pgrep -d, -f 'nginx:|nginx')"

# Generate a PID list for one service family.

Start a memory-focused out-of-memory investigation
sudo htop --sort-key=PERCENT_MEM -d 5

# Sort by memory and refresh quickly.

Watch for short CPU spikes
sudo htop --sort-key=PERCENT_CPU -d 5

# Use faster refresh and CPU sorting.

Recommended next

No recommendations yet.