Check Running Processes in Linux: Commands for VPS and Servers

Rahma Rashad

Last Updated:

hero-image

If you use a Linux VPS or dedicated server, checking running processes is a quick way to find out why your server is slow, using too much CPU or memory, restarting unexpectedly, or acting strangely. This helps you spot which processes are active, see how much they use, and decide what to do next.

When you run tasks on a VPS, seeing which processes are active helps you choose the appropriate resources and know when to upgrade.

  1. ps — List Running Processes (Snapshot)

The ps command shows you a list of all running processes at that moment. It’s helpful for getting a quick overview, searching the output, or copying details for support.

Basic Usage

ps

This command shows processes connected to your current terminal session.

Most Common VPS/Server Usage

Display All Running Processes With Complete Details

ps aux

You’ll see columns such as:

  • USER (owner)

  • PID (process ID)

  • %CPU / %MEM

  • VSZ / RSS (virtual vs resident memory)

  • STAT (state)

  • START / TIME

  • COMMAND

On a server, ps aux quickly shows which processes are using resources right now.

Show Processes In “Full Format” (Common Admin View)

ps -ef

This is useful if you want to see parent and child process relationships (PPID) and command lines in a standard format.

Useful ps Options

  • ps aux: all processes, BSD-style output

  • ps -ef: all processes, UNIX-style output

  • ps -u <user>:  processes for a specific user

  • ps -p <pid>:  details for one PID

  • ps --forest: shows the parent and child structure in a tree format

 

Examples:

ps -u www-data

ps -p 1234

ps -ef --forest

Filter Processes by Name

If you think your web server is using too much CPU:

ps aux | grep -E 'nginx|apache2|httpd'

If you want to check on a database process:

ps aux | grep -E 'mysql|mariadbd|postgres'

Sort Processes by Memory or CPU Usage

Top memory consumers (RSS):

ps aux --sort=-rss | head -n 15

Top CPU consumers:

ps aux --sort=-%cpu | head -n 15

In practice, these are the first things to check if your VPS is slow or you get alerts about high resource use.



  1. top — Real-Time Process Monitoring

top is the main tool for live monitoring. Unlike ps, it updates in real time and helps you spot spikes as they happen.

top

Key Information to Check in top

Common columns you’ll see:

  • PID — process ID

  • USER — owner

  • PR / NI — priority / nice value

  • VIRT / RES — virtual vs resident memory

  • %CPU / %MEM

  • TIME+ — cumulative CPU time

  • COMMAND

At the top of the screen, you’ll also see system summary stats such as:

  • load average (overall system pressure)

  • CPU usage breakdown

  • Mem/Swap usage

Quick top Controls and Shortcuts

Inside top, you can:

  • Press P → sort by CPU

  • Press M → sort by memory

  • Press 1 → show per-core CPU

  • Press k → kill a process by PID (use carefully)

  • Press q → quit

If your VPS suddenly stops responding, top helps you find the process causing the problem in real time, especially during traffic spikes or scheduled jobs.

 

  1. htop — Interactive, Easier Top

htop is a user-friendly, interactive process viewer. Many admins prefer it for VPS work because it makes it easier to:

  • search/filter processes

  • see CPU cores visually

  • kill multiple processes

  • view process trees

Install htop on a VPS

Debian/Ubuntu:

sudo apt update && sudo apt install htop

RHEL 8+ / AlmaLinux / Rocky:

sudo dnf install htop

RHEL 7 (older):

sudo yum install htop

Then run:

htop


Why htop is Helpful on Servers

  • You can select a process and kill it without typing the PID

  • You can quickly spot memory pressure and swap usage

  • You can filter by process name (great for web/db/service checks)

On servers that run many applications, htop is especially helpful. It lets you quickly see which service is causing problems when several run together.

 

  1. pgrep — Find Process IDs By Name

pgrep is the fastest way to find processes without sorting through ps output. It returns matching PIDs.

Find nginx:

pgrep nginx

Find Apache (common names vary):

pgrep apache2

pgrep httpd

Find all PIDs for a service and include full command lines:

pgrep -a nginx

Find processes owned by a specific user:

pgrep -u www-data

On a VPS, pgrep is handy when you need a PID quickly, like checking if a service is running or sending a signal to a stuck process.

 

  1. pstree — See Process Relationships

If you think a process is creating child processes or want to see how services are related, pstree shows this clearly.

Show the full tree:

Pstree

Show PIDs:

pstree -p

Show a specific user’s processes:

pstree username

Show a specific PID tree:

pstree -p 1234

This is useful on application servers where a main process, like nginx, php-fpm, or a queue worker, starts several child processes, and you need to see what’s running.

 

  1. Killing A Process Safely: kill, killall, and pkill

After checking processes, the next question is often, "How do I stop it?"

kill — Stop A Process by PID

Graceful termination (recommended first):

kill 1234

If it doesn’t stop, force kill (last resort):

kill -9 1234

Tip: The -9 (SIGKILL) option stops a process immediately, but it can cause data loss if the process was writing files or handling transactions. Use it only if normal termination does not work.

killall — Stop Processes By Name

Stop all processes with a specific name:

sudo killall nginx

pkill — Stop Processes By Name (Pattern-Aware)

sudo pkill nginx

On a VPS, you might need to kill stuck workers, crashed scripts, or runaway backups to quickly restore stability. After that, you can check what caused the issue.

 

Quick “Which Command Should I Use?” Cheat Sheet

  • Need a snapshot list? → ps aux

  • Need real-time monitoring? → top or htop

  • Need to find a PID fast? → pgrep

  • Need to understand parent/child relationships? → pstree

  • Need to stop a process? → kill, pkill, killall

 

FAQs

  1. How do I check running processes on my Linux server?

Use ps aux for a snapshot or top/htop for real-time monitoring. On a VPS, top or htop is usually the fastest way to spot a resource spike.

  1. How do I find a process by name in Linux?

Use pgrep <name> to return PIDs, or ps aux | grep <name> if you want to inspect full output. pgrep -a <name> is useful because it shows matching command lines.

  1. What’s the difference between top and htop?

Both show live processes, but htop is interactive and easier to filter, sort, and manage processes. Many admins prefer htop for day-to-day VPS monitoring.

  1. How do I kill a process that won’t stop?

Try kill <PID> first. If it won’t terminate, use kill -9 <PID> as a last resort. If you need to stop processes by name, use pkill <name> or killall <name> carefully.

Reliable Hosting You Can Trust

Experience lightning-fast, secure hosting that easily scales as your business grows, empowering you to succeed online effortlessly.

Start Hosting Now

Join Our Newsletter

Your information will never be Shared with third parties, and you can unsubscribe from our updates at any time.