You can simply use grep
:
NAME
grep, egrep, fgrep, rgrep - print lines matching a pattern
SYNOPSIS
grep [OPTIONS] PATTERN [FILE...]
grep [OPTIONS] [-e PATTERN | -f FILE] [FILE...]
DESCRIPTION
grep searches the named input FILEs (or standard input if no files are named, or if a single
hyphen-minus (-) is given as file name) for lines containing a match to the given PATTERN. By
default, grep prints the matching lines.
Run following command to get output which you want (ex-chrome):
top | grep chrome
Here we are using grep
with pipelines |
so top
& grep
run parallel ; top
output given to grep
(as input) and grep chrome
filters matching lines chrome
until top
stopped.
top | grep chrome
?ps -x | chrome
to get pid (let pid shown2034
) and thentop | grep 2034
top | grep chrome
worked perfectly - thanks!ps -x | process_name
to get the PID, when I ran the process again the PID was different and therefore the original PID wouldn't identify it.