Sobes.tech
Junior

How to view the list of running processes in the Linux operating system?

sobes.tech AI

Answer from AI

The command-line utilities used to view the list of running processes in Linux are:

  • ps: Shows a snapshot of current processes.
  • top: Provides a dynamic, real-time view of processes.
  • htop (not always installed by default): An interactive process manager with a more user-friendly interface than top.

The most common way with ps to get detailed information about all processes:

ps aux
# a: Show processes for all users
# u: Display information in a user-oriented format
# x: Show processes without controlling terminal

Another ps command for a tree view of processes:

ps ef
# e: Show all processes
# f: Display process information as a tree

Using top:

top
# Opens an interactive interface
# Press 'q' to exit

Using htop:

htop
# Opens an interactive interface (if installed)
# Press 'F10' to exit

You can also combine ps with other commands, for example, to search for a specific process:

ps aux | grep nginx
# ps aux: Get a list of all processes
# |: Redirects the output of ps to grep
# grep nginx: Searches for lines containing "nginx"