How to find number of proesses running on Linux system currently ?

Suppose you want to know how much processes currently running on the system.

So there are many ways by which we can find the number of running processes on the system.

1. Using ps command
This command you must be using in day to day operations.
Here we will use ps command with “-ef” option to view all system processes and count them using “wc -l” command.

[root@nglinux ~]# ps -ef | wc -l

2. Using top command
Another command we can use is top. We can use top command in pipe with different commands when it is ran in batch mode(with -b option and -n shows iteration limit which is set to 2 here) and “-d” sets the delay of 1 second which now shows all running processes and the output can be passed to other commands like grep, etc.

[root@nglinux ~]# top -bn2 -d1 | grep 'Task' | awk '{print $2}' | head -1

3. Using ls command
Another trick to count the processes is to ,u>count all the processes’ files created inside /proc which starts with number.

[root@nglinux ~]# ls -1 /proc/ | grep "^[0-9]" | wc -l

Hence on my system, there are a total of 150 processes running.

We have seen the different ways using ps command which we use in most of the times, the long list under /proc directory, and the top command.

0 0 votes
Article Rating
Notify of

Inline Feedbacks
View all comments