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.

  • thingsiplay@beehaw.org
    link
    fedilink
    arrow-up
    5
    ·
    edit-2
    5 months ago

    Sorry for my previous comment. I was commenting before reading the entire post and was missing the point. On a sidenote, its often enough and helpful to just list the options with program -h or --help . Sometimes the help option has more information or is easier to understand than the man document.

    When I search for options in a man document, I usually try it with putting a dash in front of it as -x or --ignore in example. For really large documents sometimes it can help to add a space before it " -x" or a comma after it "-x, " depending on how its actually written. BTW the man program itself has a builtin help you can show by just pressing h while looking at a document.

  • OneCardboardBox@lemmy.sdf.org
    link
    fedilink
    English
    arrow-up
    9
    arrow-down
    2
    ·
    5 months ago

    As an emacs user, I use M-x man. All my standard keybindings make finding what I need very easy.

    Of course, it’s not so fast if you aren’t already in emacs.

    • thingsiplay@beehaw.org
      link
      fedilink
      arrow-up
      15
      ·
      edit-2
      5 months ago

      I want to mention that one can set the pager for man to be Vim too. Then it would load the document in Vim instead in less for display and navigation. This can be set with option man -P pager or with the environmental variable $MANPAGER or $PAGER . I had set this up in the past with original Vim, but it required some special options for Vim as well. It was nice, but ultimately not needed; so I went back to less. Sometimes less is more.

      Edit: Here is how one can use Neovim as the pager:

      export MANPAGER='nvim +Man!'
      

      I kind of missed it and will set it to this now. Put this line in the Bash configuration .bashrc and every man document is loaded in Neovim now.

    • amanneedsamaid@sopuli.xyz
      link
      fedilink
      English
      arrow-up
      2
      arrow-down
      1
      ·
      5 months ago

      +1, displaying in a Emacs buffer solves any issues I could have. If you’re already ‘in’ Emacs, this will be more frictionless than shell scripts around man

  • bastion@feddit.nl
    link
    fedilink
    arrow-up
    11
    arrow-down
    9
    ·
    5 months ago

    Man pages this, man pages that. When will the Linux community start really thinking about woman pages?

  • kbal@fedia.io
    link
    fedilink
    arrow-up
    12
    ·
    edit-2
    5 months ago

    I am searching with /x

    On most systems these days you can use regular expressions there. If /-x isn’t good enough try /-x[ ,] or whatever.

  • traches@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    12
    ·
    5 months ago

    I’d also like some guidance on this problem (other than “use emacs”), but searching for “ -x” will have a lower false positive rate

  • kubok@fedia.io
    link
    fedilink
    arrow-up
    2
    ·
    5 months ago

    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.

  • sping@lemmy.sdf.org
    link
    fedilink
    English
    arrow-up
    4
    arrow-down
    1
    ·
    5 months ago

    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).

  • wuphysics87@lemmy.ml
    link
    fedilink
    arrow-up
    3
    ·
    5 months ago

    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.

  • Obi@sopuli.xyz
    link
    fedilink
    arrow-up
    12
    arrow-down
    2
    ·
    5 months ago

    As someone with 0 knowledge of Linux (and very little of programming/command lines in general), this thread reads funny AF.

    • martinb@lemmy.sdf.org
      link
      fedilink
      arrow-up
      2
      ·
      5 months ago

      We are deep in the technical weeds here. 95% of Linux usage really doesn’t require such humour unfortunately.