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.

  • pr06lefs@lemmy.ml
    link
    fedilink
    arrow-up
    43
    arrow-down
    2
    ·
    edit-2
    4 months ago

    Kind of off topic, but you know what would be cool? If you had an ‘man explain’ command that would define all the flags/args in a command, like:

    man explain rsync --append-verify --progress -avz -e "ssh -p 2222" root@$dip:/sdcard/DCIM/Camera newphonepix

    Would give you:

    rsync - a fast, versatile, remote (and local) file-copying tool
          --append-verify          --append w/old data in file checksum
          --progress               show progress during transfer
          --archive, -a            archive mode is -rlptgoD (no -A,-X,-U,-N,-H)
          --verbose, -v            increase verbosity
          --compress, -z           compress file data during the transfer
          --rsh=COMMAND, -e        specify the remote shell to use 
    

    etc.

    • gomp@lemmy.ml
      link
      fedilink
      arrow-up
      9
      ·
      4 months ago

      Here’s what I get in fish when I start writing a rsync command and hit tab to ask for completions:

      ❱ rsync --append-verify --progress -avz -
      -0  --from0                               (All *from/filter files are delimited by 0s)  --delete                   (Delete files that don’t exist on sender)
      -4  --ipv4                                                               (Prefer IPv4)  --delete-after         (Receiver deletes after transfer, not before)
      -6  --ipv6                                                               (Prefer IPv6)  --delete-before         (Receiver deletes before transfer (default))
      -8  --8-bit-output                          (Leave high-bit chars unescaped in output)  --delete-delay                 (Find deletions during, delete after)
      [more lines omitted]
      
    • Majestix@lemmy.world
      link
      fedilink
      arrow-up
      6
      arrow-down
      2
      ·
      4 months ago

      There is a Plugin for Zsh (ohmyzsh) that gives you that right in the shell. I use it all the time and rely on it. Don’t have the name on my mind though, sorry.

  • traches@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    12
    ·
    4 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

  • kbal@fedia.io
    link
    fedilink
    arrow-up
    12
    ·
    edit-2
    4 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.

  • vzq@lemmy.blahaj.zone
    link
    fedilink
    arrow-up
    11
    arrow-down
    1
    ·
    4 months ago

    Honestly, I usually just “man command” in google.

    I know it’s wrong but my browser is tiled next to my terminal and it’s easy to look up stuff.

  • jeffreyosborne@lemm.ee
    link
    fedilink
    arrow-up
    10
    ·
    4 months ago

    I like tldr. It doesnt give incredibly in depth explanations, but it does show the basics of using most commands.

  • Obi@sopuli.xyz
    link
    fedilink
    arrow-up
    11
    arrow-down
    2
    ·
    4 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
      ·
      4 months ago

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

  • OneCardboardBox@lemmy.sdf.org
    link
    fedilink
    English
    arrow-up
    8
    arrow-down
    2
    ·
    4 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.

    • amanneedsamaid@sopuli.xyz
      link
      fedilink
      English
      arrow-up
      2
      arrow-down
      1
      ·
      4 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

  • PseudoSpock@lemmy.dbzer0.com
    link
    fedilink
    arrow-up
    5
    ·
    4 months ago
           man -k printf
               Search  the short descriptions and manual page names for the keyword
               printf as regular expression.  Print out any matches.  Equivalent to
               apropos printf.
    
  • ParetoOptimalDev@lemmy.today
    link
    fedilink
    arrow-up
    6
    arrow-down
    2
    ·
    4 months ago

    woman in emacs.

    I also find info pages much nicer to use after an adjustment period given I grew up on vim and man.

  • Schmerzbold@feddit.org
    link
    fedilink
    English
    arrow-up
    4
    ·
    edit-2
    4 months ago

    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.