Hacker News new | ask | show | jobs
by fcloud 106 days ago
I intended to post in defense of manpages. I love manpages. I think most open-source manpages are high-quality, and a few are really outstanding.

"It's easier to ask an AI" can be true without implying that manpages are bad.

However, "man" the tool does have issues, and one of them bit me just now.

So, I didn't know about openssh client escapes like ~?. I thought, "surely that's in the manpage?" I opened the manpage (in less) and searched for "\~\?". No hits.

Of course, escape characters are documented in the manpage, and the string "~?" does appear. Why didn't search find it? Because man, in its infinite wisdom, decided to render every instance of "~" as some bizarre unicode not-tilde, which is visually similar but totally impossible to grep for.

This has also bitten me in the past with dash. DASH. A character that is critically important when documenting invocation options. man loves to convert it into something that looks like dash, prints like dash, but doesn't come up in search.

I'm sure there is a way to turn this "feature" off, and I'm about to spend a bunch of time figuring out what it is. But this is documentation for command-line tools. Silently destroying our ability to grep it should NOT be the default.

6 comments

Manpages are both good and awful. If you already know how to use the command and you just need a refresher on how to enable the diagnostic option for wolves, they're fine. OTOH if you don't know how to use the command they're terrible, just an endless catalogue of incomprehensible options scrolling past. Problem is that that's what Dennis and Ken created in 1929 for use on ASR-33s and it hasn't been updated since. 99% of the time when I need to use some new unfamiliar command I go to whatever DDG pops up, usually StackOverflow, for a guide on usage.
I don't know about it changing your characters, but you can search for a string verbatim by pressing ctrl-r at the start of the search pattern, like this:

  /<ctrl-r>~?
Works for me on Debian (with the default pager, less).
There was more, then less, but once upon a time there was 'most'.

I miss most.

Thanks for the suggestions. Invoking man with "-E ascii" fixed this for me.

It sounds like some distributions do have this fixed in their default settings. I'm on Cygwin 3.6.6; maybe it's mostly a Cygwin thing.

Cygwin is nice, but it's a Frankenstein's monster. I'd hold back critical thoughts and feelings, until testing elsewhere.

You'll be happiest.

yeah it sounds like your environment is doing some weird mangling of the encoding. Maybe consider adding an 'alias man="man -E ascii"' into your .bashrc

You might also consider seeing if it's any different in WSL. Or you could, you know, just use Linux ;P

with neovim as the pager for man, it does find ~?

though you have to be aware of the escapes for regex, so \~?

\~\? works on macOS, as well as CentOS.