Redirecting console output to a file on unix

I am trying to find a file on my ftp server using the find command

find ./* -iname "MyLog.log" 

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

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

and

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

However, I can see the output in the console, but not in the file.

Can someone help me on how I can redirect the output to a file when we use the find command on unix.

+4
redirect linux unix output console
source share
1 answer

Possibly, a large amount of output is a message of the type "allowed permission". Redirect errors to the log file by adding 2>&1 .

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

 find . -iname "MyLog.log" > ./myfile/storeLog.log 2>&1 
+8
source share

All Articles