Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/unix/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
用于在unix中将terminate输出保存到文件的命令_Unix - Fatal编程技术网

用于在unix中将terminate输出保存到文件的命令

用于在unix中将terminate输出保存到文件的命令,unix,Unix,我想保存unix终端命令并将其输出到一个文件中,以用于会话。因为有时候unix命令输出非常大,所以我们无法通过在终端中向上滚动来恢复 为什么不将输出传输到?这将记录在一个文件中,并转储到控制台,以便您可以实时查看正在发生的事情 $ mycommand | tee filename.log 请注意,以上内容仅记录标准输出。如果您也需要记录stderr,则相应地重定向: $ mycommand 2>&1 | tee filename.log (假设您使用的是sh或兼容的shell-

我想保存unix终端命令并将其输出到一个文件中,以用于会话。因为有时候unix命令输出非常大,所以我们无法通过在终端中向上滚动来恢复

为什么不将输出传输到?这将记录在一个文件中,并转储到控制台,以便您可以实时查看正在发生的事情

$ mycommand | tee filename.log
请注意,以上内容仅记录标准输出。如果您也需要记录
stderr
,则相应地重定向:

$ mycommand 2>&1 | tee filename.log

(假设您使用的是
sh
或兼容的shell-最有可能)

使用
脚本文件名
命令