Htop Batch Alternatives, Exports, and Companion Commands

Practical command-line companions and non-interactive alternatives to htop for logs, scripts, and copyable output.

View
StandardDetailedCompact
Export
Copy the compact sheet, download it, or print it.
Download
`D` dense toggle · `C` copy all
## Non-interactive companions
Capture a batch snapshot with top
top -b -n 1 | head -100

# Use top when you need non-interactive output.

List top CPU consumers with ps
ps -eo pid,user,%cpu,%mem,comm --sort=-%cpu | head

# Get a quick textual top list.

List top memory consumers with ps
ps -eo pid,user,%cpu,%mem,comm --sort=-%mem | head

# Sort textual output by memory use.

Read detailed status from /proc
sed -n '1,120p' /proc/12345/status

# Inspect one process beyond what htop shows.

Inspect limits for a process
sed -n '1,120p' /proc/12345/limits

# Check open-file or resource limits.

## Export and correlation recipes
Correlate a PID with journal logs
journalctl -u myservice --since '10 minutes ago'

# Inspect logs for a systemd service around an incident.

Inspect open files for a PID
sudo lsof -p 12345 | head -50

# Use shell output when you need to save or grep the results.

Inspect sockets owned by a process
sudo lsof -Pan -p 12345 -i

# Check network connections for the suspected process.

List threads for one PID with ps
ps -T -p 12345 -o pid,tid,pcpu,pmem,comm

# Inspect thread-level CPU consumers.

Use smem for proportional memory analysis
smem -rtk | head

# Pair htop with PSS-focused memory reporting when available.

Recommended next

No recommendations yet.