in Linux

How to: Manage processes in Ubuntu Server & Desktop CLI

This guide will help you to manage the processes ran on your Ubuntu environment. Please note that this is done by using the CLI (Command Line Interface) and not the GUI (Graphical User Interface)!



Ubuntu is one of the largest Linux distributions around. It’s important to know which processes are running and how to manage them. You will notice that sometimes a task or process will freeze, how useful is it to have the power to reboot or stop the said process!



I suggest you to use the following:

* You can install Ubuntu Server or desktop as your main operating system, but when something goes wrong it’s more difficult to recover. Therefore it’s recommended to use a virtual machine for now!



It’s important to know how processes are managed on your operating system itself. Every task you do is started as a process. When you boot your operating system your kernel is booted. This kernel is responsible for the first process that will start, usually this should be this init-process.

By booting other processes the init-process is booting these processes as child process of itself. To understand Linux processes you must know that there is a parent-child relationship between the processes. The procedure for this is called forking.

To see the relationship between the parent & child you can use the command:


pstree output ubuntu

The kernel works with a queue of processes and starts these step-by-step. This goes at once by time-slices. Some processes will have different priorities which means a process with a higher priority should should be started first. Processes with a lower priority will come after. If needed you can change these priorities by yourself by using the command:

nice -n <priority level> <process>

An example would be:

nice -n -8

To increase the priority use a negative amount (i.e. -8), to decrease the priority use a normal number (i.e. 5).

To see the current priority of a process use the command:

ps <process>


Process statuses

A process can have different statuses, to request a list of the said items use the command:

ps aux | less

ps aux less command ubuntu

The column ‘STAT‘ is telling you what the current status of the process is. Here’s a list of different statuses:

Citricks status Table
Name Explanation
Running The process is active.
Sleeping The process is loaded in the memory but is not active.
Zombie The process is 'uncontrolable'.
Stopped The process is terminated but still exists in memory.


Process monitoring

There are two important commands for this:


Which will get you a list of all the active processes. The list is refreshed automatically (default is 5 seconds).

command top ubuntu

ps aux | less


ps -ef | less

The command has several different options, but those are used quite often. ‘ps’ lets you show all processes with a lot of information regarding the processes.  We already shown ‘ps aux’ in chapter ‘process statuses’ above, so we will now use ‘ps -ef | less‘.

command ps ef ubuntu


Process types

There are different kind of processes:

  • Service processes, also called daemons.
  • Interactive processes, often booted by user.

There are 2 ways a process can manage multitasking:

  • The same process is booted 2 times, you will see the said process to times when executing the command ‘ps aux‘.
  • Multithreading by using subprocesses which are also called threads.


Stopping a process

If a program, task or process freezes and is not responding any more, you have to stop the process. The kernel will contact the parent process to say the child process should be terminated. In some exceptions the parent process does not exists any more but the child process does. This is often a result of bad programming. Because there is no parent process to tell the child process to terminate itself, you often have to reboot the server to have it terminated.

To terminate a process, you can use the command:


There are several ways to use the kill command. An example is to use the PID of the process. The PID is shown when using the command ps aux.

A valid command would be:

kill 1

This would kill ‘systemd‘.

Another useful command to terminate processes is:


The command ‘killall‘ kills all processes connected to the process you’re killing. There are several parameters for the command, I will list 4 of them:

  • -l, no distinction between capital letters and small letters.
  • i, interactive mode
  • -r, makes it possible to use regular expressions
  • -u, terminates the processes the mentioned user is owner of.
  • -o, matches processes older than the time specified.


killall -u rick

Kills all processes where user ‘rick’ is the owner of.

killall -o 1d

Kills all processes older than 1 day.

This should be enough to have some knowledge about managing different processes on your operating system. If you think I’m missing something, please let me know in the comments down below so I can add your suggestion. If there are any questions you can also post them in the comment section!

Related Posts

  • chi z

    great tutorial thanks, any change were seeing more about linux or ubuntu??