[kwlug-disc] Question about `ps` and `grep`

Ronald Barnes ron at ronaldbarnes.ca
Thu Sep 26 22:12:00 EDT 2024


Ernst Rullmann wrote on 2024-09-26 11:57:

> Oh that’s fun. It’s because the grep command is altered so that it
> can’t match itself. With [t]mux as the argument, it appears in ps aux
> as something like:
> 
> root      748047  0.0  0.0   9212  2560 pts/10   S+   17:59   0:00
> grep --color=auto --directories=skip [t]mux
> 
> Note the brackets. But the grep expression will only match ‘tmux’ 
> without brackets. So it no longer finds itself.

Thanks Ernst!

I spent an embarrassing amount of time on this, and Chris's reply 
actually left me equally baffled.

I must have had a giant mental block on this issue. I had to look at 
Chris's reply, argue with it in my head, then suddenly the light went on.


Appreciate the explanation!


Also, am in agreement with the `ps -ef` folks: it's my go-to.

But, like Doug, the grep and reverse grep is gently chided in the video 
(rightfully so), and I'm gonna try to adapt these tools from now on.



Thanks everyone!

rb

rb



More information about the kwlug-disc mailing list