How to grep without grep

Issue:

ps axufS |grep tailwatchd

Output:
root 3052360 0.0 0.0 114756 984 pts/6 S+ 00:45 0:00 | _ grep --color=auto tailwatchd
root 1916299 0.0 0.0 53500 10412 ? S 2018 1:59 tailwatchd

Long way:

ps auxfS |grep tailwatchd |grep -v grep

Output:
root 1184626 0.0 0.0 52160 11424 ? S 2018 2:09 tailwatchd

Short way:

ps axufS |grep [t]ailwatchd

Output:
root 1184626 0.0 0.0 52160 11424 ? S 2018 2:09 tailwatchd

To get process ID only:

pgrep tailwatchd

Output:
1184626

To get process ID only, another way:

ps -C tailwatchd

Output:
PID TTY TIME CMD
1184626 ? 00:02:04 tailwatchd

Similar Posts:

    None Found

Leave a Reply

Your email address will not be published. Required fields are marked *