I know fgrep
and egrep
are deprecated because same functionality exists with grep -E
and grep -F
But what about pgrep
and rgrep
? are these 2 deprecated as well?
For rgrep
there is grep -r
but I don't find any mention of rgrep
being deprecated.
pgrep
seems unique and still valid, so it's not deprecated right?.
Are there also other variants of grep
?
egrep and fgrep have supposedly been deprecated for a long time. But as it says, they’ve been kept to allow older scripts to function without modification. But nothing says that they’re going to be removed any time soon either. And if they do ever get removed, I imagine that people will just create aliases for them.
I haven't seen anything mentioned about rgrep being deprecated.
Also. pgrep isn’t part of the grep package. It has nothing to do with grep. It's a separate tool altogether. It’s actually part of the procps package, which also contains things like ps, free, skill, pkill, snice, tload, top, uptime, vmstat, watch, w, pdwx etc.
pgrep allows you to use regular expressions to search for running processes.
And yes, there are variants of grep. At the moment the two main ones are GNU grep (on Linux, Cygwin etc) and BSD grep (bsdgrep) - used on BSD and Apple Macs/iMacs.
.
There are other grep implementations like freegrep, which is licensed under the BSD licence. And there are also older versions that were made for various Unix implementations.
Also, toolkits like busybox, toybox, the heirloom project, suckless software's 9base provide non-GNU versions of traditional Unix commands.
Busybox, and 9base are licensed under the GPL, but they are not part of the GNU project.
Busybox contains more minimalist, stripped down, non-GNU versions of the standard Unix tools.
9base contains versions ported from the old Plan9 OS.
Toybox is distributed under the BSD license and contains stripped down, POSIX compliant versions of the standard tools.
And the heirloom project provides tools that have been derived from older Unix implementations, using the original algorithms.
Most Linux distributions use GNU grep and the GNU userland tools. But some distributions like Alpine Linux use the busybox versions of the standard Unix tools. So grep on those machines will be the busybox version of grep.
The GNU version of grep and the other userland tools are complete versions of the original tools, but many of them feature extensions, providing them with additional capabilities that earlier implementations did not have. Some people see the extra functionality as bloat and prefer to use more minimal implementations of the standard tools, like busybox. Others don't like the GPL, so they use BSD licensed implementations like toybox. And as mentioned BSD and Mac people use the BSD versions of the userland tools.
So yeah.... Lot's of variants of grep (and the other standard CLI tools)