3 ms·
Mostly unrelated, but I use the opposite trick to ensure that the "grep" process itself doesn't show up when I "ps | grep" for a process. Something like:
by ninkendo 10y ago
Mostly unrelated, but I use the opposite trick to ensure that the "grep" process itself doesn't show up when I "ps | grep" for a process.
Something like:
ps -ef | grep "myprogra[m]"
Is still a regex that matches the string "myprogram", but it doesn't match itself, so the "grep myprogram" doesn't show up in the output. Easier than doing " | grep -v grep" or similar.
- edoceo 10y agoWow, thanks. I've been doing the pipe trick for 15 years. Sokath, his eyes open
- daveFNbuck 10y agoI just use pgrep for this now.
- kalleboo 10y agoNot all platforms have pgrep, so I had to look up a trick like that in GP this weekend