How to Investigate a Suspicious Process Running in Linux



By ATS Staff - November 21st, 2026

Cybersecurity   Linux  


Linux is widely recognized for its stability, security, and reliability. However, like any operating system, it can become a target for malware, unauthorized access, cryptocurrency miners, rootkits, and other malicious activities. One common indication of a compromised Linux system is an unfamiliar or suspicious process consuming system resources, establishing unexpected network connections, or running under an unusual user account.
Investigating suspicious processes is an essential Linux system administration and cybersecurity skill. Whether you manage a production web server, cloud infrastructure, or a personal Linux machine, knowing how to identify and investigate suspicious processes can help prevent security breaches, data theft, and service disruptions. This article explains how to identify, analyze, and investigate suspicious processes using built-in Linux utilities and additional security tools.

1. Identify Running Processes

The first step is to examine currently running processes and identify anything unusual. Use the following command:
ps aux
This displays all running processes, including:
  • USER: The account running the process.
  • PID: The process identification number.
  • %CPU: CPU utilization.
  • %MEM: Memory utilization.
  • VSZ: Virtual memory size.
  • RSS: Resident memory usage.
  • STAT: Process state.
  • START: Process start time.
  • COMMAND: The command used to start the process.
For a more organized view:
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:
  • Processes consuming excessive CPU or memory without a legitimate reason.
  • Unknown executable names.
  • Processes running as root unexpectedly.
  • Applications running from /tmp, /var/tmp, or hidden directories.
  • Multiple instances of unfamiliar processes.
  • Processes with unusually long execution times.
Keep in mind that high CPU utilization alone does not indicate malware. Legitimate applications, scheduled jobs, and database operations can also consume significant resources.

2. Investigate the Process Executable Location

One of the most important steps is determining where the suspicious process executable is located. First, identify its PID:
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:
  • Executables running from /tmp or /dev/shm.
  • Hidden executable files in user home directories.
  • Programs disguised with names similar to legitimate Linux services.
  • Executables located in unexpected directories.
  • Processes running deleted executables.
For example, a process named systemd running from /tmp/.systemd should be investigated immediately. The legitimate systemd executable normally resides in a system directory.

3. Examine Process Details Using /proc

Linux exposes detailed information about running processes through the /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:
  • Process name.
  • Process state.
  • Parent process ID.
  • User and group IDs.
  • Memory usage.
  • Thread count.
Process environment variables:
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.

4. Investigate Network Connections

Suspicious processes frequently communicate with external servers for command-and-control operations, downloading additional malware, or transferring stolen information. Use the following command to inspect active network connections:
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:
  • Connections to unfamiliar public IP addresses.
  • Unexpected outbound connections.
  • Processes listening on unusual ports.
  • Applications communicating with suspicious destinations.
  • Connections to unknown servers over uncommon ports.
For example, a web server unexpectedly establishing outbound connections to an unfamiliar external IP address may warrant further investigation. To examine DNS activity and network traffic, additional tools such as tcpdump and Wireshark can be useful. Example:
sudo tcpdump -i any -nn
This captures network packets across available interfaces.

5. Examine Parent and Child Processes

Understanding how a process started is essential when investigating suspicious activity. Use:
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:
  • An unauthorized shell session.
  • A compromised web application.
  • A modified startup script.
  • An unexpected cron job.
  • A malicious service.
  • An exploited application running under a web server account.
For example, if an unfamiliar process is running under 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.

6. Check File Permissions and Executable Integrity

After identifying the executable, inspect its permissions and ownership.
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:
  • Unexpected ownership by root.
  • Unusual executable permissions.
  • Recently modified system binaries.
  • Hidden executable files.
  • Unexpected SUID or SGID permissions.
To identify files with the SUID permission bit:
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.

7. Investigate Scheduled Tasks and Persistence Mechanisms

Malware often attempts to survive system restarts by creating scheduled tasks or modifying startup configurations. Check the current user's cron jobs:
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.

8. Check Authentication and System Logs

System logs can provide valuable evidence about when suspicious activity started and how an attacker may have gained access. On Ubuntu and Debian, inspect authentication logs:
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:
  • Unexpected SSH logins.
  • Login attempts from unfamiliar IP addresses.
  • New user accounts.
  • Unexpected privilege escalation.
  • Services restarting repeatedly.
  • Applications launching unusual commands.
Correlate timestamps from process execution, authentication events, and system logs to establish a timeline.

9. Use Advanced Tools for Deeper Investigation

When built-in Linux utilities are insufficient, several specialized tools can provide additional visibility.

lsof

Lists open files, network sockets, and other resources associated with processes.
sudo lsof -p 2456

strace

Tracks system calls made by a process.
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.

chkrootkit

Checks for common indicators of rootkits.
sudo apt install chkrootkit
sudo chkrootkit

rkhunter

Checks system files and configurations for common rootkit indicators.
sudo apt install rkhunter
sudo rkhunter --check

ClamAV

An antivirus engine that can scan files for known malware.
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.

10. What to Do When a Suspicious Process Is Confirmed

