With the Linux operating system comes multitasking, and one of the benefits of using the Linux control panel is to ensure optimum system performance. Therefore, an excellent Linux web hosting control panel like the ISPmanager powerful web hosting control panel can help system administrators to manage processes resulting from several applications running simultaneously.
Are you a beginner interested in knowing the processes running on your server? This article will reveal how you can list running processes on your Linux server using Linux commands.
What Are Linux Processes?
Once you instruct your machine to run or open an application, you start running multiple processes. However, you only run a process when you issue and perform a command on your machine. For example, when you launch the Mozilla Firefox web browser on your machine, you start a process that will terminate when you exit the web browser. Similarly, a new process is started with each tab you open on the web browser.
In Linux, a process can either be a foregone or a background. Every new process starts as a foreground one, meaning it must terminate before another starts. However, when you run processes concurrently, they become background. Nevertheless, each of them is unique on Linux, explaining why they have a Process Identification Number (PID) on Linux.
Why Is It Necessary to List Linux Processes?
The fewer processes are running, the better for system administrators. However, web hosting providers and developers run several applications and commands daily. Therefore, it becomes necessary for a system administrator to list, control and manage these processes to ensure optimum system performance in Linux.
Optimizing system performance involves displaying and discovering the processes that consume resources the most. After this, a system administrator decides to delete such processes or change their priorities to receive more resource allocation. In a nutshell, listing running processes in Linux is the first step to optimizing system performance.
How to List Running Processes in Linux
There are various commands to list running processes in Linux, such as ps, top, and htop. Below, you will find how to use these commands.
The ps command shows a static list of the processes currently running on your system. Furthermore, it allows you to see more detailed output if you wish to. You should use the command as it is below.
$ sudo ps (options)
In the table below, you can find common examples of ps commands to use for listing running processes.
ps -u [username]
lists all the running processes of a particular user
makes a list of all running processes that are causing problems for all users on the server
ps -e or ps -A
displays running processes in the generic UNIX format
displays all running processes and includes CPU and memory use
prints all running processes that are launched from the terminal
ps -C process_name
filters the running processes list by the process name and shows all the child processes of the particular process
Similarly, using the a, u, and x options together as in $ sudo ps aux provides more details about the running processes. Likewise, if you want a hierarchical list of running processes, use the $ sudo ps -axjf command. However, if you use the command without additional options, the command will respond with a list of running processes with the four other columns listed below.
PID: Process Identification Number
TTY: Terminal name
TIME: Running time
CMD: The name of the command that began the process
Unlike the ps command, the top command displays a live list of actively running processes in a top-down decreasing CPU usage order, from the most resource-heavy to the least resource-heavy. The beauty of the top command is its periodic updating of three seconds by default.
Similarly to the ps command, the top command has options to modify the output format of the running processes in Linux. However, you must note that the options are case-sensitive. Thus, you will not have the desired results if you do not use the correct letter case. Find the top command format and common keys to interact with the results below.
$ sudo top
displays the help window
provides the PID to change the priority of a process
highlights running processes in colors
sorts the running list by PID
customizes the rate periodic updating
sorts the running list by memory usage
shows the absolute path of a process
displays the PID to kill a process
stop the command prompt
The htop command is similar to the top command. However, the htop command is more understandable and user-friendly, which makes it perfect for day-to-day process management. Furthermore, most Linux distributions don’t have this command, so you will have to install it on Ubuntu using either of the below commands.
$ sudo apt install htop
$ sudo apt-get install htop
After the installation, you will get an output of the running processes. However, you can use the mouse to select items and scroll vertically and horizontally, unlike in the top command. Use the keys listed below to interact with the command output.
shows the help window
opens “htop” command setup
searches for a process by its name
sorts the list by name
shows list in a tree view
sorts processes by columns
increases the priority of a process
decreases the priority of a process
terminates a process
stops the command prompt
This article has addressed how to list running processes in Linux for system administrators, as it is vital expertise, especially for newbies. Therefore, it is expected that you can now seamlessly list running processes with any of the commands discussed in this guide.
Are you tired of command lines? Perhaps you are interested in a smart tool to manage running processes in Linux. We recommend the ISPmanager Linux web hosting control panel with an intuitive user interface to reduce technical support load.