长输出后在终端/命令提示符中查看所有内容

发布于 2024-12-20 10:40:31 字数 172 浏览 0 评论 0原文

我是 ubuntu 新手,使用终端编写一些 ruby​​ 代码。

每次我运行这个命令时,它都会输出大约 600 行我需要分析的数据。

但是当我尝试向上滚动查看所有内容时,很多输出都被切断了。

有什么方法可以更改终端或另一个命令提示符程序的设置或我可以用来查看所有数据的任何其他选项?

I'm new to ubuntu using the terminal to code some ruby.

Everytime I run this command it outputs like 600 lines of data that I need to analyze.

But when I try to scroll up to see everything alot of the output is cut off.

Is there any way to change the settings of the terminal or another command prompt program or any other options that I can use to take a look all of the data?

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

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

发布评论

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

评论(11

浅紫色的梦幻 2024-12-27 10:40:31

在终端窗口内,转到 Edit |配置文件首选项,单击滚动选项卡,然后选中回滚XXX行行下方的无限制复选框。单击关闭即可。

Inside your Terminal Window, go to Edit | Profile Preferences, click on the Scrolling tab, and check the Unlimited checkbox underneath the Scrollback XXX lines row. Click Close and be happy.

Smile简单爱 2024-12-27 10:40:31

使用它运行命令

> command | less

只会显示屏幕上能容纳的尽可能多的行,然后您可以向下滚动以阅读其余内容。

Run the command with

> command | less

It will only show you as many lines as it can fit on the screen, and then you can scroll down to read the rest.

节枝 2024-12-27 10:40:31

我同意 Tudor 的观点:将终端输出“管道”到程序中 less 是实现您想要的操作的有效方法。要查看 less 中可用操作的列表,请按 h。一个特别有用的命令是 /,用于在 less 中搜索文本。请注意,q 退出程序。

另一种选择是使用 stdout 重定向运算符 >。例如,您还可以运行命令:

$command > output.txt

然后终端的输出将写入文件 output.txt,然后可以使用任何文本编辑器打开该文件。请注意,如果您使用 >> 而不是 >,输出将附加到文本文件的末尾,而不是覆盖它。

I agree with Tudor: "piping" the terminal output into the program less is an effective way to do what you want. To see a list of available actions in less press h. A particularly useful command is / to search the text in less. Note that q quits the program.

Another option would be to use a stdout redirection operator >. So for example you could also run your command as:

$command > output.txt

Then the output of your terminal will be written to the file output.txt which could then be opened with any text editor. Note if you use >> instead of > the output will be appended to the end of the text file instead of overwriting it.

成熟稳重的好男人 2024-12-27 10:40:31

Shift + PageUp
Shift + 向下翻页

Shift + PageUp
Shift + PageDown

々眼睛长脚气 2024-12-27 10:40:31

我使用iTerms,版本是Build 3.3.6。

选择无限回滚

首选项 -> 个人资料 -> 默认 -> 终端选项卡 -> 回滚缓冲区 -> 无限回滚

iTerms 首选项屏幕截图

I use iTerms and the version is Build 3.3.6.

Select Unlimited Scrollback

Preference -> Profile -> Default -> Terminal Tab -> Scrollback Buffer -> Unlimited Scrollback

iTerms Preferences screenshot

流心雨 2024-12-27 10:40:31

如果您使用 iTerm2,则可以在首选项 -> 下选择无限回滚。个人资料 ->终端

If you use iTerm2 then you can select the Unlimited scrollback under Preferences -> Profiles -> Terminal

安稳善良 2024-12-27 10:40:31

我知道这个回复要晚得多,但我今天在谷歌上搜索这个问题的答案,我将终端选项卡中 iTerm2 中的配置文件设置更改为无限滚动,但它不起作用。然后,当我运行命令 npmrebuild> 时, ~/desktop/output.txt,我注意到输出末尾有以下警告:

npm rebuild > ~/desktop/output.txt
info sharp Using existing vendored libvips v8.8.1
prebuild-install WARN install No prebuilt binaries found 
(target=11.14.0 runtime=node arch=x64 libc= platform=darwin)
gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be 
removed in node-gyp v4, please use NODEJS_ORG_MIRROR
gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be 
removed in node-gyp v4, please use NODEJS_ORG_MIRROR
gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be 
removed in node-gyp v4, please use NODEJS_ORG_MIRROR
✔ mozjpeg pre-build test passed successfully
✔ pngquant pre-build test passed successfully
✔ cwebp pre-build test passed successfully
(node:94642) MaxListenersExceededWarning: Possible EventEmitter memory 
leak detected. 11 SIGINT listeners added. Use emitter.setMaxListeners() 
to increase limit
node-pre-gyp WARN Using request for node-pre-gyp https download

因此,最好将命令的输出重定向到 txt 文件,而不必担心内存泄漏!只是想我会分享。谢谢!

I know this response comes much later, but I was googling for an answer today to this issue, and I changed my profile settings in my iTerm2 in the Terminal tab to unlimited scroll, and it did not work. Then, when I ran the command npm rebuild > ~/desktop/output.txt, I noticed the following warning at the end out the output:

npm rebuild > ~/desktop/output.txt
info sharp Using existing vendored libvips v8.8.1
prebuild-install WARN install No prebuilt binaries found 
(target=11.14.0 runtime=node arch=x64 libc= platform=darwin)
gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be 
removed in node-gyp v4, please use NODEJS_ORG_MIRROR
gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be 
removed in node-gyp v4, please use NODEJS_ORG_MIRROR
gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be 
removed in node-gyp v4, please use NODEJS_ORG_MIRROR
✔ mozjpeg pre-build test passed successfully
✔ pngquant pre-build test passed successfully
✔ cwebp pre-build test passed successfully
(node:94642) MaxListenersExceededWarning: Possible EventEmitter memory 
leak detected. 11 SIGINT listeners added. Use emitter.setMaxListeners() 
to increase limit
node-pre-gyp WARN Using request for node-pre-gyp https download

So it's definitely better to simply redirect the output from a command to a txt file and not worry about memory leaks! Just thought I would share. Thanks!

南七夏 2024-12-27 10:40:31

也可以直接在vim中查看。

 command | vim -

You can also view it in vim directly.

 command | vim -
预谋 2024-12-27 10:40:31

运行“命令>输出.txt;少输出.txt”';'分隔每个命令,命令一个表示:
将命令的输出写入output.txt
命令二的意思是:
显示output.txt的内容

我没有使用';'解释一下,如果您将整个命令(包括“;”)粘贴到终端中,它实际上就会运行。

run "command > output.txt;less output.txt" ';' seperates each command, command one means:
write the output of the command to output.txt
command two means:
show the content of output.txt

I'm not using the ';' to explain, if you paste the whole command(including the ';') in your terminal, it will actually run.

欢烬 2024-12-27 10:40:31

在我的 Xubuntu 终端中,我可以使用空格键前进输出,使用“b”返回,使用“q”退出提示符。

In my Xubuntu terminal I can use the spacebar to advance the output, "b" to go back, and "q" to quit to the prompt.

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