Use Tab Autocomplete In The Linux Terminal

Today’s article isn’t all that complex or anything, we’ll just cover how to use tab autocomplete in the Linux terminal. It’s a pretty handy tool to have in your Linux toolbox. It’s especially handy if you spend a lot of time in the terminal.

It seems to me that tab autocomplete is easier to do than it is to explain. It’s a great concept. I asked ChatGPT to explain it on my behalf and it did a fairly good job. It’s the middle of the night and I almost forgot to do an article. I got distracted, ended up elsewhere in the house, and fell asleep.

Fortunately, I already had the headline written. (Coming up with ideas is often more time-consuming than writing some articles.) That was a good thing. Otherwise, I’d have gone back to sleep and just written this tomorrow.

Anyhow, tab autocomplete is a tool that WILL save you some time. If you were local to me, it’d take like 2 minutes to show you how autocomplete works. It’s gonna take a bit longer to explain it with text!

I suppose that’s an adequate intro. Let’s see how AI does at explaining tab autocomplete and then try to make it more clear below that:

Use Tab Autocomplete In The Linux Terminal:

Linux terminal tab autocomplete is a feature that allows users to quickly and efficiently navigate through the file system and execute commands without typing out the entire file or command name. It works by automatically completing a partially typed file or command name when the user presses the “Tab” key.

To use tab autocomplete, the user needs to start typing the file or command name in the terminal window and then press the “Tab” key. If there is only one file or command that matches the typed characters, the system will automatically complete the name. If there are multiple matches, the system will display a list of possible options. The user can then continue typing until the desired file or command is highlighted and press “Tab” again to complete the name.

Tab autocomplete can be used for a variety of tasks, such as navigating the file system, running programs, and passing arguments to commands. For example, if the user wants to navigate to a directory called “Documents” in their home directory, they can type “cd Doc” and press “Tab.” The system will automatically complete the name to “cd Documents/”. This can save the user time and effort compared to typing out the full path.

Tab autocomplete also supports wildcards, which can be used to match multiple files or commands with similar names. For example, if the user types “ls *.txt” and presses “Tab,” the system will show a list of all the files in the current directory that end in “.txt”.

In summary, Linux terminal tab autocomplete is a powerful feature that allows users to quickly and efficiently navigate the file system and execute commands without typing out the entire name. It saves time and effort and can be used for a wide range of tasks.

Additional Tab Autocomplete Stuff:

So, to put that information to use, we can open a terminal. You can do so now just by pressing CTRL + ALT + T.

With your terminal now open, try the following command:

Now, press the TAB key on your keyboard (you may need to press the tab key twice). You’ll see something like this:

use tab autocomplete in the Linux terminal
You can probably figure it out from here. Once you understand it, you’ll appreciate it.

As you can see, it was not able to autocomplete because there were two available choices. If there are no choices it will show nothing. In this case, if you want to change to the Downloads directory, you’d enter the following:

Press the TAB key (probably twice), of course. For most of you, that’ll be enough. If it’s not, you should be able to figure out the minimum number of characters needed for autocomplete to work.

This also works on commands, but you need to have narrowed it down or it needs to not start with the more common letters. How to explain it?

If you type ‘l’ and hit tab, nothing will autocomplete.

If you type ‘ali’ and hit tab, it will spot autocomplete to ‘alias’. Additionally, it works for your installed applications. If you just enter ‘l’ and press the tab key (twice, if once doesn’t work) it will offer to display a bunch of commands starting with the letter ‘l’. For many of you, you should be able to just type ‘pav’ and then press the tab key to have it autocomplete to ‘pavucontrol’. That should make it reasonably clear.

Closure:

See? It’s not hard to do. It’s easier to do than it is to explain. I’ve never really needed to properly explain tab autocomplete in text format before. It’s much easier just to physically show folks than it is to explain it in text. Hmm… Now I can go back to bed. Dunno if I’ll sleep again, but I might as well try.

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.

Find Out What A File Is

Today we’ll have a simple article, one that shouldn’t take too long, as we learn one way to find out what a file is. It’s a handy command, but it won’t take all that long to explain. So, we’ve got that going for us!

The command we’re going to use is one that you almost certainly have installed by default. That command is the ‘file’ command. The man page describes file as:

file — determine file type

Linux pretty much treats everything like a file, pretty much. Files also contain a ‘magic number‘ – which is why you can rename an mp3 file as a gif file and it’ll still open in your media player. Basically, the magic number is the opening two bytes of a file that tell your system what kind of file you should be expecting. 

If you change the file extension it won’t fool the ‘file’ command. You can rename it with any extension you want and ‘file’ will know what the file is. Of course, it might be a text file, a compressed file, a Debian installer, etc… There are all sorts of file types out there. There are hundreds of file types just for image files.

So, yeah… We’ll be using the file command in this exercise. Let’s get to it!

Find Out What A File Is:

Like oh so many other articles, this one requires an open terminal. We do a great deal in the terminal. You can press CTRL + ALT + T and your default terminal should open.

With your terminal open, you’re probably in your home directory. So, the vast majority of you should be able to run the following command:

That file contains a bunch of the settings you see affected in the terminal. As you can see from the output, it’s an ASCII file, meaning you’d edit it with an ASCII (plain text) editor.

