程序快速将数据转储到标准输出。寻找编写命令而不被淹没的方法

发布于 2024-10-14 20:31:29 字数 129 浏览 2 评论 0原文

程序正在转储到标准输出,当我尝试输入新命令时,我看不到我正在写的内容,因为它会与输出一起抛出。是否有一个 shell 将命令和输出分开?或者我可以使用两个 shell,在一个 shell 上运行命令并将其转储到另一个 shell 的标准输出吗?

Program is dumping to stdout and while I try to type new commands I can't see what I'm writing because it gets thrown along with the output. Is there a shell that separates commands and outputs? Or can I use two shells where I can run commands on one and make it dump to the stdout of another?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

神经暖 2024-10-21 20:31:30

“more”可让您对输出进行分页,而“tee”可让您分割程序输出,因此它会同时发送到标准输出和文件。

$ yourapp | more    // show in page-sized chunks
$ yourapp | tee output.txt  // flood to stdout, but also save a copy in output.txt

最重要的是

$ yourapp | tee output.txt | more   // pageinate + save copy

There's 'more' to let you pageinate through output, and 'tee' which lets you split a programs output, so it goes to both stdout and to a file.

$ yourapp | more    // show in page-sized chunks
$ yourapp | tee output.txt  // flood to stdout, but also save a copy in output.txt

and best of all

$ yourapp | tee output.txt | more   // pageinate + save copy
忘东忘西忘不掉你 2024-10-21 20:31:30

运行程序时,要么重定向标准输出和错误,这样它就不会打扰您:

./myprog >myprog.out 2>&1

或者,运行另一个终端来完成您的工作。这使您的程序可以自由地将其喜欢的任何内容输出到终端,而不会打扰您。

话虽如此,我仍然将程序中的信息捕获到文件中,以防您必须返回并查看它。

Either redirect standard output and error when you run the program, so it doesn't bother you:

./myprog >myprog.out 2>&1

or, alternatively, run a different terminal to do your work in. That leaves your program free to output whatever it likes to its terminal without bothering you.

Having said that, I'd still capture the information from the program to a file in case you have to go back and look at it.

悲念泪 2024-10-21 20:31:29

您可以将程序的输出重定向到另一个终端窗口。例如:

program > /dev/pts/2 &

终端名称的样式可能取决于您的系统的组织方式。

You can redirect the output of the program to another terminal window. For example:

program > /dev/pts/2 &

The style of terminal name may depend on how your system is organized.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文