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.

pr06lefs ,

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:


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

etc.

agentsac ,

Like this?

matrixrunner ,
@matrixrunner@lemmy.world avatar

Or these?

thingsiplay ,

You can just grep the help output


<span style="color:#323232;">$ rsync --help </span><span style="color:#0086b3;">2</span><span style="font-weight:bold;color:#a71d5d;">>&</span><span style="color:#323232;">amp</span><span style="font-weight:bold;color:#a71d5d;">;</span><span style="color:#323232;">1 </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">grep -E </span><span style="color:#183691;">'^ *(--append-verify|--progress|--archive)'
</span><span style="color:#323232;">--archive, -a            archive mode is -rlptgoD (no -A,-X,-U,-N,-H)
</span><span style="color:#323232;">--append-verify          --append w/old data in file checksum
</span><span style="color:#323232;">--progress               show progress during transfer
</span>

So it should be possible to create a simple script to do that. Similarly one can output the man document as text to stdout, which in turn can be grepped. I have no grep command at hand to do this in a useful way:


<span style="color:#323232;">man grep </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">col -b
</span>
Majestix ,

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.

bitfucker ,

Please do tell once you’ve figured it out.

gomp ,

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


<span style="color:#323232;">❱ rsync --append-verify --progress -avz -
</span><span style="color:#323232;">-0  --from0                               (All *from/filter files are delimited by 0s)  --delete                   (Delete files that don’t exist on sender)
</span><span style="color:#323232;">-4  --ipv4                                                               (Prefer IPv4)  --delete-after         (Receiver deletes after transfer, not before)
</span><span style="color:#323232;">-6  --ipv6                                                               (Prefer IPv6)  --delete-before         (Receiver deletes before transfer (default))
</span><span style="color:#323232;">-8  --8-bit-output                          (Leave high-bit chars unescaped in output)  --delete-delay                 (Find deletions during, delete after)
</span><span style="color:#323232;">[more lines omitted]
</span>
TeddyKila ,

Fish does this but is intentionally POSIX noncompliant so you’d wanr to keep the old shell installed if you run other people’s script.

bastion ,

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

Eyck_of_denesle ,

Woman in emacs

crispy_kilt ,

What’s a womanual?

bastion ,

That’s the point.

I thought it would be clear that we should start calling them womanuals this was a joke.

ParetoOptimalDev ,

woman in emacs.

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

crispy_kilt ,

Nice operating system. Just lacks a good editor

MrSoup ,

Bonus:
You can open man pages inside GNOME Help by using yelp man:X

jbk ,

wow I kept opening man:somethingwithoutsectionunfortunately in firefox instead of doing that lol

e8d79 , (edited )

For KDE users, this also works with khelpcenter.

princessnorah ,
@princessnorah@lemmy.blahaj.zone avatar

Thank you, that’s awesome.

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.

Tovervlag , (edited )

I lately often use chatgpt for these kind of things. It’s amazing in breaking down the parameters and what they mean. Verify, especially when the problem is hard and apparently unfindable. Chatgpt won’t find it either. It sometimes makes up things in these scenarios.

edit: You guys are allowed to not like my post but it really helps me so why not try it instead of just downvoting.

Asetru ,

It’s amazing

It sometimes makes up things

xkcd.com/481/

Obi ,
@Obi@sopuli.xyz avatar

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

martinb ,

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

Zucca ,

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

github.com/dgouders/lsp

jazztickets ,

I always add a space or two before the flag: / -x

GadgeteerZA ,
@GadgeteerZA@fedia.io avatar
vzq ,

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.

ParetoOptimalDev ,

I did this before being in emacs made it so convenient to avoid, but got bit randomly by different versions or gnu vs BSD.

jeffreyosborne ,

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

underisk ,

tldr.inbrowser.app for anyone curious. There’s also a command line version you can install.

rotopenguin ,
@rotopenguin@infosec.pub avatar

I have to remember to use tldr, one of these days. Some manpages get so lost in the pedantry of covering everything that the 99 percentile stuff is buried.

wargreymon ,

info

rotopenguin ,
@rotopenguin@infosec.pub avatar

boooooo

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.

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

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