Linux将控制台输出附加到日志文件? [英] Linux append console output to a logfile?

查看:1211
本文介绍了Linux将控制台输出附加到日志文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道我可以让Linux通过执行以下操作将控制台输出写入日志文件:

I know that I can let Linux to write the console output to a logfile by doing:

command > logfile.log

但是这会覆盖日志文件中的任何内容。

But this overwrites whatever was in the logfile before. How do I make it append the output to the logfile rather than overwriting it?

推荐答案

您可以使用 > 用于附加到相同的日志文件
for eg cmd1>> logfile.log
然后用于其他commnad如

You can use >> for appending to the same logfile for e.g cmd1 >> logfile.log then use for other commnad like

cmd2 >> logfile.log

>> 用于将数据附加到文件

>> is used for append data to the file

这篇关于Linux将控制台输出附加到日志文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