On 07/05/2016 02:18 PM, Jon LaBadie wrote:
On Tue, Jul 05, 2016 at 01:51:48PM -0700, Rick Stevens wrote:
> On 07/05/2016 01:36 PM, Joe Zeff wrote:
>> On 07/05/2016 11:35 AM, Rick Stevens wrote:
>>> Yeah, I use that one a lot, too. "pidof -x" is useful as well and
you
>>> don't need the greps.
>>
>> One of the wonderful things about *nix is the fact that there are so
>> many different ways to get exactly the same results, depending on
>> personal preference.
>
> Since "pidof" doesn't do the grep, so you need to specify the entire
> process name (e.g. "pidof chron" gets nothing, "pidof chronyd"
gets the
> PID of the chronyd process).
>
> In that sense, your "ps aux | grep | grep -v grep" is a more flexible
> in that you only need to know part of the process name. I use it a lot
> myself--but not to the point of turning it into a script/utility. :)
There is also "pgrep"
$ pgrep chronyd
1542
$ pgrep chron
1542
$ pgrep fire
1535
8708
21777
$ pgrep -l fire
1535 firewalld
8708 firewall-applet
21777 firefox
$ pgrep -a fire
1535 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid
8708 /usr/bin/python -Es /usr/bin/firewall-applet
21777 /usr/lib64/firefox/firefox
Ok, now that's one I hadn't heard of. That's nice!
Thanks for the tip!
----------------------------------------------------------------------
- Rick Stevens, Systems Engineer, AllDigital ricks(a)alldigital.com -
- AIM/Skype: therps2 ICQ: 226437340 Yahoo: origrps2 -
- -
- Real Time, adj.: Here and now, as opposed to fake time, which only -
- occurs there and then -
----------------------------------------------------------------------