Search Your Man Pages With Apropos

Today we will show you how to search your man pages with apropos. If you’ve forgotten a command, apropos might be what you’re after. If you aren’t already aware, it’s possible to search your man pages. This article will show you how to do just that.

I should first point out that most folks would use apropos only as a last resort. If you have access to the internet, and you’re a normal human, you don’t need to rely on the rudimentary search that is apropos.

Apropos is great if you can remember a good description of the application you’re thinking of. But, it’s a basic search. It searches just for matching text. The details in the body of the article will hopefully make that more clear. Even still, it can be a useful reminder. I use apropos sometimes, but I think it’s clear that I’m not a normal user.

In fact, apropos is pretty good if you’ve got the command right there on the proverbial tip of your tongue. It’s good if you can remember some words the man page used to describe the application. It’s reasonably good at giving you a list.

After all, let’s face it, even a bare-bones Linux installation has thousands of applications installed. There are more commands than any one person can reasonably remember. If you try to memorize them all, your dinner will get cold and your head will pop off. (Trust me, I’m a doctor!)

Search Your Man Pages With Apropos:

If we’re going to be searching your man pages, we’re going to be doing it in the terminal. So, you’ll need an open terminal for this article. Just press CTRL + ALT + T and your terminal should pop open.

With your terminal open, you might as well check the man page for apropos:

Now, you have two real choices. You can put quotes around your search term to search specifically for those words in that order, or you can just use search terms without quotes which may net more results.

Let’s test this out… Let’s search for “list files”. That seems reasonable, right? We’ll pretend we’re looking for the ‘ls’ command.

Go ahead and try that. You’ll probably get a cheeky message about finding nothing appropriate. 

But, if you try this command, you’ll get a bunch of results:

If you weed through the output from that command, you should find the ‘ls’ command. If you wanted it narrowed down, you’d have wanted to try something like:

If you couldn’t remember ‘ls’ then you’re probably not going to remember the rest of that. So, you can start with the second search (just “list”) and find it that way.

Now, rather than explain it deeper, I’ll just show you what happens if you don’t use quotes. Try the following command:

Sure enough, you’ll find the ‘ls’ command in the output. It’ll give you a bunch of results but you can see that you don’t need to order the words exactly as they are on the man page. It’ll happily search for any those words, regardless of the order they’re in.

Closure:

See? It’s a new article. This time, we’ve decided to cover how to search your man pages with apropos. It’s not the most useful of commands, but it’s available – and probably useful if you don’t have an internet connection. Or, it’s useful for people like me, people who do all sorts of weird stuff in the terminal, sometimes even if there’s a faster or easier way.

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Turn Your Man Pages Into HTML

Today’s article is going to teach you how to turn your man pages into HTML. It’s a relatively straightforward process and handy if you want your man pages to be more easily read. It should be a quick article, as I have preexisting work to help along the way. 

Again, making your man pages easier to read is really the only reason why I can think of for doing this – other than preparing them for uploading to share on a web site. I’m not entirely sure why you’d want to upload them, when there are already uploaded and maintained versions of man pages.

If you recall, the last article was about showing you how to find your man page’s location on disk. In that article, you learned about the whereis command. The reason that article was done first was so that I can save some time and just refer you to the first article. 

So, yeah, click that last link and learn about the whereis command, saving me a bunch of time and typing! After all, I planned ahead! I swear, half these articles are so that I can refer to ’em later, I just forget that I wrote ’em. Wine might just be a factor.

Anyhow, with you having refreshed your memory by reading the previous article, let’s just jump right into it. Let’s learn how to…

Turn Your Man Pages Into HTML:

Like many other articles on this site, you’re gonna need an open terminal. If you don’t know how to open the terminal, you can do so with your keyboard – just press CTRL + ALT + T and your default terminal should open.

