Remove grep command while grepping using ps command

Originally published at: https://www.cyberciti.biz/tips/grepping-ps-output-without-getting-grep.html

How to prevent grep from showing up in ps results

I use ps command to find out all running process on my Linux and Unix system. The ps command shows information about a selection of the active processes on shell. You may also pipe out ps command output through grep command to pick up desired output.

ps aux | grep [c]ron

I didn’t see anything further after 1 paragraph in the above that didn’t provide any sort of solution, so I’m just adding this. Putting the first letter of your grep query in square brackets will hide the grep command.


Linux sysadmin blog - Linux/Unix Howtos and Tutorials - Linux bash shell scripting wiki