How to view and read running processes on Linux

Everything that runs on Linux, from user applications to system services, has its own process. Even if the computer is in a blank terminal screen, there are a lot of processes running in the background.

There are many Linux tools that we can use to identify all the processes on our system, and that’s what we’ll cover in this guide.

Knowing how to check running processes will allow you to check if something is running, stop it if necessary, and monitor the impact on system resources (CPU and RAM).

List of processes in ps command

The ps command can list all running processes on Linux with options -e.

ps -e

PS command in Ubuntu 1 terminal

It is quite normal for a system to have a large number of processes running at any one time, so it is easiest to filter this list by going to the command more . For example, to display 15 rows at once:

ps -e | more -15

output from command ps It shows us each running process, the process ID (abbreviated PID), and the TTY (terminal interface the process is running on). The question mark in the TTY column means that the process is not bound to any terminal interface, so it only runs in the background.

You may need to know the PID or TTY of the process to terminate it, so you can return to the open process by reconnecting to the correct terminal window.

Another useful option with ps is the -aux option.

ps -aux

Like the previous option, this command will list every process running on your system. However, it also lists the current CPU and RAM usage for each process, as well as which commands have child processes.

See also  A tutorial on using the last command in Linux Terminal

PS command in Ubuntu 2 terminal

Find processes using pgrep

The pgrep command type combines ps and grep. We can specify a name – or part of the name – of the process we’re looking for, and pgrep will return each process ID.

For example, to search for SSH-related processes on your system, you could type:

pgrep ssh

pgrep command on Ubuntu

As shown in the screenshot above, pgrep has found an SSH process with PID 1143. For further verification, let’s check the ps command:

ps -e | grep 1143

pgrep with the ID on ubuntu

View running processes with top

The top tool is a command line tool, but it provides interactive output for all running processes, and displays the information in a graphical interface. It’s easy to get started, just type the command top At your station:


TOP command in Linux Terminal

The output of the upper command gives us a lot of information, including the system’s CPU and RAM usage.

The terminal window is not large enough to allow the top to list every running process, so the top shows as many as possible and sorts each process by system resource usage. In other words, the process that uses the most CPU and RAM will be on top. Processes that are less resource-demanding will appear at the bottom of the list, possibly separated from the terminal window.

Use the arrow keys on your keyboard to scroll up and down through the list of processes.

Meaning column in Top Utilities

There is a little bit of information listed about each running process. Here is a quick overview of what these different columns mean:

  • PIDs: The process ID of each process.
  • Homework: schedule the priority of each process.
  • N.I: good value for each operation. Negative numbers indicate a higher priority.
  • Translate: The amount of virtual memory used.
  • RES: The amount of resident memory used.
  • mr sh: The amount of shared memory used.
  • s: state of the process (R = running, S = asleep).
  • % CPUs: the percentage of CPU currently used by a task..
  • %MEM: the percentage of RAM currently used by a task..
  • TIME+: CPU time for the task.
  • order: The command used to display the process.
See also  Define Default APEX Application

As mentioned, top It is completely interactive, so we can use some keyboard shortcuts to do some things with it. We’ll cover some of the most useful ones below.

push the button z To run the color code in the process. This makes it easy to distinguish which tasks have a running, asleep, or zombie state.

TOP command with Code Color

push the button c To get the full command used for each task. It will display the absolute path, along with any options used.

TOP command with an absolute path

push the button k To kill (stop) the running process directly from the utility top . This method saves a lot of time rather than having to exit the tool and issue a separate kill command. You just need to type the ID of the process you want to kill:

TOP command to kill the process

push the button r To change the priority of the process with renice. Enter the ID of the process you want to renew:

senior command renice PID

For more options, press the button h (help) to see everything else can be done.

When you are done using the tool topyou can exit the tool and return to the device by pressing q.

View running processes with htop

htop utility is based on the best utilities and is more user friendly and nice to look at. The only drawback is that this program is not installed on all Linux distributions by default, so you may need to install it first.

The htop utility should be in your OS repository, so here’s how to install it with your package manager:

Debian and Ubuntu:

sudo apt-get install htop

CentOS and Fedora:

dnf install htop

red hat:

yum install htop

Once installed, just type htop to run the tool.


htop in the linux terminal

You can use the mouse to interact with htop, and various keyboard commands are listed at the bottom of the terminal window. Most of them work like the top one, but with a cleaner interface that’s easier to understand.

See also  A tutorial on configuring Apache Virtual Hosts on CentOS 8


In this guide, we have shown you several different ways to view running processes on Linux. Which method you use depends on your current situation and personal preference, but each method has its own benefits.

Using what you learned in this guide will allow you to identify all the processes running on the system, their impact on system resources, and also give you the ability to stop or re-prioritize tasks as you see fit.

Source link