Manipulating Processes Symbolically with procps Signal and renice processes by name, terminal, or username (instead of PID) [Discuss (2) | Link to this hack]
Comments on this hack
Showing messages 1 through 2 of 2.
Check discrepency between /proc and ps
2004-11-06 04:23:26
stcDenis
[View]
To check ps, the correct command should have been:
Notice the quotes to protect the regexp. This may avoid you a common shell gotcha. Using bash, if you have a file matching the regexp in your cwd, the shell substitute your pattern with this file name, and the result is than unexpected.
Alternatively, I thought that
ls /proc | grep ^[0-9] | wc -l; ps ax | wc -l
may be better since it use an anchored regexp. Here quote are also not required, bash only understand really simple regexp.
Check discrepency between /proc and ps
2004-11-06 04:28:19
stcDenis
[View]
Sorry, this was intended for hack #16.
If someone can delete this comment, feel free.
ls -d /proc/* | grep '[0-9]' | wc -l; ps ax | wc -lNotice the quotes to protect the regexp. This may avoid you a common shell gotcha. Using bash, if you have a file matching the regexp in your cwd, the shell substitute your pattern with this file name, and the result is than unexpected.
Alternatively, I thought that
ls /proc | grep ^[0-9] | wc -l; ps ax | wc -lmay be better since it use an anchored regexp. Here quote are also not required, bash only understand really simple regexp.