5

I have been trying to search for a file in my ftp server using find command

find ./* -iname "MyLog.log"

I am getting very large amount of output. I am trying to redirect this output into a file using the below commands.

find ./* -iname "MyLog.log"  > ./myfile/storeLog.log

and

find ./* -iname "MyLog.log"  tee ./myfile/storeLog.log

Still I am able to see the output in console but not in file.

Can anyone help me on how can i redirect the output to a file when we use find command in unix.

Prathap
  • 93
  • 2
  • 2
  • 9

1 Answers1

8

Possibly the large amount of output is "permission denied" type messages. Redirect errors to the log file by appending 2>&1.

2 is the stream number for stderr (error messages), 1 is represents the stdout stream (the standard non-error output stream).

find . -iname "MyLog.log" > ./myfile/storeLog.log 2>&1
suspectus
  • 16,548
  • 8
  • 49
  • 57