Linux Commands for Process Management | Terminal Commands

Process Management

Linux commands can help in lots of cases. One of them is process management.

Process simply means something is running in your system, that can be an application running in GUI (Graphical User Interface) or some program that is running in the background like antivirus.

Our computer hardware can only handle a fixed amount of processes. More process running in the system means, more memory is occupied. So, It’s best to have some knowledge about it. If you are using Linux OS then knowing a few commands helps you easily in the process management.

Before going through this article, I suggest you learning some Linux Basic Commands.

Linux Commands to Show List of Processes

a. top command

The top command in Linux shows all the process in a terminal. Using this command, you can view the running process and identify the process according to PID (Process ID), application, memory, etc.


$ top
top command output in terminal

The top command output is dynamic in nature meaning, this command keeps running and the process updates itself. To stop this, press q or Ctrl + C.

The output is divided into two halves. The upper half shows some crucial information like CPU memory, total tasks, number of the running processes, etc. and the second half shows the individual process in detailed format.

You can press z and see the running process in different colors depending upon your terminal customization. For e.g, You can see the above image, where the running process is highlighted in red color.

b. pstree command

The pstree command shows running processes as a branch of a tree. This shows processes in a systematic diagram format and easy to view. However, it doesn’t provide information regarding memory, CPU time, and others.

$ pstree
pstree command to show linux process

To show the running processes in highlighted line, use option h

$ pstree -h

If you want to see PID(process id) value, use option p

$ pstree -p

c. ps command

ps displays the information of a selective active process. You can also use this command to see the active process but for the continuous update of the process, use top command instead.


$ ps
ps command in linux terminal

It gives the information in four columns by default. They are:

PIDProcess ID
TTYTerminal name associated with process
TIMECumulated CPU time
CMDExecutable name
ps command information table

d. htop and atop commands

The htop and atop are other interacting commands for processes management. These programs are not installed by default.

Install htop or atop using terminal command in Debian based Linux/Ubuntu system:

$ sudo apt-get install htop
htop linux commands in terminal

Linux Process Commands for Priority and Kill

a. nice and renice command

If you see the 4th column of top command output, you can see NI value which means nice value. The nice value is the representation of priority for the processes. The default NI value for all processes is 0 which means equal priority to all. This value can range from -20 to 19. The lower the nice value, the higher is the priority.

The nice command is used to start a process(to open an application) with defined priority and the renice command is used to change the priority of an already running process.

When you have to start certain application giving more CPU time, use nice command:


$ sudo nice -n -10 vlc

You have to give sudo permission to give -ve NI value.

The renice command is used to change the priority of already running process.


$ sudo renice -10 vlc

Now see the top command to see the new priority.

renice command in terminal

For more detail on nice and renice command, you can go for geeksforgeeks website.

b. kill command

The kill command in Linux Terminal is a good way to kill a running process if necessary. The usage is very simple. You have to type kill and PID (Process ID) of the process that you want to stop.

e.g I have vlc running in my system and it got unresponsive. Now I will use kill command to exit vlc.

First I will use top command to find PID of vlc:

top command

OR you can use pidof command to find PID of known process.

pidof linux command

You can see, the PID of vlc in my system is 24200. Now I will use kill command to stop this process that means exit the vlc application.

$ kill 24200

This kill command is very useful to use. However, you should be careful to put the correct PID.

free command for memory information

The free command in Linux Terminal shows the free and used space of physical memory and swap memory. The output contains important information like Total, Free, Available, Shared, Cache, etc.


$ free
free linux commands

The above values are in Kilobytes.

There are many options to play with this free command.

You can use option -b for --bytes to show these values in bytes.

$ free -b
free -b command

There is another good option -h that shows the values in required unit.

free -h command linux


Use these above commands and have full control over your Linux system. If we are unsure of any commands, use man command-name command to get all the help related to that commands. Learning these Linux Process Commands has helped me a lot during my 6+years of experience in Linux.

Share this post:

Leave a Comment

Your email address will not be published. Required fields are marked *