I saw this one-liner recently:
$ ps -ef | grep [f]irefox thorsen 16730 1 1 Jun19 ? 00:27:27 /usr/lib/firefox/firefox ...
So it seems to return the list of processes with "firefox" in the data but leaving out the grep process itself, and therefore seems roughly equivalent to:
ps -ef |grep -v grep| grep firefox
I can't understand how it works though. I've looked at the man page on grep and elsewhere but haven't found an explanation.
And to compound the mystery if I run:
$ ps -ef | grep firefox > data $ grep [f]irefox data thorsen 15820 28618 0 07:28 pts/1 00:00:00 grep --color=auto firefox thorsen 16730 1 1 Jun19 ? 00:27:45 /usr/lib/firefox/firefox ....
the [t]rick seems to stop working!
Someone here will know what's going on I'm sure.