redirecting console output to a file in unix

16,930

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
Share:
16,930

Related videos on Youtube

Prathap
Author by

Prathap

Software engineer, working in a prominent organization. Very keen to learn new things.

Updated on September 19, 2022

Comments

  • Prathap
    Prathap over 1 year

    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.