Have you ever wanted to have Tab to auto complete
any service and commands that comes with it ?
well i am going to show you how easy it is to do so .
all you need is to install a simple package that will do all the
hard work of typing for you .
the package name is bash-completion
once installed , you need to reload your profile and that’s it
just type service and tap will show you all services available
on your /etc/init.d . after you select the service you can hit tab once more
and it will display/complete the command associate with that service .
there is how ever another way of doing exactly that , by adding
words to bach tab completion . in this method all one needs to do is
run this command as root
~#complete -W "$(ls /etc/init.d/)" service
the advantage of the package bash-completion is that it gives you some more
options as completion . for example if you use the cd command ,
it would auto complete only the directories listed under the current location .
without bash-completion the cd command + tab may show you files as well and
the best trick is that bash-completion also auto complete any commands related
to any service listed under /etc/init.d
choose what ever is best for you