less
View contents of text files, one page
TLDR
Open a file
Page down/up
Go to end/start of file
Forward search for a string (press
Backward search for a string (press
Follow the output of the currently opened file
Open the current file in an editor
Exit
SYNOPSIS
less [options] [file ...]
PARAMETERS
-?
Displays help information.
-a
Causes less to search all files for a pattern. By default, less only searches the current file.
-b n
Sets the number of buffers to use for input files.
-c
Causes less to repaint the screen from the top, rather than scrolling from the bottom.
-d
Suppresses error messages displayed due to long lines that don't fit on the screen. This also disables highlighting of the lines exceeding the screen width.
-e
Causes less to automatically exit after reaching the end of the first file.
-f
Forces less to open files, even special files or directories that might otherwise be skipped.
-g
Only highlights the matching string during the search instead of all instances.
-i
Causes searches to ignore case.
-N
Displays line numbers at the beginning of each line.
-p pattern
Starts less by searching for the first occurrence of pattern in the file.
-Q
Causes less to be completely silent; that is, never ring the terminal bell.
-s
Squeezes multiple blank lines into a single blank line.
-x n
Sets the tab stop interval to n spaces.
+command
Specifies a command to be executed each time a new file is examined.
DESCRIPTION
less is a terminal pager program that allows users to view the contents of text files, one screen at a time.
Unlike more basic pagers like more, less allows both forward and backward navigation through the file, making it significantly more user-friendly and efficient for examining large documents or output streams.
It doesn't load the entire file into memory, which allows for quickly viewing very large files. less supports a wide variety of features, including searching for patterns, navigating to specific lines, marking positions within the file, and handling multiple files simultaneously.
Its flexibility and efficiency have made it a standard tool for viewing text-based data in Unix-like operating systems.
CAVEATS
While less excels at viewing text files, it may not be suitable for viewing binary files or files with complex formatting. Direct use on very large single-line files may still face memory issues.
HISTORY
less was created as a replacement for the more command, addressing some of its limitations, most notably the inability to scroll backward through a file.
It was originally written by Mark Nudelman in 1983 and has been continuously improved and maintained since then. The name less is a pun on more.
Due to its enhanced functionality, it quickly became the pager of choice in many Unix-like environments and remains a vital tool for developers and system administrators.