There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

Is there a better way to browse man pages?

For many, many years now when I want to browse a man page about something I’ll type man X into my terminal, substituting X for whatever it is I wish to learn about. Depending on the manual, it’s short and therefore easy to find what I want, or I am deep in the woods because I’m trying to find a specific flag that appears many times in a very long document. Woe is me if the flag switch is a bare letter, like x.

And let’s say it is x. Now I am searching with /x followed by n n n n n n n n N n n n n n. Obviously I’m not finding the information I want, the search is literal (not fuzzy, nor “whole word”), and even if I find something the manual pager might overshoot me because finding text will move the found line to the top of the terminal, and maybe the information I really want comes one or two lines above.

So… there HAS to be a better way, right? There has to be a modern, fast, easily greppable version to go through a man page. Does it exist?

P.S. I am not talking about summaries like tldr because I typically don’t need summaries but actual technical descriptions.

Schmerzbold , (edited )

You can set on what line on the screen less (the pager program man uses by default) puts search results with the -jn/–jump-target=n option. For example, using .5 as a value for n makes less focus the line with the search result on the center of the screen. This should help with your overshoot issue.

Either set the option within less with the - command followed by j.5↵ for the current running instance of less, or set and export the LESS environment variable inside your ~/.bashrc to have less always behave that way.

wargreymon ,

info

rotopenguin ,
@rotopenguin@infosec.pub avatar

boooooo

electricprism ,

I read man in nvim, there is a alias on the arch wiki IIRC (and syntax highlighting)

sping ,

Sorry it’s not a very direct answer but this is one of the many things that make Emacs such a comfortable environment once you’re used to it, which takes … a while.

There is a man command and then of course it’s just more text displayed so you can search and narrow and highlight etc. in the same way you do with any other text. Plus of course there are a few trivial bonuses like links to other man pages being clickable.

It’s all text and Emacs is a text manipulation framework (that naturally includes some editors).

ssm , (edited )
@ssm@lemmy.sdf.org avatar

the / and ? commands in the pagers more and most less implementations should support regular expressions (usually BREs in my experience); which is the same thing grep uses. Consider reading your friendly neighborhood regex formatting manpage, if you are confused. As for easily scrolling, ^G to terminate your search followed by b (or your favorite vi or emacs scrolling bind) to scroll back should be sufficient.

Also, man some-manpage | grep expression works, if you didn’t know.

wuphysics87 ,

You can search via regex. For instance you know a section heading or flag is the first thing on a line preceded with spaces. I also find it earier to read with extensions for colors.

RovingFox ,
@RovingFox@infosec.pub avatar

I use nvchad and pipe the man page into it

Zucca ,

I haven’t used lsp for a while, but it seemed like a good $PAGER.

github.com/dgouders/lsp

troyunrau ,
@troyunrau@lemmy.ca avatar

In KDE, there used to be man: as a protocol that you could use from Konqueror or anything else for that matter. Does it still exist?

I’m at work and cannot check.

JRepin ,
@JRepin@lemmy.ml avatar

Yup still exists. It is also available in KDE Help Center. And you can quickly jump to a man page you typing “” into KRunner.

kubok ,

I have krunner with the man plugin enabled. When typing man:X in the krunner prompt, a window opens with a nicely styled man page.

JRepin ,
@JRepin@lemmy.ml avatar

Even quicker is “#X”

kubok ,

I did not know that. Thank you.

nore ,

I’ve had this same situation happen to me before and my solution was to search -x instead of just x.

GadgeteerZA ,
@GadgeteerZA@fedia.io avatar
Andy ,
@Andy@programming.dev avatar

As someone else said, setting less’ jump value is helpful.

Another tool I use, mostly for the zshall manpage, is github.com/kristopolous/mansnip

Rozauhtuno ,
@Rozauhtuno@lemmy.blahaj.zone avatar

It’s not exactly what you asked for, but the fish shell has often explanations of what each flag does.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • [email protected]
  • random
  • lifeLocal
  • goranko
  • All magazines