Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm a unix newb. I'm using find, but I'm getting too many results to fit on my screen since it's listing the permissions denied folders. I've tried piping it to more but that doesn't seem to have any effect. So, I have two questions:

  1. How can I filter out the folders to which I don't have access?
  2. How can I page the results of find - I can't get it to work with more.

Thanks

share|improve this question
4  
less is more. –  Nerdling Nov 2 '09 at 20:08

3 Answers 3

up vote 8 down vote accepted

to suppress permission denied errors, add 2>/dev/null to the end of your find statement

share|improve this answer

try with (if you're using sh, bash):

find . -name "foo" 2>&1 | more
share|improve this answer

I am not sure why piping it to more does not work for you. But a simple solution would be to redirect the output to a file, and then page that. The following will redirect the standard output to a file, and the standard error will maintain the default, which is to display the error on the screen:

find . -iname '*something*' > myfile.out
more myfile.out

You will have to wait for find to complete to see everything though. If you want to get rid of those error messages entirely, and still have the non-error results go to that file:

find . -iname '*something*' > myfile.out 2> /dev/null

Each time you run this, myfile.out will be overwritten. This redirection is standard with the shell and can be used with most commands. Here is a little tutorial on redirection, it is worth learning.

The Other Examples:
With 2>&1 , standard error (stderr) is being redirected to stdout, so both end up getting piped to more. With 2> /dev/null you are sending them to special device which is basically a black hole ( aka the bit bucket). With *nix, devices are represented as a files.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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