Linux(Ubuntu) 终端-如何查看以前的页面不再可见

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3200622/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-03 20:13:41  来源:igfitidea点击:

Linux(Ubuntu) Terminal-how to view previous pages not visible anymore

linuxterminal

提问by Namratha

When you scroll up, say to see a log, the first portion of it will not be visible since the terminal only supports a limited no. of lines. So if you want to scroll up and be able to see everything, at least a few pages up, how do you do it?

当您向上滚动时,比如说要查看日志,它的第一部分将不可见,因为终端仅支持有限的编号。行。因此,如果您想向上滚动并能够看到所有内容,至少向上翻几页,您会怎么做?

采纳答案by Dr. Snoopy

Use Shift+Page Upand Shift+Page Down.

使用Shift+Page UpShift+ Page Down

回答by Borealid

Try using the screencommand, and set its scrollback buffer to a larger size.

尝试使用该screen命令,并将其回滚缓冲区设置为更大的大小。

screenhas many other benefits and wonderful features.

screen还有许多其他好处和奇妙的功能。

If all you're doing is looking at a log, you could alternately use a pager such as less

如果您所做的只是查看日志,则可以交替使用寻呼机,例如 less

回答by tobiw

An alternative to screen is using tee to copy all output to a file while still printing it on the terminal:

screen 的替代方法是使用 tee 将所有输出复制到文件中,同时仍将其打印在终端上:

yourcommand | tee output.txt

回答by user385772

Some tricks I use-

我使用的一些技巧-

some terminal applications (gnome-terminal) allow you to increase the scroll-back buffer size

某些终端应用程序(gnome-terminal)允许您增加回滚缓冲区大小

pipe output to a file:

管道输出到文件:

command > file.log

pipe your command to less:

将您的命令通过管道传输到less:

command | less

tail log and pipe to grep to reduce output

尾日志和管道到 grep 以减少输出

tail -f example.log | grep 'search text'

回答by zdav

If you are using gnome-term (the default), then you can change your settings. Either set the no. of lines to unlimited, or to a much larger buffer size than the default.

如果您使用 gnome-term(默认),那么您可以更改您的设置。要么设置号。行数为无限制,或比默认值大得多的缓冲区大小。

回答by thegeek

Piping the output to a pager like the following is a better choice:

将输出通过管道传送到如下所示的寻呼机是更好的选择:

command | less 

command | more

回答by zerick

You can enable unlimited scroll back (or a huge amount if you want).

您可以启用无限回滚(或大量回滚,如果您愿意)。

To do this, go to

为此,请访问

File → Profile preferences → Scrolling [tab]

文件 → 配置文件首选项 → 滚动 [标签]

Then, check Unlimited, or set the number of lines desired. And of course, it only applies to the next typed lines.

然后,检查Unlimited或设置所需的行数。当然,它只适用于下一个键入的行。

回答by IsaacS

Essentially seconding to @zerick's solution but if you're on gnome-terminalyou can modify its config. See this.

本质上是支持@zerick 的解决方案,但如果你在,gnome-terminal你可以修改它的配置。看到这个

回答by Radioactive

If you want to scroll line by line, you can use

如果要逐行滚动,可以使用

Control+Shift+Up/Down Arrows.

Control+Shift+向上/向下箭头。

回答by Zhiwei

If you are in tmux (can create multiple terminal sessions in a single terminal session, highly recommended), you can easily use your normal navigation keys to scroll around after you do Ctrl-bthen [, for more details let's take a look at: How do I scroll in tmux?

如果您在 tmux(可以在单个终端会话中创建多个终端会话,强烈推荐),您可以轻松地使用您的普通导航键在完成后滚动Ctrl-b那么[,有关更多详细信息,让我们看看:我如何做在 tmux 中滚动?