0

I am looking for a folder, but there are a lot of Permission denied messages. I want to filter these out by grepping the output. I tried this, informed by other questions:

find / -type d -name 'force_fields' | xargs grep 'force_fields'

However, I still get a flow of entries with Permission denied messages, making it impossible for me to filter out what I'm looking for.

3 Answers 3

7

Would silencing the error stream be a solution?

find / -type d -name 'force_fields' 2>/dev/null
4

The errors are printed to stderr, but the results are printed to stdout. You can redirect the errors so you won't see them, like this:

find / -type d -name 'force_fields' 2>/dev/null
1
  • 2
    3 instant answers, all at the same time.. =)
    – chaos
    Oct 16, 2015 at 21:08
3

Those message are write trough the stadnard error channel (number 2). You can redirect the error message to /dev/null to avoid them by:

find / -type d -name 'force_fields' 2>/dev/null

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .