this post was submitted on 10 Jul 2024
132 points (97.8% liked)

Linux

47976 readers
1050 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

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.

top 50 comments
sorted by: hot top controversial new old
[–] [email protected] 3 points 3 months ago* (last edited 3 months ago)

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.

[–] [email protected] 3 points 3 months ago (2 children)

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

[–] [email protected] 5 points 3 months ago (1 children)
[–] [email protected] 3 points 3 months ago* (last edited 3 months ago)

That's the point.

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

[–] [email protected] 5 points 3 months ago

Woman in emacs

[–] [email protected] 2 points 3 months ago

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

https://github.com/dgouders/lsp

[–] [email protected] -3 points 3 months ago* (last edited 3 months ago) (1 children)

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.

[–] [email protected] 4 points 3 months ago

It's amazing

It sometimes makes up things

https://xkcd.com/481/

[–] [email protected] 13 points 3 months ago

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

[–] [email protected] 2 points 3 months ago* (last edited 3 months ago)
[–] [email protected] 4 points 3 months ago (1 children)

woman in emacs.

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

[–] [email protected] 2 points 3 months ago

Nice operating system. Just lacks a good editor

[–] [email protected] 15 points 3 months ago (2 children)

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

[–] [email protected] 4 points 3 months ago

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

[–] [email protected] 1 points 3 months ago

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

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

[–] [email protected] 4 points 3 months ago* (last edited 3 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.

[–] [email protected] 3 points 3 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.

[–] [email protected] 4 points 3 months ago (1 children)
[–] [email protected] 0 points 3 months ago
[–] [email protected] 12 points 3 months ago* (last edited 3 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.

[–] [email protected] 11 points 3 months ago (1 children)

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

[–] [email protected] 2 points 3 months ago

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

[–] [email protected] 5 points 3 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.
[–] [email protected] 1 points 3 months ago (1 children)

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.

[–] [email protected] 2 points 3 months ago* (last edited 3 months ago)

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

[–] [email protected] 4 points 3 months ago* (last edited 3 months ago)

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

[–] [email protected] 10 points 3 months ago (1 children)

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.

[–] [email protected] 2 points 3 months ago

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

[–] [email protected] 13 points 3 months ago (2 children)

Still waiting for someone to create Woman

[–] [email protected] 10 points 3 months ago* (last edited 3 months ago)
[–] [email protected] 4 points 3 months ago

I picture these pages being inviting and helpful, with maybe ascii art "awk sweet awk" or the like, rather than the current "maintenance locker full of random tools" vibe

[–] [email protected] 2 points 3 months ago (1 children)

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.

[–] [email protected] 2 points 3 months ago (1 children)
[–] [email protected] 1 points 3 months ago

I did not know that. Thank you.

[–] [email protected] 3 points 3 months ago

I use nvchad and pipe the man page into it

[–] [email protected] 0 points 3 months ago

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

[–] [email protected] 2 points 3 months ago

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

[–] [email protected] 10 points 3 months ago (2 children)

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

[–] [email protected] 3 points 3 months ago

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.

[–] [email protected] 2 points 3 months ago

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

load more comments
view more: next ›