Discussion Locked

unix "find" command

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Is there a way to suppress the unwanted output from the find command:

find: cannot open /..............
find: cannot open /..............
find: cannot open /..............

and just see the files found ?

5 replies

by cpfeiffe

There are many ways to do this, but I think you would benefit most in the long run by doing some redirections that will be useful in many other events

try your find command and at the end of the line add

2>/dev/null

This will send standard error to /dev/null. The default is your console. 2 represents standard error in the shell, 1 is standard out and 0 is standard in. You can redirect either like this. If you want to redirect both standard out and standard error (useful in many occassions, but not yours) to /dev/null you could

command >/dev/null 2>&1
This sends standard out to /dev/null. When you don't specify anything standard out is assumed. The trailing '2>&1' is basically sending 2 (standard error) to the same place as 1 (standard out).

I hope this is helpful.

This discussion is closed to new replies.