When i use grep in eshell, like 'cat test.txt | grep test', grep opens it's own buffer with the result. Is it possible to capture the output of grep in the eshell buffer?

1 Answer 1


In Eshell, grep is a built-in command, which is a lisp function and works like Emacs's M-x grep. To use the external grep command, you need to use *grep instead. If you want to type just grep , you can declare an alias, i.e.,

~ $ alias grep '*grep $*'

The alias here is a built-in command as well, unlike shell's, it creates a persistent alias. If you want to cancel this alias, you have to delete corresponding entry from your eshell-aliases-file manually. Eshell doesn't provide a unalias.

I suggest you consult the Eshell manual, especially (eshell) Built-ins.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.