This command will print the number of running processes on a Linux system.
4.4 Tue Oct 30 jason@Yog-Sothoth 0: $ ps aux | wc -l 255 |
Here is a nice alternative that will work on Ubuntu. The landscape-common package will install this utility.
4.4 Tue Oct 30 jason@Yog-Sothoth 0: $ landscape-sysinfo | grep Processes: | awk '{print $5}' 258 |
This is an easier version of the above command line.
4.4 Tue Oct 30 jason@Yog-Sothoth 0: $ landscape-sysinfo --sysinfo-plugins=Processes | awk '{print $2}' 259 |
These one-liners print out the number of processes and are actually accurate. Very useful to have in a script.