Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The Linux system specifies how to use the less command

2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces how to use the Linux system to specify less commands, the content is very detailed, interested friends can refer to, I hope it can be helpful to you.

In Linux systems to display files or command output, you will think of less and more these two commands, less and more are somewhat similar but more advanced. The less command is a good choice when reading large files.

The general syntax of the less command is as follows: less [OPTIONS] filename, for example, to view the file contents of / usr/share/common-licenses/GPL-3, you would type: less / usr/share/common-licenses/GPL-3

You can also use pipes to redirect the output of the command to less. For example, to view the output of the command ps page by page, type: ps aux | less browse the contents of a file that is too large to fit on a page, you will see a colon (?). To go to the next page, press f or the spacebar. If you want to move down a specific number of lines, type a number, followed by a space or f key. You can press the down arrow or enter to scroll back one line, and scroll forward by the up arrow.

To return to the previous page, press b. Move up a specific number of lines by typing a number followed by b. If you want to search for a pattern, type /, and then type the pattern you want to search for. Once you press enter, less will search forward for a match. Search backwards for use? Followed by the search pattern. When the end of the file is reached, the END is displayed at the bottom of the screen. To exit less and return to the command line, press Q.

Less option if you want less to display line numbers, start the program with the following-N option: less-N filename by default, when less exits, the file contents are cleared from the screen. To keep the contents of the file on the screen, use the following-X option: less-X filename the + F option tells less that the contents of the file you are viewing may change. This is useful when opening log files. Less + F / var/log/messages less with the + F option behaves almost the same as the tail-f command. Less commands this less program contains a number of commands that allow you to browse the contents of the file and search for strings. If you want to see a complete list of all commands, use h. Here are some of the most commonly used commands for browsing the contents of a file while less is viewing:

What is Linux system Linux is a free-to-use and free-spread UNIX-like operating system, is a POSIX-based multi-user, multi-task, multi-threaded and multi-CPU operating system, using Linux can run major Unix tools, applications and network protocols.

On the Linux system to specify how to use less commands to share here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report