ā¢ You can work with multiple files! I had no idea. There are commands to skip to/search across/etc. multiple filesā`:n` for next file and `:p` for the previous fileāeven just straight-up open a new file from within the current session (`:e`).
If you want to search *backward*, you can use `?` instead of `/`. (Mnemonic: `/` is `Shift-/` on a US English keyboard.) You can also modify the search query with flags before the search term, e.g. to find lines which donāt match (`!` or `^N`), wrap at the end (`^W`), etc.
ā¢ Search: you type `/` and then provide regex-ish syntax. Once youāre in that mode, `n` goes to the next match and `p` to the previous. Interestingly, `less` remembers that across sessions! (Other tools might as well, but `less` is the main one where I notice that behavior.)
ā¢ Jump to matching brackets: type the *opposite* bracket to get to the matching bracket, so `{` jumps to a matching `}` if the top line in the screen has a `{` in it; the same thing works for () and [].
There are also variants of these which let you scroll past the start or edge of the pageā¦ as will the totally-new-to-me `ā` and `ā` (or `Esc-(` and `Esc-)`) commands to scroll right or left. I guess that makes sense, but since things usually get auto-wrapped, I never knew!
ā¢ Which applies more generally: you can stick `N` in front of *lots* of commands and it will affect the resulting āsizeā of the operation. Want to go down by just 8, and make that the default? `8d` will do it. `12u` will go up in the file by 12 lines and set the default.
ā¢ You can change how big the āscreenā is. This does not change anything about the amount displayed on screen (thatās up to your terminal), but rather how big a āscreenā-sized is. You can set it to (e.g.) 8 lines explicitly with `-z8` or by preceding `z` with a number of lines.
Some things you can do with it: ā¢Ā Move forward and backward in a file, as promised by the description. `Space`, `^V`, `f` and `F` all go forward by a screenful. `b` and `^B` and `ESC-v` (or `Meta-v`) go backward by a āscreenā. But āscreenā is in quotes for a reason:
As with many Unix commands, the ājust do one thingā philosophy isā¦ not really intact. It accepts most of the upper- and lowercase English alphabet as flags, in most cases modifiable with `+`, for something around 80 individual ways you can invoke it. Many of them combinable!
A better summary: `less` displays a file in your terminal, page by pageāthus, a āpagerāāwith navigation commands stolen from `more` and `vi`ā¦ so good luck quitting! The way out is to hit `q`, but the man page does not tell you that, perhaps assuming you know `more` and `vi`.