public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Help with use of pgrep or pkill commands with full name options
@ 2024-03-22 15:56 J M
  2024-03-22 16:22 ` Brian Inglis
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: J M @ 2024-03-22 15:56 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 436 bytes --]

Help with use of pgrep or pkill commands with full name options.

I trying to use pgrep or pkill utility commands to find processes but using
the full path names, by example, find /usr/bin/bash (package procps-ng):

Then, if I use pgrep -f /usr/bin/bash, don't find nothing.

Using pkill -f /usr/bin/bash don't get the task.

If I use pidof /usr/bin/bash, this works.

How do I get it to do use pgrep, pkill, etc?

Regards,
Cesar Jorge

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Help with use of pgrep or pkill commands with full name options
  2024-03-22 15:56 Help with use of pgrep or pkill commands with full name options J M
@ 2024-03-22 16:22 ` Brian Inglis
  2024-03-22 16:41 ` Eliot Moss
  2024-03-23 13:05 ` Henry S. Thompson
  2 siblings, 0 replies; 4+ messages in thread
From: Brian Inglis @ 2024-03-22 16:22 UTC (permalink / raw)
  To: cygwin

On 2024-03-22 09:56, J M via Cygwin wrote:
> Help with use of pgrep or pkill commands with full name options.
> 
> I trying to use pgrep or pkill utility commands to find processes but using
> the full path names, by example, find /usr/bin/bash (package procps-ng):
> 
> Then, if I use pgrep -f /usr/bin/bash, don't find nothing.
> 
> Using pkill -f /usr/bin/bash don't get the task.
> 
> If I use pidof /usr/bin/bash, this works.
> 
> How do I get it to do use pgrep, pkill, etc?

Look at the proc names using `procps -ae` - if it does not show a path, do not 
use `-f, --fullname /path/name`, just use `name`, and you may have to experiment 
if you want to use `-x, --exact`, and possibly other options.

-- 
Take care. Thanks, Brian Inglis              Calgary, Alberta, Canada

La perfection est atteinte                   Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter  not when there is no more to add
mais lorsqu'il n'y a plus rien à retirer     but when there is no more to cut
                                 -- Antoine de Saint-Exupéry


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Help with use of pgrep or pkill commands with full name options
  2024-03-22 15:56 Help with use of pgrep or pkill commands with full name options J M
  2024-03-22 16:22 ` Brian Inglis
@ 2024-03-22 16:41 ` Eliot Moss
  2024-03-23 13:05 ` Henry S. Thompson
  2 siblings, 0 replies; 4+ messages in thread
From: Eliot Moss @ 2024-03-22 16:41 UTC (permalink / raw)
  To: J M, cygwin

On 3/22/2024 11:56 AM, J M via Cygwin wrote:
> Help with use of pgrep or pkill commands with full name options.
> 
> I trying to use pgrep or pkill utility commands to find processes but using
> the full path names, by example, find /usr/bin/bash (package procps-ng):
> 
> Then, if I use pgrep -f /usr/bin/bash, don't find nothing.
> 
> Using pkill -f /usr/bin/bash don't get the task.
> 
> If I use pidof /usr/bin/bash, this works.
> 
> How do I get it to do use pgrep, pkill, etc?

Seems to use the name without the full path, e.g.,
bash as opposed to /bin/bash, etc.  Not sure why ...

EM

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Help with use of pgrep or pkill commands with full name options
  2024-03-22 15:56 Help with use of pgrep or pkill commands with full name options J M
  2024-03-22 16:22 ` Brian Inglis
  2024-03-22 16:41 ` Eliot Moss
@ 2024-03-23 13:05 ` Henry S. Thompson
  2 siblings, 0 replies; 4+ messages in thread
From: Henry S. Thompson @ 2024-03-23 13:05 UTC (permalink / raw)
  To: J M; +Cc: cygwin

J M via Cygwin writes:

> Help with use of pgrep or pkill commands with full name options.
>
> I trying to use pgrep or pkill utility commands to find processes but using
> the full path names, by example, find /usr/bin/bash (package procps-ng):
>
> Then, if I use pgrep -f /usr/bin/bash, don't find nothing.

I note that on Cygwin:

  pgrep -f /bin/bash

finds some but not all of my running bash processes.

  pgrep -a bash

finds all of them.

I leave it to others to explain why /usr/bin/bash doesn't work.

I note that on (Debian) Linux the results of the above alternatives
_also_ differ, but that pgrep -f /usr/bin/bash and pgrep -f /bin/bash
both work and give the same results.

ht
-- 
       Henry S. Thompson, School of Informatics, University of Edinburgh
                10 Crichton Street, Edinburgh EH8 9AB, SCOTLAND
                           e-mail: ht@inf.ed.ac.uk
                      URL: https://www.ltg.ed.ac.uk/~ht/
 [mail from me _always_ has a .sig like this -- mail without it is forged spam]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-03-23 13:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-22 15:56 Help with use of pgrep or pkill commands with full name options J M
2024-03-22 16:22 ` Brian Inglis
2024-03-22 16:41 ` Eliot Moss
2024-03-23 13:05 ` Henry S. Thompson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).