我想将从Linux中的后台应用程序生成的输出重定向到/ dev / null。
我正在使用kate文本编辑器,它打印终端上的所有调试消息,我想重定向到/ dev / null。
有什么想法怎么办?
谢谢
I would like to redirect the output generated from a background application in Linux to /dev/null.
I am using kate text editor and it prints all the debug messages on the terminal which I would like to redirect to /dev/null.
Any idea how to do it ?
Thanks
最满意答案
你用:
yourcommand > /dev/null 2>&1如果它应该在后台运行添加&
yourcommand > /dev/null 2>&1 &>/dev/null 2>&1意味着将stdout重定向到/dev/null AND stderr到stdout指向的地方
如果你想要stderr发生在控制台,只有stdout进入/dev/null你可以使用:
yourcommand 2>&1 > /dev/null在这种情况下, stderr被重定向到stdout (例如你的控制台), 然后原始stdout被重定向到/dev/null
如果程序不能终止,可以使用:
nohup yourcommand &没有任何参数,所有输出都在nohup.out中
You use:
yourcommand > /dev/null 2>&1If it should run in the Background add an &
yourcommand > /dev/null 2>&1 &>/dev/null 2>&1 means redirect stdout to /dev/null AND stderr to the place where stdout points at that time
If you want stderr to occur on console and only stdout going to /dev/null you can use:
yourcommand 2>&1 > /dev/nullIn this case stderr is redirected to stdout (e.g. your console) and afterwards the original stdout is redirected to /dev/null
If the program should not terminate you can use:
nohup yourcommand &Without any parameter all output lands in nohup.out
更多推荐
发布评论