Linux Command line Tab Completion (LL5D Public – FREE Linux Book!)

Linux Command line Tab Completion (LL5D Public – FREE Linux Book!)


In this short video I’m going to show
you how to save time avoid mistakes and increase your efficiency at the Linux
command line. Hello my name is Jason Cannon and I be
author of Linux for Beginners as well as the founder of the Linux Training
Academy. Today I’d like to share a couple of quick tips on how to get the most out
of tab completion. Any time you’re at the linux command
line you can simply press the tab key to invoke auto-completion, when you press
tab the commander typing as auto completed if possible. For example if I type D a and press the
tab key then the date command is displayed, if I want to execute that
command I simply press enter and then the date is displayed. You may have noticed that in addition to
auto completing the command a space was appended to the command, so that the
cursor is in such a position so that any arguments to the command can be quickly added. I’m going to do that again but this time i’m going to add an argument
to the command. So i’ll type d a tab now I’m in the position to add any arguments
to the command that I want. So i’m going to use a + % f which displays the date
in a nice format in order for tab completion to fully auto complete
command it needs to be given enough of the command to be unique. For example if I type D and press tab no commands are auto completed. You’ll
probably hear a beep or your terminal might flash if this happens you can
press tab again to show you you’re available options. So let me do that now hit tab again, now
I can see all the commands that I can run with start with D. I’m going to add
an M to my command and press tab again. This time the command is auto completed since it’s the only command that begins with DM. You’ll notice that there’s a
space after the command now and I can add any arguments if I want to. By the way this DM ESG or D message
command displays messages from the Linux kernel, i’ll execute now by hitting Enter. Let’s
say I want to type the command host name CTL one way to do that is to let tab
completion helped me along the way. For example I can type h/o tab which
expands to host and now I can add an in and press tab again. Now it’s expanded to host name I can
finish out the command by typing see pressing tab and then hitting enter, tab
completion not only works for commands it works for command arguments too. I’m
going to list the files in this directory by running LS. Here you can see
that there are three files if I want to display the contents of a file I can use
the cat command. So let’s look at file 1 dot txt going to
type CAT space f tab, now I can type 1 tab enter to complete the command. If I
wasn’t sure of my choices I can just hit tab twice so I can type CAT space f tab
that gets me most of the way there. And by pressing tab twice it shows the
remaining choices so I press tab tab that says I can type file one or file
two. text, so i’ll type two press tab for the completion and hit
enter. I’ll display the contents of the file
with a really long name by simply typing CAT space t pressing tab and hitting
Enter. If you found this quick tip helpful then
click the link on this video to download learn Linux in five days for free, it’s packed with dozens of Linux tips
designed to help you learn Linux the right way. It’s also a great refresher for
experienced Linux users to, again click the link on this video to download your
FREE copy today. Thanks!

2 thoughts on “Linux Command line Tab Completion (LL5D Public – FREE Linux Book!)

Leave a Reply

Your email address will not be published. Required fields are marked *