Post History
Unix systems are made out of many small tools that focus on specific tasks but are general enough that the investment made in learning their specific switches and hotkeys pays off over many applica...
Answer
#2: Post edited
- Unix systems are made out of many small tools that focus on specific tasks but are general enough that the investment made in learning their specific switches and hotkeys pays off over many applications.
- In that spirit, I would encourage you to get to know `less` better. It's not a tool specifically designed for the one use case of reading man pages; it's a general purpose tool that will come in handy in many situations, which is why learning how to use it well is worth the small ergonomic cost you'd be sacrificing by not using (or writing, as I don't know of such software) a program specifically designed to make reading man pages newbie-friendly.
- Did you know:
- * Anything that you can tell `less` on the command line, you can toggle while you are viewing what you're viewing—to turn strict case sensitivity on or off, just type `-i` (the exact same characters you'd use on the command line to turn this mode on).
- * `less`'s filters give a great way to find a specific occurrence of a string when you don't know exactly what you're looking for. As you brought it up as an example, here's how I look for something to do with symlinks in `man rsync`. I'd type `&symlink⏎⃣` to view a list of all the lines with the word `symlink` in them. That's a lot of results; I'd type `/↑⃣` to highlight the word I just used to filter. Let's say that I'm interested in the line near the bottom of the results that says, ‘Symbolic links are considered unsafe if they are absolute symlinks’. Sometimes I'd type `J` to move down the list until that line is at the top of the screen (`J`, as opposed to `j` or down arrow, will keep moving the screen even if `less` is at the end of its content—very useful in this context), but in this case, I'm more likely to type `/unsafe⏎⃣` (which searches *within* the already filtered results) and type `n` a much smaller number of times to get to the interesting line. Then I'll type `&⏎⃣` to turn off the filter, and now I'm viewing that line in context in the full man page.
- * Want a table of contents for the man page? Use filters again: `&^[^ ]⏎⃣` shows only the section headers. `J` will move down them until I have arrived at the section I want, and then `&⏎⃣` ‘expands’ it.
- All of this might seem a little arcane as ways to accomplish things like ‘view a table of contents’, but once you start to mentally decompose those problems into smaller, more general problems (like ‘display lines matching a filter’ and ‘test if a line is a section header’), a solid familiarity with the capabilities of tried-and-true Unix tools will serve you well.
- Unix systems are made out of many small tools that focus on specific tasks but are general enough that the investment made in learning their specific switches and hotkeys pays off over many applications.
- In that spirit, I would encourage you to get to know `less` better. It's not a tool specifically designed for the one use case of reading man pages; it's a general purpose tool that will come in handy in many situations, which is why learning how to use it well is worth the small ergonomic cost you'd be sacrificing by not using (or writing, as I don't know of such software) a program specifically designed to make reading man pages newbie-friendly.
- Did you know:
- * Anything that you can tell `less` on the command line, you can toggle while you are viewing what you're viewing—to turn strict case sensitivity on or off, just type `-i` (the exact same characters you'd use on the command line to turn this mode on).
- * `less`'s filters give a great way to find a specific occurrence of a string when you don't know exactly what you're looking for. As you brought it up as an example, here's how I look for something to do with symlinks in `man rsync`. I'd type `&symlink⏎⃣` to view a list of all the lines with the word `symlink` in them. That's a lot of results; I'd type `/↑⃣` to highlight the word I just used to filter. Let's say that I'm interested in the line near the bottom of the results that says, ‘Symbolic links are considered unsafe if they are absolute symlinks’. Sometimes I'd type `J` to move down the list until that line is at the top of the screen (`J`, as opposed to `j` or down arrow, will keep moving the screen even if `less` is at the end of its content—very useful in this context), but in this case, I'm more likely to type `/unsafe⏎⃣` (which searches *within* the already filtered results) and type `n` a much smaller number of times to get to the interesting line. Then I'll type `&⏎⃣` to turn off the filter, and now I'm viewing that line in context in the full man page.
- * Want a table of contents for the man page? Use filters again: `&^[^ ]⏎⃣` shows only the section headers. `J` will move down them until I have arrived at the section I want, and then `&⏎⃣` ‘expands’ it.
- * Do you frequently fat-finger regexes like the above? You can store custom commands in lesskey files: add the command `toc filter \^[\^ ]\r` and now you just have to remember `toc`. (The standard location for lesskey files is `~/.config/lesskey`, and you can learn how to write one with `man lesskey`.)
- All of this might seem a little arcane as ways to accomplish things like ‘view a table of contents’, but once you start to mentally decompose those problems into smaller, more general problems (like ‘display lines matching a filter’ and ‘test if a line is a section header’), a solid familiarity with the capabilities of tried-and-true Unix tools will serve you well.
#1: Initial revision
Unix systems are made out of many small tools that focus on specific tasks but are general enough that the investment made in learning their specific switches and hotkeys pays off over many applications. In that spirit, I would encourage you to get to know `less` better. It's not a tool specifically designed for the one use case of reading man pages; it's a general purpose tool that will come in handy in many situations, which is why learning how to use it well is worth the small ergonomic cost you'd be sacrificing by not using (or writing, as I don't know of such software) a program specifically designed to make reading man pages newbie-friendly. Did you know: * Anything that you can tell `less` on the command line, you can toggle while you are viewing what you're viewing—to turn strict case sensitivity on or off, just type `-i` (the exact same characters you'd use on the command line to turn this mode on). * `less`'s filters give a great way to find a specific occurrence of a string when you don't know exactly what you're looking for. As you brought it up as an example, here's how I look for something to do with symlinks in `man rsync`. I'd type `&symlink⏎⃣` to view a list of all the lines with the word `symlink` in them. That's a lot of results; I'd type `/↑⃣` to highlight the word I just used to filter. Let's say that I'm interested in the line near the bottom of the results that says, ‘Symbolic links are considered unsafe if they are absolute symlinks’. Sometimes I'd type `J` to move down the list until that line is at the top of the screen (`J`, as opposed to `j` or down arrow, will keep moving the screen even if `less` is at the end of its content—very useful in this context), but in this case, I'm more likely to type `/unsafe⏎⃣` (which searches *within* the already filtered results) and type `n` a much smaller number of times to get to the interesting line. Then I'll type `&⏎⃣` to turn off the filter, and now I'm viewing that line in context in the full man page. * Want a table of contents for the man page? Use filters again: `&^[^ ]⏎⃣` shows only the section headers. `J` will move down them until I have arrived at the section I want, and then `&⏎⃣` ‘expands’ it. All of this might seem a little arcane as ways to accomplish things like ‘view a table of contents’, but once you start to mentally decompose those problems into smaller, more general problems (like ‘display lines matching a filter’ and ‘test if a line is a section header’), a solid familiarity with the capabilities of tried-and-true Unix tools will serve you well.