less命令乱码_less命令

less命令乱码

The less command is one I use a lot. It shows you the content stored inside a file, in a nice and interactive UI.

less命令是我经常使用的命令。 它以精美的交互式UI向您显示文件中存储的内容。

Usage: less .

用法: less

less命令乱码_less命令_第1张图片

Once you are inside a less session, you can quit by pressing q.

进入less会话后,可以按q退出。

You can navigate the file contents using the up and down keys, or using the space bar and b to navigate page by page. You can also jump to the end of the file pressing G and jump back to the start pressing g.

您可以使用updown键,或使用space barb来逐页浏览文件内容。 您也可以按G跳到文件末尾,然后按g跳回到文件头。

You can search contents inside the file by pressing / and typing a word to search. This searches forward. You can search backwards using the ? symbol and typing a word.

您可以通过按/并输入一个单词来搜索文件内的内容。 这向前搜索。 您可以使用?向后搜索? 符号并输入一个单词。

This command just visualises the file’s content. You can directly open an editor by pressing v. It will use the system editor, which in most cases is vim.

该命令仅可视化文件的内容。 您可以通过按v直接打开编辑器。 它将使用系统编辑器,在大多数情况下为vim

Pressing the F key enters follow mode, or watch mode. When the file is changed by someone else, like from another program, you get to see the changes live. By default this is not happening, and you only see the file version at the time you opened it. You need to press ctrl-C to quit this mode. In this case the behaviour is similar to running the tail -f command.

F键进入跟随模式观看模式 。 当其他人(例如从另一个程序)更改文件时,您可以实时看到更改。 默认情况下,这不会发生,并且您仅在打开文件时看到文件版本。 您需要按ctrl-C退出此模式。 在这种情况下,其行为类似于运行tail -f 命令。

You can open multiple files, and navigate through them using :n (to go to the next file) and :p (to go to the previous).

您可以打开多个文件,并使用:n (转到下一个文件)和:p (转到上一个)浏览它们。

This command works on Linux, macOS, WSL, and anywhere you have a UNIX environment

此命令可在Linux,macOS,WSL以及您拥有UNIX环境的任何地方使用

翻译自: https://flaviocopes.com/unix-command-less/

less命令乱码

你可能感兴趣的