less command
Updated 29 October 2024
bash
$ less <filename>Navigation
| SPACE or CTRL+F | forward one window |
| b or CTRL+B | backward one window |
| d or CTRL+D | forward half window |
| u CTRL+U | backward half window |
| j | navigate forward by one line |
| 10j | 10 lines forward. |
| k | navigate backward by one line |
| 10k | 10 lines backward. |
| G | go to the end of the file |
| g | go to the start of the file |
| q or ZZ | exit the less pager |
Forward search
| / | search forward for a pattern |
| n | move forward for the next occurrence. |
| N | move backward for the previous occurrence |
Backward search
| ? | search backward for a pattern |
| n | move backward for the next occurrence. |
| N | move forward for the previous occurrence |
Other commands
| F | Follow the end of the file as more lines are added, similar to tail -f. |
| m<any-lower-letter> | Mark the current position with the letter the specified lower letter, |
| ‘<lower-letter> | go to the marked position marked with the specified lower letter. |
| &pattern | display only the matching lines, not all. |
| v | Open the current file in the default editor. |
| CTRL+G or = | show the current file name along with line, byte, and percentage statistics. |
| h | display help |
| :e filename | While viewing a file with less this command allows you to open/examine a. |
| :n | go to the next file |
| :p | go to the previous file |
Options
Spotted a mistake or want something added? Send me a note.