Linux automatic command completion

Linux automatic command completion is a tool or program that can identify what you are typing in the Linux command line terminal and can complete that command, words or sentence for you. This is a really cool feature in Linux.

What you need to do to run Linux automatic command completion is pressing the Tab key. It is a program not a magic that can read your mind though. So you need to follow a procedure to use the Linux automatic command completion. Here is the procedure:

  1. You must be in the Linux command line terminal or command line interface in x-window.
  2. You just key in the first letter of the command you are going to use and then press tab. Linux will automatically complete that command for you.
  3. Linux automatic command completion is not going to work if there are other commands, words or sentences that start with the first letter you typed. In this case, you can press Tab key once again (press Tab key two times) to reveal what commands, words or sentences available with that letter. You need to press the second letter or maybe third letter depending on the situation.
  4. Linux automatic command completion is not going to work in certain condition such as when you are using man or find commands.
  5. Linux automatic command completion is not going to work in text editor.

That's some of the conditions regarding Linux automatic command completion. Let's see some examples to make it clear:

The first example is we are going to use Linux automatic command completion to complete ls command. So we just type l and press Tab key:

[email protected]:~$ l
Display all 122 possibilities? (y or n)

What happened above was, when I press l, Linux automatic command completion didn't work. That means there are many commands start with a letter l. So I press Tab key again to reveal what other commands are. And as you can see there are 122 possibilities available. So I just press n to not to display all 122 possibilities. Why? Because I just want to type ls command and I know what it is. The point here is, if it is a simple command like ls, cd or another 2 or 3 letters commands, we don't need Linux automatic command completion.

Now let's see a real useful example. Type cd /v and press Tab. Linux automatic command completion will complete the word to /var/.

[email protected]:~$ cd /var/

Next, key in l after the /var/ like in the example below and press Tab. Nothing happened. Press Tab again and Linux will show other possibilities started with the letter l.

[email protected]:~$ cd /var/l
lib/ lock/ log/

Now, if we want to change directory to lib, then we just need to key in i and press Tab for Linux automatic command completion kick in. However, if we want to change directory to log directory, we need to key in full letters.

[email protected]:~$ cd /var/log/
[email protected]:/var/log$

That's how Linux automatic command completion works. You don't need to practice using this, instead just use it all the times. This feature use by almost all Linux users. Why? Because it is so helpful. Remember, don't type unless it's necessary, use Tab for Linux automatic command completion. It's fast and it would make you looks like a Linux guru itself.

Back to Linux basic commands main page.

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.