0

On ubuntu, i search for "ubuntu" locations

find / -name ubuntu 

I get lots of lines with "Permission denied" I try to remove the lines

find / -name ubuntu | grep -v Permission

I still get the unwanted lines

How to fix this?

Tarek EZZAT
  • 333
  • 1
  • 5
  • 15

1 Answers1

1

It's because the errors from find are going to stderr. You can redirect stderr to stdout as well and then the filtering with grep would work.

find / -name ubuntu 2>&1 | grep -v Permission

1 represents standard output and 2 represents standard error. 2>&1 denotes "redirect stderr to wherever stdout goes".

P.P
  • 117,907
  • 20
  • 175
  • 238