CMD Master
Back to Blog
UpdatedArnošt Havelka

How to List Running Processes in Bash with ps

Use ps in Bash to list running processes, read PID and owner columns, inspect one process, and choose when a live top view is more useful.

Start Interactive Lesson
How to List Running Processes in Bash with ps

To see what is running from a Bash terminal, start with ps. The plain command shows processes attached to your current terminal. Use ps -ef when you need a broader system-wide list, then read the PID, owner, status, and command together before acting on any process. The process-list lesson lets you practise reading that output without touching a real workload.

Start with the current terminal

Run the command without options first:

ps

The exact headings vary by operating system, but a short result commonly includes:

  • PID: the process ID used by tools such as kill.
  • TTY: the terminal associated with the process.
  • TIME: CPU time consumed by the process.
  • CMD or COMMAND: the program that was started.

This small view is useful when you want to confirm a command started from the same terminal. It is not a complete inventory of everything running on the computer.

Try the command

List the processes attached to this terminal.

Build the command
ps
Terminal
~$ps
PID TTY TIME CMD 1234 pts/0 00:00:01 bash 2345 pts/0 00:00:00 ps 3456 pts/0 00:00:05 node 4567 pts/0 00:00:02 worker

List processes across the system

For a fuller snapshot, use:

ps -ef

This form normally includes the process owner, PID, parent PID, start information, and command line. It is easier to save, search, or include in an incident note than a constantly changing screen.

You will also see ps aux in Linux documentation. The two forms come from different option styles and can show slightly different columns. Both are widely used, but scripts should choose one known format instead of assuming every Unix-like system prints identical output.

When you need specific fields, request them explicitly:

ps -eo pid,ppid,user,stat,%cpu,%mem,command

That makes the meaning and order of the columns clear. Some field names and sorting options differ between Linux and macOS, so check man ps before putting a detailed format into a portable script.

Inspect one PID before using it

If another tool reports PID 123, inspect that process directly:

ps -p 123 -o pid,ppid,user,stat,etime,command

Replace 123 with the fresh PID you observed. Confirm the owner and full command, not only the number. A PID can be reused after a process exits, so an ID copied from an old message may now belong to a different program.

Use top when the question is changing over time

ps is a snapshot. Use top when you need to watch CPU or memory use change:

top

Press q to leave top. A live view is helpful for spotting a process that repeatedly rises to the top, while ps is better for recording an exact moment or examining a known PID. Neither tool tells you automatically whether a process is safe to stop; that decision still depends on its owner, command, and role.

Knowledge Check

1 / 1

Which value identifies the exact process you want to inspect?

When you have confirmed the right process, continue with how to stop a process safely. For the command's full option and output rules, consult the procps-ng ps manual.

References

These documentation links provide authoritative details for the commands used in this article.

Up Next

How to Find and Stop a Stuck Process Safely in Bash

Confirm a process and its PID, send SIGTERM first, verify the result, and reserve SIGKILL for a process that will not stop cleanly.