Tuesday, August 19, 2014

How to count the number of processes running, in Linux

How to count the number of processes running, in Linux ps aux | wc -l The above command will count the number of processes running on your system by any user. If you want to see only processes by a certain user with a username user1, you can use the following command: ps -U user1 | wc -l Now your other question, you want to count the number of processes run by httpd, that can be achieved using two commands: ps -C httpd | wc -l The above command can count the number of processes spawned by a command like httpd. Replace httpd with sshd or any other command! Another way of doing this is to use the pgrep command. pgrep httpd | wc -l The pgrep command can be used to lookup running processes based on name, process ID and other attributes of a process like the user who created the process.

No comments:

Post a Comment