how to grep a specific process from ps in linux?

when I ps -af | grep rv I get lots of result even with something that has service

but I am looking for searching specific process named rv

2

4 Answers

You can use the command pgrep, where also the switch -w can be used:

pgrep -w "rv" 

The final result is the process ID of the rv process.

Just append the -w argument to grep

ps -af | grep -w rv 
ps -af | grep -w rv 

or

ps -af | grep --word-regexp rv 

You can use

ps -af | grep -w "rv" 

Alternatively, you could match the term using regex

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like