长输出后在终端/命令提示符中查看所有内容
我是 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(11)
在终端窗口内,转到
Edit |配置文件首选项
,单击滚动
选项卡,然后选中回滚XXX行
行下方的无限制
复选框。单击关闭
即可。Inside your Terminal Window, go to
Edit | Profile Preferences
, click on theScrolling
tab, and check theUnlimited
checkbox underneath theScrollback XXX lines
row. ClickClose
and be happy.使用它运行命令
只会显示屏幕上能容纳的尽可能多的行,然后您可以向下滚动以阅读其余内容。
Run the command with
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.
我同意 Tudor 的观点:将终端输出“管道”到程序中
less
是实现您想要的操作的有效方法。要查看less
中可用操作的列表,请按h
。一个特别有用的命令是/
,用于在 less 中搜索文本。请注意,q
退出程序。另一种选择是使用 stdout 重定向运算符
>
。例如,您还可以运行命令:然后终端的输出将写入文件 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 inless
pressh
. A particularly useful command is/
to search the text in less. Note thatq
quits the program.Another option would be to use a stdout redirection operator
>
. So for example you could also run your command as: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.Shift + PageUp
Shift + 向下翻页
Shift + PageUp
Shift + PageDown
我使用iTerms,版本是Build 3.3.6。
选择
无限回滚
首选项
->个人资料
->默认
->终端选项卡
->回滚缓冲区
->无限回滚
I use iTerms and the version is Build 3.3.6.
Select
Unlimited Scrollback
Preference
->Profile
->Default
->Terminal Tab
->Scrollback Buffer
->Unlimited Scrollback
如果您使用 iTerm2,则可以在
首选项 -> 下选择
无限回滚
。个人资料 ->终端If you use iTerm2 then you can select the
Unlimited scrollback
underPreferences -> Profiles -> Terminal
我知道这个回复要晚得多,但我今天在谷歌上搜索这个问题的答案,我将终端选项卡中 iTerm2 中的配置文件设置更改为无限滚动,但它不起作用。然后,当我运行命令
npmrebuild> 时, ~/desktop/output.txt
,我注意到输出末尾有以下警告:因此,最好将命令的输出重定向到 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: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!
tmux
和 GNUscreen
迟早,您会屈服于这些出色的工具:
tmux
:https://superuser.com/questions/209437/how-do-i-scroll-in- tmux屏幕
:https://unix.stackexchange.com/questions/40242/scroll-inside-屏幕或暂停输出/40243tmux
and GNUscreen
Sooner or later, you will give in to those awesome tools:
tmux
: https://superuser.com/questions/209437/how-do-i-scroll-in-tmuxscreen
: https://unix.stackexchange.com/questions/40242/scroll-inside-screen-or-pause-output/40243也可以直接在vim中查看。
You can also view it in vim directly.
运行“命令>输出.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.
在我的 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.