- How to check running process in Ubuntu Linux using command line
- Check running process in Ubuntu Linux
- How to manage processes from the Ubuntu Linux terminal
- Ubuntu Linux pgrep command
- Ubuntu Linux top and htop commands
- Ubuntu Linux kill command
- Ubuntu Linux pkill command
- Ubuntu Linux killall command
- Ubuntu Linux nice and renice command
- Conclusion
- 5 practical examples to list running processes in Linux
- List all the running processes
- Method-1: Using «px aux»
- Method-2: Using «ps -ef»
- Method-3: Using «ps -ely»
- List processes by user
- List the process tree
- Method-1: Using «ps axjf» or «ps -ef —forest»
- Method-2: Using pstree
- List thread count for individual process
- Example-1: Show only PID and command
- Example-2: Show memory and cpu details of each process
- Get process ID of a process
- Get process name using the PID
- List stopped processes
- Conclusion
- Related Posts
- How to check running process in Linux using command line
- Check running process in Linux
- How to manage processes from the Linux terminal
- Linux pgrep command
- Linux top command
- Linux htop command to check running process in Linux
- Linux kill command
- Linux pkill command
- Linux killall command
- Linux nice and renice command
How to check running process in Ubuntu Linux using command line
I am a new Ubuntu sysadmin for the Ubuntu Linux operating system. How do I check running process in Ubuntu Linux using the command line option?
One can use the Ubuntu Linux command line or terminal app to display a running process, change their priorities level, delete process and more. This page shows how to use various commands to list, kill and manage process on Ubuntu Linux.
Tutorial details | |
---|---|
Difficulty level | Easy |
Root privileges | Yes |
Requirements | Ubuntu Linux |
Est. reading time | 5m |
Check running process in Ubuntu Linux
The procedure to monitor the running process in Ubuntu Linux using the command line is as follows:
- Open the terminal window on Ubuntu Linux
- For remote Ubuntu Linux server use the ssh command for log in purpose
- Type the ps aux command to see all running process in Ubuntu Linux
- Alternatively, you can issue the top command/htop command to view running process in Ubuntu Linux
Let us see some example and usage for Ubuntu Linux in details.
NOTE: Please note that >$
- No ads and tracking
- In-depth guides for developers and sysadmins at Opensourceflare✨
- Join my Patreon to support independent content creators and start reading latest guides:
- How to set up Redis sentinel cluster on Ubuntu or Debian Linux
- How To Set Up SSH Keys With YubiKey as two-factor authentication (U2F/FIDO2)
- How to set up Mariadb Galera cluster on Ubuntu or Debian Linux
- A podman tutorial for beginners – part I (run Linux containers without Docker and in daemonless mode)
- How to protect Linux against rogue USB devices using USBGuard
Join Patreon ➔
How to manage processes from the Ubuntu Linux terminal
The ps command is a traditional Ubuntu Linux command to lists running processes. The following command shows all processes running on your system: There may be too many processes. Hence, it uses the following less command/more command as pipe to display process one screen at a time: >$ sudo ps -aux | less >$ sudo ps aux | grep chromium-browser >$ sudo ps -aux | egrep ‘sshd|openvpn’ Many variants of Ubuntu Linux comes with the pgrep command to search/find process. The syntax is: The top command is another highly recommended method to see your Ubuntu Linux servers resource usage. One can see a list of top process that using the most memory or CPU or disk. Want to kill a process? Try kill command. The syntax is: >$ kill -signal pid >$ kill 3932 If you wish to kill a process by name, try pkill command. The syntax is: >$ sudo pkill -KILL php7-fpm The killall command kills processes by name, as opposed to the selection by PID as done by kill command: >$ killall -9 emacs The primary purpose of the nice command is to run a process/command at a lower or higher priority. Use the renice command to alter the nice value of one or more running Ubuntu Linux processes. The nice value can range from -20 to 19, with 19 being the lowest priority. Say, you want to compile software on a busy Ubuntu Linux server. You can set a very low priority, enter: >$ nice -n 13 cc -c *.c & To change the priority of a running process, type the following: >$ sudo renice -10 $(pgrep vim) This page shows how to manage the process on the Ubuntu Linux terminal. For further info see man pages or our example pages: 🐧 Get the latest tutorials on Linux, Open Source & DevOps via Источник Table of Contents How to list processes by user and name in Linux? How to check if process is running by pid ? How to check process status? which command is used to kill a process? In this tutorial we will cover all these questions and explore different commands and tools to list and manage processes in Linux and Unix. ps command is the best tool to list down all the running processes across the server. There are a wide range of arguments which can be used with ps to list processes based in our requirement. To list every process on the system using BSD syntax: This will give you a long list of output with more details on individual process such as memory and cpu usage, status, user owner of the process and more. Following is a snippet from my terminal: The next method will list all the running process using standard syntax: This gives lesser information compared to ps aux : We can use some more arguments with ps to list the running processes in Linux: This command will give us additional detail compared to ps -ef such as priority and nice value of individual process. To list all the processes based on user owner we can use following syntax: To list the process started by user root: Sample output from my terminal: To list the process started by normal user deepak : We can also use ps command to list the running process in the tree format to understand the parent and child processes. Although you have a better alternative to above command if you wish to see the structure of all the running process using pstree which is part of psmisc rpm in RHEL/CentOS distribution. This command is used to display the parent-child relationship in hierarchical format. To list the process tree of process started by individual user, you can use For example to show the process tree of user deepak : You can check the man page of pstree for more list of supported options. We can use -L argument to list the number of threads along with individual process. It will add a new column in the output possibly with LWP and NLWP Sample output from this command: List process with user defined format By default ps will show a certain default list of columns. You can manipulate and print your own set of columns to get the required details of a process by using following syntax: Here, you can replace the ARGUMENTS with supported list of values from man page of ps To show only the list of PID and their respective commands: There are different arguments which you can use to print the memory and cpu related information of individual process, here I have consolidated a few: Now assuming you have a running process for which you want to get the PID so we can again use ps in this format: Here we need to replace PROCESS with the name of the process or command for which we want to perform the lookup of PID. For example to get the PID of rsyslogd process: Similarly to get the list of PID for sshd daemon Now if the situation is reversed, i.e. you have the PID and you wish to get the process or command of the mapping PID then you can use following format: Here, replace PID with the pid value of the process for which you have to perform lookup. Following are some examples where we get the process name using the PID value. You can stop a running or hung process using ctrl+z short key. When you press this key combination, the ongoing process on the terminal will be forcefully stopped. For example, here I had an SFTP session which was stuck so I pressed ctrl+z to stop the process forcefully which immediately stops the process and returns to console. To list all the processes which are in stopped state use jobs command So currently in my server, I have 3 stopped processes. To kill a stopped process we use where JOB ID is the ID number you see with «Stopped» under square brackets. So for example to kill the process with job ID 3 we will use: Next if I check the current stopped processes then I see that the process with JOB ID 3 is marked as Exit which means it is in the verge of getting killed (almost dead) We check the status again in few seconds and our process with JOB ID 3 is not there in the list any more and was killed successfully In this tutorial we learned about listing and managing Linux processes using ps command. We also have other tools such as top , htop which can list the system processes but I find ps more suitable in most scenarios. If you requirement is to watch the runtime status of process i.e. to monitor a process and it’s status then top would be your best alternative as it continuously monitors the status of process and shows you latest stat for memory, cpu usage and other related values. Didn’t find what you were looking for? Perform a quick search across GoLinuxCloud If my articles on GoLinuxCloud has helped you, kindly consider buying me a coffee as a token of appreciation. For any other feedbacks or questions you can either use the comments section or contact me form. Thank You for your support!! Источник I am a new system administrator for the Linux operating system. How do I check running process in Linux using the command line option? One can use the Linux command line or terminal app to display a running process, change their priorities level, delete process and more. This page shows how to use various commands to list, kill and manage process on Linux. The procedure to monitor the running process in Linux using the command line is as follows: Let us see some example and usage in details. Please note that vivek@nixcraft: $ is my shell prompt. You need to type commands after the $ prompt. The ps command is a traditional Linux command to lists running processes. The following command shows all processes running on your Linux based server or system: $ ps -aux There may be too many processes. Hence, it uses the following less command/more command as pipe to display process one screen at a time: $ ps -aux | more $ sudo ps -aux | less $ ps aux | grep firefox $ sudo ps aux | grep vim $ sudo ps -aux | egrep ‘sshd|openvpn|nginx’ Join Patreon ➔ Many variants of Linux comes with the pgrep command to search/find process. The syntax is: $ sudo pgrep sshd $ pgrep vim $ pgrep firefox The top command is another highly recommended method to see your Linux servers resource usage. One can see a list of top process that using the most memory or CPU or disk. $ sudo top The htop command is an interactive process viewer and recommended method for Linux users. One can see a list of top process that using the most memory or CPU or disk and more: $ sudo htop Want to kill a process? Try kill command. The syntax is: $ kill pid $ kill -signal pid $ kill 16750 $ kill -9 16750 $ kill -KILL 16750 If you wish to kill a process by name, try pkill command. The syntax is: $ pkill processName $ pkill vim $ pkill firefox $ pkill -9 emacs $ sudo pkill -KILL php7-fpm The killall command kills processes by name, as opposed to the selection by PID as done by kill command: $ killall vim $ killall -9 emacs The primary purpose of the nice command is to run a process/command at a lower or higher priority. Use the renice command to alter the nice value of one or more running Linux processes. The nice value can range from -20 to 19, with 19 being the lowest priority. Say, you want to compile software on a busy Linux server. You can set a very low priority, enter: $ nice -n 13 cc -c *.c & Источник
Press q to exit from above Ubuntu Linux pagers. You can search for a particular Ubuntu Linux process using grep command/egrep command: Ubuntu Linux pgrep command
Ubuntu Linux top and htop commands
Ubuntu Linux kill command
Find PID using ps, pgrep or top command. Say you want to kill a PID # 3932, run:
For some reason if the process can not be killed, try forceful killing: Ubuntu Linux pkill command
Ubuntu Linux killall command
Ubuntu Linux nice and renice command
Set a very high priority for a kernel update. Before rebooting Ubuntu Linux server, run:Conclusion
5 practical examples to list running processes in Linux
List all the running processes
Method-1: Using «px aux»
ps aux output
Method-2: Using «ps -ef»
Method-3: Using «ps -ely»
ps -ely output
List processes by user
list processes by user
List the process tree
Method-1: Using «ps axjf» or «ps -ef —forest»
list process in tree structure
Method-2: Using pstree
pstree output
List thread count for individual process
list process with thread count
Example-1: Show only PID and command
Example-2: Show memory and cpu details of each process
Get process ID of a process
Get process name using the PID
List stopped processes
Conclusion
Related Posts
How to check running process in Linux using command line
Tutorial details Difficulty level Easy Root privileges Yes Requirements Linux terminal Est. reading time 4 mintues Check running process in Linux
How to manage processes from the Linux terminal
vivek@nixcraft:
vivek@nixcraft:
vivek@nixcraft:
vivek@nixcraft:
Press q to exit from above Linux pagers. You can search for a particular Linux process using grep command/egrep command:
vivek@nixcraft:
vivek@nixcraft:
vivek@nixcraft:
Linux pgrep command
vivek@nixcraft:
vivek@nixcraft:
vivek@nixcraft:
vivek@nixcraft:Linux top command
vivek@nixcraft:
vivek@nixcraft:Linux htop command to check running process in Linux
vivek@nixcraft:
vivek@nixcraft:Linux kill command
vivek@nixcraft:
vivek@nixcraft:
Find PID using ps, pgrep or top commands. Say you want to kill a PID # 16750, run:
vivek@nixcraft:
For some reason if the process can not be killed, try forceful killing:
vivek@nixcraft:
OR
vivek@nixcraft:Linux pkill command
vivek@nixcraft:
vivek@nixcraft:
vivek@nixcraft:
vivek@nixcraft:
vivek@nixcraft:Linux killall command
vivek@nixcraft:
vivek@nixcraft:Linux nice and renice command
vivek@nixcraft:
Set a very high priority for a kernel update. Before rebooting Linux server, run: