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 on servers, over SSH, and in narrow terminal environments.

Run htop over SSH

Open a remote session directly into htop.

bashANYsshremote
bash
ssh user@server 'htop'
Notes

Fast way to inspect a remote machine without a long interactive shell session.

Run htop inside tmux on a remote host

Keep monitoring alive if your connection drops.

bashANYsshtmuxremote
bash
ssh user@server 'tmux new-session -A -s ops htop'
Notes

Great for production monitoring sessions that should survive disconnects.

Run with elevated privileges

See more processes and use all process actions.

bashANYsudoprivileges
bash
sudo htop
Notes

Often needed to inspect other users' processes fully or send privileged signals.

Run read-only with sudo

Full visibility without accidental mutations.

bashANYsudoreadonlyproduction
bash
sudo htop --readonly
Notes

Useful on production systems when you want observability but not intervention from the UI.

Focus on PostgreSQL processes

Monitor a database host by user.

bashANYpostgresdatabase
bash
sudo htop -u postgres -t
Notes

Shows process relationships for Postgres background workers and connections.

Containers and services

Recipe patterns for containers and system services.

Run htop inside a running container

Inspect the process table from the container's perspective.

bashANYdockercontainer
bash
docker exec -it web htop
Notes

Useful for debugging entrypoints, workers, and PID 1 behavior.

Run htop in a Kubernetes pod

Attach an interactive process view to a pod shell.

bashANYkubernetespod
bash
kubectl exec -it deploy/api -- htop
Notes

Works when htop is present in the container image.

Watch only systemd-managed service processes by pattern

Generate a PID list for one service family.

bashANYnginxservicepgrep
bash
htop -p "$(pgrep -d, -f 'nginx:|nginx')"
Notes

Useful when workers or master processes share a recognizable command pattern.

Start a memory-focused out-of-memory investigation

Sort by memory and refresh quickly.

bashANYmemoryoom
bash
sudo htop --sort-key=PERCENT_MEM -d 5
Notes

Good first step when a server is swapping or near OOM.

Watch for short CPU spikes

Use faster refresh and CPU sorting.

bashANYcpuperformance
bash
sudo htop --sort-key=PERCENT_CPU -d 5
Notes

Useful when bursts are too short to catch with a slower refresh interval.

Recommended next

No recommendations yet.