By ATS Staff - November 21st, 2026
Cybersecurity Linux
ps aux
This displays all running processes, including:
ps -eo pid,ppid,user,%cpu,%mem,etime,stat,cmd --sort=-%cpu
This sorts processes by CPU consumption, making it easier to identify processes consuming unusually high resources.
You can also use:
top
Or install and run the more user-friendly interactive process monitor:
sudo apt install htop
htop
What to look for:
/tmp, /var/tmp, or hidden directories.ps aux | grep suspicious_process
Replace suspicious_process with the actual process name.
For example, if the PID is 2456, execute:
sudo readlink -f /proc/2456/exe
This reveals the actual executable path.
You can also inspect the process command line:
sudo cat /proc/2456/cmdline | tr '\0' ' '
Check the process working directory:
sudo readlink -f /proc/2456/cwd
And inspect its root directory:
sudo readlink -f /proc/2456/root
Suspicious indicators include:
/tmp or /dev/shm.systemd running from /tmp/.systemd should be investigated immediately. The legitimate systemd executable normally resides in a system directory.
/proc virtual filesystem.
Each running process has its own directory identified by its PID.
For example:
ls -la /proc/2456/
You can inspect several important files.
Process status:
cat /proc/2456/status
This provides information about:
sudo cat /proc/2456/environ | tr '\0' '\n'
Environment variables can reveal configuration details, execution paths, temporary directories, and potentially suspicious injected settings.
Be careful when examining or sharing this output because environment variables may contain passwords, API keys, or other secrets.
Process command line:
sudo tr '\0' ' ' < /proc/2456/cmdline
Process file descriptors:
sudo ls -la /proc/2456/fd/
File descriptors can reveal files, sockets, pipes, and other resources accessed by the process.
The /proc filesystem is particularly useful because it provides detailed runtime information without requiring additional monitoring software.
sudo ss -tulpn
For established TCP connections:
sudo ss -tpn state established
You can also use:
sudo lsof -Pan -p 2456 -i
This displays network connections associated with a specific process.
To identify all network connections and associated processes:
sudo lsof -i -n -P
Look for:
tcpdump and Wireshark can be useful.
Example:
sudo tcpdump -i any -nn
This captures network packets across available interfaces.
pstree -p
This displays processes in a hierarchical tree.
For an individual process:
ps -o pid,ppid,user,lstart,cmd -p 2456
The PPID field identifies the parent process.
You can investigate the parent process using:
ps -fp PARENT_PID
A suspicious process might have been launched by:
www-data, investigate whether it originated from Apache, Nginx, PHP-FPM, or a web application.
A web application spawning an unfamiliar shell or downloading an executable should be treated as a potential security incident.
ls -lah /path/to/executable
Check its file type:
file /path/to/executable
Calculate its SHA-256 checksum:
sha256sum /path/to/executable
You can also inspect its metadata:
stat /path/to/executable
Pay attention to:
sudo find / -type f -perm -4000 -ls 2>/dev/null
An attacker may exploit SUID binaries to gain elevated privileges.
However, many legitimate Linux applications use SUID permissions, so compare findings against a trusted baseline rather than assuming every result is malicious.
For Debian and Ubuntu systems, you can verify installed package files using:
sudo dpkg -V
This helps identify modifications to files managed by installed Debian packages.
crontab -l
Check root's cron jobs:
sudo crontab -l
Inspect system-wide scheduled tasks:
ls -lah /etc/cron.d/
ls -lah /etc/cron.daily/
ls -lah /etc/cron.hourly/
ls -lah /etc/cron.weekly/
Check systemd services:
systemctl list-units --type=service --all
Inspect enabled services:
systemctl list-unit-files --type=service --state=enabled
For a suspicious service:
systemctl status suspicious.service
Inspect its service definition:
systemctl cat suspicious.service
Also examine common startup locations:
ls -lah /etc/systemd/system/
ls -lah /etc/init.d/
ls -lah /etc/rc.local
Look for unfamiliar services, unexpected scripts, unusual executable paths, and commands that download or execute remote files.
sudo less /var/log/auth.log
Search for failed SSH login attempts:
sudo grep "Failed password" /var/log/auth.log
Search for successful SSH authentication:
sudo grep "Accepted" /var/log/auth.log
Inspect recent login history:
last -a
Check currently logged-in users:
who
You can also inspect system logs using journalctl:
sudo journalctl -xe
For a particular service:
sudo journalctl -u suspicious.service
Investigate:
sudo lsof -p 2456
sudo strace -f -p 2456
This can reveal file access, network operations, process creation, and other system interactions.
Be aware that attaching strace can affect process performance and timing.
sudo apt install chkrootkit
sudo chkrootkit
sudo apt install rkhunter
sudo rkhunter --check
sudo apt install clamav
sudo freshclam
sudo clamscan -r /tmp /var/tmp
These tools are useful for identifying potential threats, but no single scanner can guarantee that a system is clean. False positives are also possible.
ps auxww
sudo ss -tulpn
sudo lsof -p 2456
sudo readlink -f /proc/2456/exe
Preserve suspicious files and relevant logs in a secure location. If necessary, capture a forensic image or memory snapshot before making changes.
Step 2: Isolate the system
If active compromise is suspected, isolate the affected machine from the network using an appropriate network firewall or security group.
Avoid shutting down the system immediately if volatile forensic evidence needs to be collected.
Step 3: Terminate or contain the process
After collecting necessary evidence, you can terminate a confirmed malicious process:
sudo kill -TERM 2456
If it refuses to terminate:
sudo kill -KILL 2456
Use SIGKILL only when necessary because the process cannot perform cleanup.
Step 4: Investigate persistence
Remove malicious cron jobs, unauthorized systemd services, modified startup scripts, and other persistence mechanisms after preserving evidence.
Step 5: Investigate the initial entry point
Determine whether the compromise originated from:
kworkerx consuming excessive CPU resources.
Start by locating the process:
ps aux | grep kworkerx
Assume its PID is 2456.
Inspect the executable:
sudo readlink -f /proc/2456/exe
Suppose the result is:
/tmp/.cache/kworkerx
This is suspicious because the executable is running from a temporary directory.
Check its command line:
sudo tr '\0' ' ' < /proc/2456/cmdline
Inspect network connections:
sudo lsof -Pan -p 2456 -i
Check its parent process:
ps -o pid,ppid,user,cmd -p 2456
Investigate its startup mechanism:
sudo crontab -l
systemctl list-units --type=service --all
Finally, inspect the executable:
file /tmp/.cache/kworkerx
sha256sum /tmp/.cache/kworkerx
This investigation may reveal an unauthorized cryptocurrency miner or another malicious executable.
The important lesson is that suspicious process names alone are not sufficient evidence. The executable location, parent process, network activity, ownership, and persistence mechanisms must all be examined before drawing a conclusion.
ps, top, ss, lsof, strace, and journalctl that make it possible to investigate most suspicious processes without installing extensive monitoring software.
For system administrators and cybersecurity professionals, developing a systematic investigation approach is essential for maintaining secure, reliable, and trustworthy Linux infrastructure.
Remember: An unfamiliar process is not necessarily malicious, but an unexplained process deserves investigation—especially when it runs with elevated privileges, executes from temporary directories, or communicates with unknown external servers.