0

When running

grep 'string' *

I'm getting the following messages:

grep: some-directory: Is a directory
grep: other-directory: Is a directory

How to suppress those messages?

1
5

-s, --no-messages: Suppress error messages about nonexistent or unreadable files.

grep -s 'string' *
2
  • 1
    Also, redirecting error messages to /dev/null. I.e. grep 'string' * 2> /dev/null
    – CPH
    Jul 23 at 15:13
  • grep -d skip 'string' *
    – bac0n
    Jul 24 at 5:21
0

There are at least two ways to suppress error messages ("Is a directory"):

  1. grep -s 'string' *

  2. grep 'string' * 2> /dev/null

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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