Quick triage — identify top CPU processes and all established network connections
Quick triage — identify top CPU processes and all established network connections
Linux CLI / Incident Response
Command
ps aux --sort=-%cpu | head -20 && lsof -i -n -P | grep ESTABLISHED
Syntax
ps aux --sort=-<field> && lsof -i -n -P
Use case
First minutes of incident response on a potentially compromised Linux host — identify malicious processes and active attacker connections.
Explanation
Incident response live triage commands: • ps aux --sort=-%cpu → List processes sorted by CPU (descending) • head -20 → Show top 20 CPU consumers • lsof -i → List all open network files • -n → No hostname resolution • -P → No port name resolution (show port numbers) • grep ESTABLISHED → Active connections only Look for: unknown processes, unusual parent-child relationships, unexpected outbound connections.
Example output
USER PID %CPU %MEM COMMAND
root 4432 98.2 0.1 /tmp/.hidden/cryptominer
www 1234 2.1 0.5 nginx
COMMAND PID FD TYPE NODE NAME
python3 4432 3u IPv4 TCP 0.0.0.0:4444->203.0.113.1:51234 (ESTABLISHED)
More examples
Primary example
ps aux --sort=-%cpu | head -20 && lsof -i -n -P | grep ESTABLISHED
First minutes of incident response on a potentially compromised Linux host — identify malicious processes and active attacker connections.
Related
Filter high severity Wazuh alerts.
Filter high severity Wazuh alerts.
agent.name:* AND rule.level:>=10
Find failed authentication events with source IP context.
Find failed authentication events with source IP context.
rule.groups:authentication_failed AND data.srcip:*
Review file integrity modifications.
Review file integrity modifications.
rule.groups:syscheck AND syscheck.event:modified