If you want to view large files in Linux without the need to open a full-fledged text editor, you have several commands to do that. The less command is one of the commands. The less command is a Linux command-line utility that displays the contents of a file one page at a time. This command is similar to the more command, but it has several powerful features that allow you to navigate back and forth through a text file, as well as do some advanced text searching. The name less comes from the phrase "less is more.”
The less command syntax is very straightforward it takes optional options that modify its behavior and a file name to be examined. Look at this example which opens a file cold logs.txt with the less command:
less /var/logs/logs.txt
To quit less you just have to press the ‘q’ key or ZZ on your keyboard
With your text file opened, less provides you with different keys to navigate back and forth through the text files. The navigations can be categorized into different categories for example screen navigation, line navigation, scrolling, marking, and so on. Here are the navigation commands in less.
The less command has only two commands to navigate between lines.
Like in the vim editor, these keys can be preceded by N where N is any integer that instructs less how many N lines to move either forward or backward. For example, if you want to move 10 lines down you would use the command 10j.
The less command allows you to mark specific positions in a file by pressing the m key followed by any lowercase letter. For example, to mark the current line with the label a, you would press ‘ma’. To jump to the mark press the ‘ (apostrophe) followed by the label of the position. For example, to jump to a position marked with the label you press ‘a.