Once you have a terminal open, you’ll want to install man2html. That should be in your default repositories, so I’ll save some time and just share how to install it in Debian/Ubuntu/derivatives. It’s just:

Once installed, we can check the man page and see that it defines itself as:

man2html – format a manual page in html

Which is, well, a pretty good description. That’s what it does. That’s what we’ll be using it for. Imagine that?!?

Now, the first step in the operation is finding the location of your man pages. To do that, we’ll use the whereis command – like so:

The 3rd field is what we’re actually after, so you can use awk to help you out. That’d look more like this:

That’s the actual path to the man page for ls.  You’ll need it for the next command. That’d look like:

Now, as you can see, the command first needs to know the path of the man page and then needs to know the path where you wish to save the output HTML file. You can adjust each according to your needs, using the > operand to determine where the resulting file is saved. 

If you need a refresher on how to output the terminal to a file, click and read:

How To: Write Text To A File From The Terminal with “>” and “

(See, more foreshadowing!)

The output from your command should end up looking something like this:

man2html does its magic with the ls command
See? You get HTML as your output when you turn your man pages into HTmL! Tada!

Anyhow, that’s actually all there is to it. Use the whereis to find the location of the man page. With that information you use man2html to write the HTML to a directory of your choosing. ‘Snot all that difficult, now is it? And to think, there are people afraid of the terminal!

Closure:

Well, there you have it. It’s a pretty simple article, mostly thanks to having written a lot of the information ahead of time – in other articles. Sometimes I plan on another article to follow an article, but I forget or it just gets lost in the shuffle. The good news is that the search function works well enough and I now have a whole lot of articles to reference! If nothing else, you now know how to turn your man pages into HTML – should you want to do so.

Until next time…

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

How To: Find Your Man Pages’ Location On Disk

Today’s article is going to teach you how to find your man pages’ location on disk. It may not be a very useful skill, but it’s one that will come in handy in a future article. (That’s called ‘foreshadowing’!) Well, it seems likely that it’ll come in handy with a future article.

By the way, if you’re curious about why the first lines in these articles are often ‘forced’, it’s because of search engine optimization. You can blame the search engines, but it works.

Many of you will be familiar with the which command. You can use that to locate a binary for an application. For example, you can go with:

Which will output something along the lines of:

And that’s great. If that’s what you need to know, that’s what you need to know. However, what if you want to also know where your man page file is located? 

It should come as no surprise that Linux will happily spit that information out, so long as you know the correct incantations. And, for that, you have Linux Tips – where I’m gonna tell you how to find your man pages’ location.

Man Pages Location:

This article requires an open terminal, like many other articles on this site. If you don’t know how to open the terminal, you can do so with your keyboard – just press CTRL + ALT + T and your default terminal should open.

The tool we’re going to be using is similar to which, and even spits out the same information. The tool in question whereis and the man page describes it as:

whereis – locate the binary, source, and manual page files for a command

As you can see, it’s a pretty simple command. It will also only show you the source if you actually have the source. In most cases, you have compiled binaries and that’s what your system uses. It’ll happily locate the binary just like the which command does.

So, let’s test it… Hmm… Let’s test it with the ‘ls’ command:

whereis command in action
See? It does exactly what i told you it would do! That’s why I make the big bucks!

So, if you want to know where your man pages are located for a specific applications, this is an easy way to do that. Obviously, it’s the 2nd bit of information. Though, I suppose if you only want the output to contain the path to the man pages, you could use a command like this:

That will just spit out the path to the man page, if that’s all you want to see. Try it with a few different commands and you’ll lock it into your memory – ’cause you never know when it’s going to come in handy.

Closure:

And there you have it… You have another article! This is just one of many articles, so feel free to browse around. You might even learn something new! I’ve officially written so many of these things that I can’t actually remember them all. I legit need to search first and make sure I haven’t already written the article. (I probably should have devised a system to avoid this, but the search function appears to be pretty good and effective.)

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Linux Tips
Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.