How to Manage Linux Processes from the Command Terminal
The most important commands for managing Linux processes

In Linux, an instance of a running program is referred to as a process. Each process on a Linux system is uniquely identified by a process ID (PID).
Linux provides us with several command-line tools for easily managing processes. This article covers tools such as top, ps, and kill.
Knowing how to manage processes is a critical part of system administration and or keeping your system in good shape.
Listing processes with ps
Apart from the process ID, each process also has other properties such as CPU utilization, memory usage, and time spent in the CPU, etc.
One of the ways you can display information about active processes is via the ps
command. The processes are listed in a user-oriented format.
$ ps u
The output from the command above should be similar to the one below. Only processes associated with the user running the ps
command are shown by default.

As you can see from the output, several parameters are listed on each active process.
The USER column shows the user that started the process, in this case, the user is mwiza.
PID, short for process ID, shows the unique number used by the system to identify a process.
The CPU column shows the amount of processor utilization by a process, as a percentage.
Random-access memory(RAM) usage is represented by the columns MEM, VSZ, and RSS. The VSZ (virtual set size) column shows the size of memory that has been allocated for the process in kilobytes. The actual memory being used by the process is represented by RSS (resident set size) in kilobytes. Finally, the MEM column shows memory usage by a process, as a percentage.
The STAT column shows the status of the process. For example, R represents a running process whereas S represents a sleeping process.
START indicates the time when the process was started and the TIME column shows the cumulative amount of time the process has spent in the CPU.
Listing processes with top
An alternative method for listing processes is via the top
command. Unlike the ps
command which lists processes in a user-oriented view. The top
command lists processes in a dynamic, real-time, and screen-oriented format.
By default, processes are displayed based on the amount of CPU time that they are currently consuming.
To show running processes with the top command, simply run.
$ top
A typical output is shown below.

Killing processes
Equipped with the ability to list and uniquely identify processes with the top
or ps
commands. We can now be able to terminate wayward or unwanted processes with the kill
command.
For example, to kill the Firefox process, which has process ID: 34023 as highlighted in the figure above. Simply run the following command.

$ kill 34023
Killing processes by name
An alternative method of killing processes is to use the name of the process instead of its process ID. The killall
command allows you to kill a process using its name.
To kill the Firefox process highlighted in the figure above. Run the following command.
$ killall firefox
Stopping a process
Sometimes you do not intend to kill a process, rather you only want to stop it from consuming system resources and start it again at some point in the future.
To stop a process, use the kill
command with the -STOP
flag. For example, to kill the Firefox browser process which has process ID: 34023. Run the following command.
$ kill -STOP 34023
When you stop a GUI process in this manner it will become non-responsive.
To resume running the stopped process, you can use the kill
command with the -CONT
flag as follows.
$ kill -CONT 34023
Final thoughts
In Linux, you can easily manage and monitor process resource utilization with a few simple commands. An important element for keeping your system in top shape.