How to List Running Processes in Linux: A Beginner’s Guide
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 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?
You start running multiple processes once you instruct your machine to run or open an application. 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 foreground, 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. In a similar vein, utilizing a Linux remote desktop solution can enhance system management by providing remote access capabilities for efficient troubleshooting and control.
Optimizing system performance involves displaying and discovering the processes that consume resources the most. After this, a system administrator deletes such processes or changes 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.
“PS” Command
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 command | Function |
ps -u [username] | lists all the running processes of a particular user |
ps a | 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 |
ps u | displays all running processes and includes CPU and memory use |
ps -T | 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
“TOP” Command
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 to the least. 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
Keys | Function |
h | displays the help window |
r | provides the PID to change the priority of a process |
z | highlights running processes in colors |
N | sorts the running list by PID |
d | customizes the rate periodic updating |
M | sorts the running list by memory usage |
c | shows the absolute path of a process |
k | displays the PID to kill a process |
q | stop the command prompt |
“HTOP” Command
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, the mouse can select items and scroll vertically and horizontally, unlike in the top command. Use the keys listed below to interact with the command output.
Keys | Function |
F1 | shows the help window |
F2 | opens “htop” command setup |
F3 | searches for a process by its name |
F4 | sorts the list by name |
F5 | shows list in a tree view |
F6 | sorts processes by columns |
F7 | increases the priority of a process |
F8 | decreases the priority of a process |
F9 | terminates a process |
F10 | stops the command prompt |
Conclusion
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.
Leave a Reply