问题描述
我一直在尝试使用find命令搜索我的ftp服务器中的文件
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
和
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.
推荐答案
可能大量的输出是许可拒绝类型的消息。通过添加 2>& 1
将错误重定向到日志文件。
Possibly the large amount of output is "permission denied" type messages. Redirect errors to the log file by appending 2>&1
.
2是stderr(错误消息)的流号,1表示stdout流(标准无错误输出流)。
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
这篇关于将控制台输出重定向到unix中的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!