Check Running Process in Linux for a User: A Helpful Guide
Let’s say that you are a newly arrived sysadmin who will administer an operating system like Linux. You need to know everything that is going on with the system. However, how do you do it?
On Windows, everything is quite simple. You can open Task Manager and find running processes right away. With Linux, it can be a little more difficult. Usually, if you open any program or application, then you just need to close it so that the process ends. However, more complicated processes run on the system that we don’t even notice. They can have a different priority, overload the processor, and so on. That is why, be knowledgeable about all information, you should know how to check running processes in Linux. There is nothing difficult in this since you only need a command line or a terminal.
Many processes that you may not even think about are going on in the background. That is, you may have a blank screen before your eyes – this does not mean that nothing is going on, you simply do not see running processes Linux.
In this guide, we will help you learn how to see what is going on behind the scenes on your computer system. There are several ways to do this, various commands, options, and much more. Such knowledge is necessary to be able to independently check what is happening so that you can check the load on the system, how resources are distributed, and also be able to kill tasks that interfere with other tasks or take up too many resources.
- ps -e
The easiest way to check running processes Linux is to use the ps command. It can be used on any operating system that has a Linux kernel.
If you are interested in getting information about all the tasks taking place on your system, then press the “-e” key.
You may be overwhelmed by the sheer volume of tasks being performed by the system and find it hard to figure out what you should keep and what you should not. For that matter, there is a way to reduce the strain on your eyes and reduce the list of processes that you can view at a time. If you want to view only 15 tasks first, then you just need to add to the “e” option also “| more -15″.
The table shown to you when you enter this command reveals to you information about a particular process, its unique number in the system (Process ID), as well as the interface on which all tasks are performed. If you see “?” next to any tasks, it means that they are not bound to any interface. Such tasks simply run in the background.
Keep in mind that the Process ID may be important to you. You will need this unique number if you want to terminate a task.
- ps -aux
You may want to know more than just what tasks are running. You can also find out how specific tasks use system resources, that is, the processor and random access memory.
You’ll need to use this command for more interactive output, which not only provides a list of all the jobs but can also provide additional information. Firstly, type it and see what you’ll get.
You’ll notice a lot of information at the top, in a horizontal layout. More importantly, take a look at the total number of jobs (including operating, sleeping, terminated, and zombie). If you look down, you will be able to see more detailed info about every activity.
For convenience, and also because of the impossibility of containing information about all activities, first of all, you will see data on the most demanding processes, that is, those that load the processor, as well as random access memory. In descending order, respectively, the tasks that use fewer system resources will be listed. For easy navigation, you can use the cursor keys on your keyboard to scroll up and down.
In addition to what you are prompted to see by default, you can also use the following parameters:
- z – because there will be sleepers and zombies in the entire list, utilizing this key will let you see exactly what tasks are in progress. Active processes will be indicated when you hit this key;
- c – to show the executable’s whole path;
- k – this will help you end any activity you don’t need. You need to know the exact unique number of the task so that you do not inadvertently terminate what you need. This is another way to end a task besides using another separate “kill” command;
- r – since each task has a run priority, you must use this option in conjunction with a unique task number to decrease or increase the run priority value;
- h – to see the whole list of parameters available;
- q – upon completion of checking, changing the priority, or killing the task, you can use this parameter to exit.
This utility, according to many specialists, is the greatest of all. Moreover, it is easy to use and pleasant to the eye. The difficulty lies in the fact that you may simply not have it. To be able to use it, you will need to install it first. All data must be stored on your system, so it only takes a few steps and minutes for you to set everything up.
The first thing you need to enter:
- For Debian and Ubuntu users – sudo apt-get;
- For CentOS and Fedora users – dnf;
- For Red Hat users, yum.
After that, you just need to add “install htop” and the installation process will begin. When you’re finished, use the command to view all of the information. In contrast to the prior commands, for convenience, you can use not only the cursor keys. Although there are no significant differences in functionality from the previous ones, you can choose this one because of the design.
As you’ve seen, there are three distinct commands you may use to examine the system’s tasks. In addition to each command, you can add various options to get specific information. This knowledge will help you know everything that happens in the system, especially in the background, find out what resources are being used, as well as manage tasks, that is, increase or decrease priority, terminate tasks, and much more.