If your investigation indicates that a process is malicious, avoid immediately terminating it without considering the security implications. On a production server, killing a process may destroy valuable forensic evidence or trigger a restart mechanism that launches it again. Follow a structured incident-response approach. Step 1: Preserve evidence Record the PID, executable location, command line, process owner, network connections, timestamps, and relevant logs. For example:
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:
  • Weak SSH credentials.
  • An exposed or vulnerable web application.
  • An outdated Linux package.
  • An insecure PHP script.
  • Stolen credentials.
  • An exposed database or administrative interface.
Step 6: Rotate credentials and restore integrity Change compromised passwords, rotate SSH keys, API tokens, database credentials, and other potentially exposed secrets. If root-level compromise or a rootkit is suspected, do not assume that removing the suspicious process restores system integrity. Rebuilding the server from trusted installation media or a known-good image is often the safest recovery approach.

11. Practical Investigation Example

Consider an Ubuntu web server where CPU utilization suddenly increases to 90%, even though normal website traffic has not changed. You discover an unfamiliar process named 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.

12. Best Practices for Linux Server Security

Preventing unauthorized processes is easier than recovering from a compromised server. Consider implementing the following security practices:
  1. Keep the operating system updated: Regularly install security patches and updates.
  2. Secure SSH access: Disable password authentication where practical, use SSH keys, and restrict root login.
  3. Configure a firewall: Use UFW, nftables, or an appropriate cloud firewall to restrict unnecessary network access.
  4. Monitor system resources: Use tools such as htop, Netdata, or Prometheus to detect unusual CPU and memory consumption.
  5. Review running services: Disable unnecessary services and investigate unfamiliar processes.
  6. Implement file integrity monitoring: Use tools such as AIDE to detect unexpected changes to critical system files.
  7. Secure web applications: Keep PHP, Python, frameworks, plugins, and dependencies updated.
  8. Monitor authentication: Review SSH access logs and configure Fail2ban where appropriate.
  9. Maintain backups: Keep regular, tested, and preferably offline or immutable backups.
  10. Centralize logging: Forward important system and security logs to a separate, protected logging server.

Conclusion

Investigating suspicious Linux processes requires more than simply identifying an unfamiliar process name or terminating an application consuming excessive resources. A proper investigation involves examining process execution paths, parent-child relationships, environment variables, network connections, file permissions, scheduled tasks, authentication logs, and system services. Linux provides powerful built-in utilities such as 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.
Add an incident-response warningClarify safe containment steps




Popular Categories

Agile 2 Android 2 Artificial Intelligence 52 Backup Tools 2 Blockchain 2 Cloud Storage 5 Code Editors 2 Computer Languages 13 Cybersecurity 10 Data Science 19 Database 10 Digital Marketing 3 Ecommerce 4 Email Server 2 Finance 3 Google 6 HTML-CSS 2 Industries 6 Infrastructure 4 iOS 3 IoT 1 Javascript 6 Latest Technologies 46 Linux 11 LLMs 11 Machine Learning 32 Maths & Stats 1 Mobile 3 MySQL 3 Open source 1 Operating Systems 7 PHP 2 Postgres 1 Project Management 3 Python Programming 29 Rust 2 SEO - AEO 5 Software Development 51 Software Testing 4 Web Server 8 Work Ethics 2
Recent Articles
How to Investigate a Suspicious Process Running in Linux
Cybersecurity

Rust vs Python: Performance, Productivity, and Choosing the Right Language in 2026
Latest Technologies

Axum vs. FastAPI: Which Backend Framework Uses Less Server Resources?
Computer Languages

PostgreSQL Optimization Techniques For Backend Engineers
Data Science

Comprehensive Web Application Testing Plan
Software Testing

The Chief AI Officer Role
Artificial Intelligence

PACS vs. CAMT: Decoding the Core Messaging Categories of ISO 20022
Data Science

UFW vs. Firewalld: Firewall Comparison
Cybersecurity

Ubuntu vs. AlmaLinux: Server OS Choice
Linux

A Production-Ready Backup Architecture
Backup Tools

rsync vs rclone vs restic — A Practical, In-Depth Comparison
Backup Tools

A Comprehensive Guide to rsync
Cloud Storage

Tabulator Data Grid
Data Science

ESP32: Capabilities and Practical Project Examples
IoT

Prompt Engineering: Chain-of-Thought vs Tree-of-Thought
Artificial Intelligence

Prompt Engineering: Zero-Shot vs Few-Shot Prompting
Data Science

Lambda Functions in Python Programming
Python Programming

functools in Python Programming
Latest Technologies

MySQL Database Sharding: A Comprehensive Guide to Horizontal Scaling
Database

Database Sharding: Scaling Horizontally for Modern Applications
Database

Best Python Packages to Learn in 2026
Artificial Intelligence

Step-by-Step Guide to Google Play Store Submission
Google

Step-by-Step Guide to App Store Submission
iOS

Google Nano Banana: The AI Image Tool That Took the Internet by Storm
Artificial Intelligence

Best Practices For Software Development Using Google Gemini 2.5 Pro Through Prompt Engineering
Data Science

Email-Based Passcode Authentication: A Secure and User-Friendly Approach
Software Development

AI Hot Topics Mid-2025
Artificial Intelligence

The Top 3 Python Web Frameworks for 2025: Django, FastAPI, and Flask
Python Programming

Best NLP Libraries for Natural Language Processing in 2025
Artificial Intelligence

Python Implementation of a Simple Blockchain
Blockchain