It’s taken about a decade but I finally read the man page for “less.” Here are some important keyboard commands for navigating through files with it that I wanted to note for my own future use. If someone else gets a benefit from this, great, but it’s already helping me jump through man pages with more ease. (And it gave me an opportunity to write a post with a really ambiguous title.)
| Key | Function |
|---|---|
| f | Move forward one screen |
| b | Move backward one screen |
| j | Move forward one line |
| y | Move backward one line |
| = | Show the number of lines and your progress through the file |
| < | Move to the beginning of the file |
| > | Move to the end of the file |
| % | Scroll to the position in the file represented by the number before the percent sign |
These commands had eluded me for a long time, even though it would have been great to know them. After all, less is the default pager in Mac OS X. Thanks to the wonders of air travel, I had some time to read some off-line documentation.
Of course, I’ve long used “/” followed by some text to search through man pages, and that’s worth knowing if you don’t already. One useful trick I picked up was the search “/^EXAM” (props to Adam for mentioning the caret and making my recipe one character longer, but more specific) to search for the examples section.
Comments
less shares some keybindings
lessshares some keybindings withvi, including g and G for beginning-of-file and end-of-file, respectively. Also, I finally read the man page and foundless's parlance for for wrapping lines ("chop"), so I can nowless -Sand avoid wrapping.