Unix
The less command is a program to view the content of text files. As per the less manual, less program is similar to more program, but it allows both forward and backward movement in a file and it does not read the entire input file before starting, so with larger input files less is faster than text editors like vi.
less program is the replacement of the more program. It displays the content of a file in page by page manner and thus falls into the pager program category.
[yusuf@linux ~]$ less filename
Example
[yusuf@linux ~]$ less hello.txt
line 1
This is line number 2.
3rd Line
Line Number 4
Line 5
6th Line
hello.txt (END)
Content of a file using the less command in terminal.
We use the q key to exit less.
Command | Description |
---|---|
Up Arrow | Scroll up one line |
Down Arrow | Scroll down one line |
b | Scroll back one page |
Space | Scroll forward one page |
1G | Move to the beginning of the text file |
g | Move to the beginning of the text file |
G | Move to the end of the text file |
/characters | Search for the next occurrence of the characters |
n | Search for the next occurrence of the previous search |
h | Display help |
q | Quit less |
Help screen of the less
ADVERTISEMENT