Snippets tagged "bash ubuntu" Snippets tagged "bash ubuntu"

Turn on Bash Smart Completion

Just edit /etc/bash.bashrc

Uncomment the following lines, by removing the # in the beginning of the lines:

#if [ -f /etc/bash_completion ]; then
# . /etc/bash_completion
#fi

Now, resource the modified file :

$ source /etc/bash.bashrc

Then try to tape apt-cache [TAB][TAB]

You will have this result in replacement of the habitual list of files and directories of your current path :

$ apt-cache
add        dotty      dumpavail  pkgnames   rdepends   show       showsrc    unmet
depends    dump       gencaches  policy     search     showpkg    stats      xvcg

It works with a lot of functions like cd (it will provide only directories), apt-get,...

It also enable code completion when using the sudo command.

Isn't it useful ?

Nota : The tip I give here is to activate Smart Completion for all users. If you want to activate it for only one user (or if you want to activate it but doesn't have write rights to /etc/bash.bashrc) you can modify your ~/.bashrc file and uncomment the same lines as described upper and resource it with

$ source ~/.bashrc
by gameplayer on 2007-01-11, tagged bash  debian  linux  sysadmin  ubuntu 
(2 comments)