If you want, you can navigate to your Downloads directory and use ls to list the files. From there, you can run the file command on files you’ve downloaded. For example, I could run:

The output from that command would look like this:

The file command knows what the file is. It’s pretty accurate. It doesn’t matter if I change the .deb to .gif. 

See? Renaming the file didn’t fool the system. However, it might fool some applications. For example, if you click on that “.gif” file, your system might try to open it as an image and throw some sort of error. The file command can be pretty handy in those situations, where you’re not sure what the file type is and how you should approach it.

Closure:

Well, if you ever wanted to find out what a file is, you now know how. Over your computing journey, you may very well find you need to rely on the file command to know what the file type is. It’s a pretty handy command for when you need it. Of course, you could go so far as to edit the magic numbers to fool the command, but you’d probably know if you did 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.

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: Install .DEB Files In Ubuntu

Today’s article is only useful for a subset of my readers, that is those who need to know how to install .deb files in Ubuntu. That’s a bit cheeky of a headline, but there’s a character limit to adhere to. So, if you want to install .deb files in Ubuntu, this article is for you…

What are .deb files?

The .deb file extension means that it is a package meant to be installed in Debian. So, this article will be valid for all Debian users – even those downstream, like Ubuntu or Linux Mint.

Quite a few Linux distros use .deb files, not just Ubuntu. I happen to be an Ubuntu member and many of my readers use distros based on Ubuntu (which is, of course, based on Debian). To keep things short, we’re not going to type all that out over and over again.

Many new users start with Ubuntu or Mint, and Debian itself of course. You might be a new user and have reached the point where you’re comfortable installing software from the graphical installer built into your operating system of choice.

Well, this is Linux… There are all sorts of ways to do things! Assuming you’re safe, or unsafe if you want – it’s your choice, you can find software that’s not available in the graphical installer, or newer versions than what you’ll find in the graphical installer. You’ll often find this software available in .deb format and this article will show you a few ways to install those .deb files.

How To: Install .DEB files in Ubuntu:

The first way we’re going to cover will be in your terminal. You’ll likely need an open terminal for the rest of the methods, so you might as well open your terminal now. You can just smash the CTRL + ALT + T and your default terminal application should pop open.

The first method is pretty easy. You’re simply using ‘apt’ in the terminal, much like you’d do if you wanted to update from the terminal. The command would look something like this:

You’ll usually have downloaded the file to your Downloads directory, so you can either navigate to Downloads using the cd command or you can just include the folder in your path to the file, kind of like this:

Of course, you’ll use the actual file name and you’ll be asked for your password (unless you’ve changed that). Enter your password and let apt do its thing. Using apt is great because it will do its best to resolve any dependency issues you might have.

Now onto some GUI ways to install .deb files in Ubuntu!

Install .DEB Files With GDebi:

You followed the directions above and have an open terminal, right? Good, because GDebi doesn’t always come installed by default. I’ve previously written an article about GDebi, but it’s actually on the old site. I won’t bother linking it.

GDebi is a great GUI, that is a graphical, way to install .deb files. In fact, on the man page, it is described as:

gdebi – Simple tool to install deb files

To install .deb files with GDebi you first need to install it. You can do that right there in the terminal. To install GDebi, just run this command:

Once you have GDebi installed, you just use it from the right-click menu. Use your file manager to navigate to the download’s directory. Then you just right-click on the .deb file and choose to install it. The first time around, you might need to do some sort of ‘open with’ exercise, but then it should appear as something like “Open with GDebi package installer” or you will pick it from a list.

I’m positive you can figure it out from there. The great thing about using this GUI method to install software in Ubuntu is that it too will attempt to deal with any dependency issues automatically.

Install .DEB Files With QApt:

Do you still have that terminal open? Good! We have one final graphical method to install .deb files in Ubuntu. This one is a fairly new application and it’s a Qt application. However, it installs with very few dependencies and takes up very little space. Functionally, it’s very similar to GDebi.

So then, let’s start with getting QApt properly installed. The name is quite a bit longer, but it’s still easy to install QApt. To install the software, try this:

It’s a nice and light way to graphically install .deb files. For the life of me, I can’t figure out the correct man page incantation to make it work. No amount of trying the various words results in a man page opening. I do not know why, but I do know that it works. If you search to install QApt, it describes itself as:

qapt-deb-installer – tool for installing deb files

That’s plenty accurate. That’s what it is and that’s what it does. While I can’t find a man page for QApt, that’s an adequate description.

This QApt is a bit different. Like with GDebi, you’ll use your file manager to navigate to the directory that contains your .deb file (usually the Downloads directory) and right-click on the .deb file you wish to install. You’ll then pick “Open With” and click on the “QApt Package Installer”. With QApt now open, you’ll just click the obvious install button and wait patiently for it to do its thing.

Closure:

So, there you have it… You have another article and this one has you learning how to install .deb files in Ubuntu. There are a few ways and you can pick the one that works best for you. Much of the time, I already have a terminal open and already navigated to the ~/Downloads directory. Because of this, I’ll often just do the installation right there in the terminal, using the apt command. But, it’s up to you. You have choices!

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. 

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