1

How can I get the number of Linux processes (including lightweight processes)?

I want to see how many before I hit the limit dictated by /proc/sys/kernel/pid_max.

Paul Draper
  • 287
  • 5
  • 22

1 Answers1

2

I think you search for something like

ps -elfT | wc -l

You use the ps command to show all processes with threads (Light Weight Processes). The -T command do this for you. You should check the man page of ps to look around which arguments are useful for you.

The wc -l command will count the printed lines of the ps command.

Every process and every thread get a own line with the command ps -elfT.

Patrick Mevzek
  • 9,273
  • 7
  • 29
  • 42