Autocompletion

By default root doesn't have Bash Completion. A regular user do. To activate the Bash Completion you just run:

# source /etc/bash_completion
or
# . /etc/bash_completion

Bash Completion is a neat feature of today's Bash, a command prompt/command line/shell of GNU. If you type anything in that shell and then you press [TAB] button, it would show all the possible command corresponding to the characters typed.

E.g. in a terminal I write:

# ed[TAB]

it would output:

ed edit editcap editdiff editor editres edje_cc edje_decc edje_recc edje_viewer


It means I have those applications in the path.

The advance of Bash Completion can also provide any parameters available for most of the known program.

E.g. I would to know what is the parameter of apt-get:

# apt-get [TAB]
autoclean check dist-upgrade install source upgrade
build-dep clean dselect-upgrade remove update


Not only that, I can also know which application in apt-get for me to install/remove.

# apt-get install [TAB]
Display all 29006 possibilities? (y or n)

Of course, it would ask first if the alternatives are abundant. You don't want to see those 29006 alternatives to show don't you?

Have fun.

Comments

Popular Posts