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.

How To: Not Save A Command To Bash History

Today’s article is another short-form article, where the subject is how to not save a command to bash history. It’s trivially easy and something everyone can learn. So, read on and learn how to not save a command to Bash history.

The vast majority of my readers are going to default to using Bash. 

bash – GNU Bourne-Again SHell

You’ll access Bash through your terminal and, again as the default, will save x-amount of past commands to a file known as ~/.bash_history. Anything you enter as a command (though not passwords entered at the password prompt, as that’d just be silly) will be saved to that file.

If you’re like me, you use the terminal a great deal. Again, if you’re like me, you value the Bash history aspect but you don’t want it full of trivial or experimental nonsense. You can prevent a terminal input from being saved in your ~/.bash_history – and it’s trivial to do so.

Do Not Save A Command To Bash History:

Seeing as I’ve been doing short-form articles for the past couple, this one seemed like a lovely tip to share with my readers, as I’m sure some will not know this. 

Of course, you’ll need an open terminal for this. Press CTRL + ALT + T and your default terminal should open.

With your terminal now open, we’ll use the ‘ls’ command to list the contents of your present working directory. Ready?

Now, that’ll be saved to your Bash history file. What if you don’t want it saved to that file? Just add a space in front of it, like so:

I don’t know how well that will show up, but trust me when I say there’s a space there. By adding that space, I’ve effectively told the terminal to not save that entry into the history file.

See? Pretty darned simple!

Closure:

So, yeah… I’ve been doing a few short articles and this seemed like the perfect article to do in that format. It’s something not everyone knows, isn’t made immediately obvious, and will likely be of importance to someone. If you’ve ever wanted to not save a command to bash history, that’d be how you do it.

I could have added a few more bash tricks and turned this into a longer article, but I’m having fun with this shorter stuff right now. If you prefer the longer articles, don’t worry. They’ll be back soon enough. These short articles are fun and easy, and they have the added benefit of keeping me interested in writing these silly things.

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. 

How To: Tell If You Are You Using UEFI or BIOS

Today’s article will be another short-form article, where we quickly learn how to tell if you’re using UEFI or BIOS with your Linux computer. Making a few short-form articles seems like a fun idea, so why not? There’s room for all sorts of stuff and now that I’ve done this for a couple of years.

In short, when you boot your computer there’s a bunch of stuff you don’t see, but the hardware needs to interact with the software. We used BIOS for many years, but the new and improved method is UEFI (which stands for Unified Extensible Firmware Interface). 

UEFI is meant to improve on some BIOS limitations and to help increase your security. If you have a modern computer, it’s capable of UEFI but might have BIOS available. If BIOS is available, it may be referred to as ‘Legacy’ if you want to go mucking about to change it.

Linux supports both UEFI and BIOS booting. If you installed Linux yourself, you may already know if you’re using UEFI or legacy booting. However, if your Linux installer notices that it is in either mode, it will default to installing in that mode. So, I suppose it’s possible for some folks to not actually know if they’re using UEFI or BIOS.

This leads me to today’s article…

Are You Using UEFI or BIOS:

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.

With your new terminal open, type the following command (or cut and paste the command, if that’s easier):

If it lists an output, you’re using UEFI. You’re using BIOS if you get an output that’s something similar to:

It really is that simple. 

Closure:

Well, this is the shortest article I’ve written. At least I’m pretty sure that it’s the shortest article I’ve ever shared. Brevity is not my strong point, but at least now you know how to tell if you’re using UEFI or BIOS. So, you didn’t come away empty-handed – unless, of course, you already knew that.

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: List USB Devices

Today’s article might look like a funny headline, where the subject would be how to list USB devices. Today, we’ll have a relatively short article. It’s not complicated and you’ve already learned how to list USB devices! Wait-a-minute!

After all, you’ve already been told how to do this. In fact, I’ve written an article on this very subject! See:

A Little About The ‘lsusb’ Command.

That article covered how to list USB devices, using the lsusb command. Right?

Yes. Yes, it did.

But, this is Linux and there’s another command that doesn’t get enough attention. In fact, I’d wager (a small amount) that many of you wouldn’t have used this command before. 

What is this mystery command? It’s really easy to remember. It’s not complicated, it’s simply “usb-devices”. On the man page, the command describes itself as:

usb-devices – print USB device details

Sure enough, that’s what it does. But, unlike the ‘lsusb’ command, this command spits out a whole lot more information by default. There’s not a whole lot more to say about it, and I’m making this article extra short. So…

List USB Devices:

As implied in the opening part of this article, you’re going to 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.

With your terminal now open, simply run the command:

If you check the man page, you’ll find that that’s it. There’s nothing special to do with this command, you just run it. The man page contains this:

usb-devices is a (bash) shell script that can be used to display details of USB buses in the system and the devices connected to them.

It might be the easiest command you’ll ever run – and it’s also easy to remember. So, why is it so unknown? Well, we use ‘lsusb’ for listing USB devices and the command doesn’t rank well in search engines, but it’s at the bottom of many such articles. It also doesn’t do much more than list USB devices, as it’s just some sort of a built-in bit of shell scripting.

Closure:

So, I figured I’d do an extra short article today. Why not? We’ve done some longer articles lately, so we might as well try the super-short format. It helps that I didn’t dive off-topic or the like, but simply explained how to list USB devices. Do you have any thoughts on articles in this shorter format?

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.

 

How To: List Open Files

Today’s article might seem unimportant and that’s okay because we’re just going to examine one way to list often files. So, in a way, it’s probably not all that important. If you are someone who wants to list open files, this would be the article for you!

For the most part, most of my readers aren’t going to want to know how to list open files because they just have no good reason to do so. It won’t be a very long article or anything. I did some long-format articles and they didn’t get much feedback. I’ll do more, but I don’t see them as needing to be all that immediate – or consistent. The shorter articles just seem to be what folks are looking for. I can live with that. (If you do like the longer articles, it’s not too late to mention that.)

Today’s tool will be one you may have never heard of. We’ll be using the right tool for the job, however. That tool will be the ‘lsof’ command. The ‘lsof’ command should be installed by default in any major distro and checking the man page will reveal that it describes itself like so:

lsof – list open files

Read that line and then look at the headline. See? I told you that it was the correct tool for the job. If you want to list open files, a tool that lists open files is the tool for the job. Imagine that?!?

List Open Files:

Of course, the lsof command is run in the terminal. As such, you’ll need an open terminal for this exercise. 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.

With your terminal open, you can just run the following command which will show every currently open file (it’s a lot):

You’ll notice some of the output will say something about “permission denied”. So, if you’re going to list all the open files, you probably should use sudo with the command. Like so:

Type in your password at the prompt and be prepared for the deluge of file names. It takes quite a bunch of open files for an operating system to work – and Linux treats everything like it’s a file.

So, what if you just want the output to tell you all the files opened by a specific user? The lsof command will help you out with that. Try this command:

For example:

That command will show you all the files opened by that user. It’s still a lot, but it’s an easier output to process. If you wanted to show the files opened by everyone except a specific user, you’d use this command:

That command would (assuming you removed the brackets) show you all the open files except those files opened by ‘username’. In any of these cases, if you see some permission denied errors you can just slap sudo on the front of it and be good to go.

Closure:

Well… If you’ve ever wanted to list open files you now know how to do so. I suppose it’d mostly be useful for things like auditing or troubleshooting performance issues. I have the command in my book of tricks, but I don’t recall ever needing to use it for much. I’ve played with lsof and it does list open files. So, there’s that.

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.

Subscribe To Our Newsletter
Get notified when new articles are published! It's free and I won't send you any spam.
Linux Tips
Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.