Reply
Thread Tools
Posts: 32 | Thanked: 30 times | Joined on Jul 2012 @ Deb & Ian's dooryard
#1
I really like the Tab completion feature, particular for apt-get, and have it enabled on all my linux installations. After some googling it turns out, activation in Maemo is just as easy as on all debian derivatives.

First we need to install the Bash package with 'sudo apt-get install bash'. The Bash package comes with a smart tab completion for apt-get. However, it is not turned on by default. To turn it on globally we have to uncomment the relevant lines by editing the /etc/bash.bashrc file.


Change the following lines

Code:
# enable bash completion in interactive shells
#if [ -f /etc/bash_completion ]; then
#    . /etc/bash_completion
#fi
to

Code:
# enable bash completion in interactive shells
if [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
fi
and save the file.


Execute 'bash' to get a bash shell:

Code:
~ $  # sudo gainroot
Root shell enabled


BusyBox v1.10.2 (Debian 3:1.10.2.legal-1osso30+0m5) built-in shell (ash)
Enter 'help' for a list of built-in commands.

/home/user # bash
root@Nokia-N900:~# █


Now for example, if we type 'apt-get [TAB]' we'll see a list of available commands:

Code:
root@Nokia-N900:~# apt-get 
autoclean        clean            install          update
build-dep        dist-upgrade     remove           upgrade
check            dselect-upgrade  source           
root@Nokia-N900:~# apt-get █

This could be helpful sometimes, the amazing part comes here:
If we type 'apt-get remove x[TAB]' a complete list of installed packages starting with the letter x shows up. When installing, we'll get a list of all available but not installed packages starting with x. And it also works in the same way with 'apt-cache'.


Code:
Nokia-N900:~# apt-get remove x
x11-common                xml2wbxml                 xserver-xorg-input-evdev
x11-xkb-utils             xserver-xomap             xserver-xorg-video-fbdev
xkb-data                  xserver-xorg-core         xsltproc
Nokia-N900:~# apt-get remove x█

Code:
root@Nokia-N900:~# apt-get install ssh
ssh          ssh-askpass  sshfs        ssh-nonfree  ssh-socks    
ssh2         ssh-client   ssh-krb5     ssh-server   ssh-status   
root@Nokia-N900:~# apt-get install ssh█


more Examples:

# apt-g[TAB] i[TAB] cssu[TAB]
# apt-c[TAB] po[TAB] kernel-p[TAB][TAB]


After some time you'll wonder how you ever did without it.

Last edited by conred; 2012-08-05 at 20:23.
 

The Following 7 Users Say Thank You to conred For This Useful Post:
Posts: 2,102 | Thanked: 1,937 times | Joined on Sep 2008 @ Berlin, Germany
#2
YOU are a GENIUS!!!
I spent literally hours to try to get bash-completion package from debian installed going to dependency hell through three debian releases, finally giving in frustrated.
 

The Following 2 Users Say Thank You to michaaa62 For This Useful Post:
Posts: 1,100 | Thanked: 2,797 times | Joined on Apr 2011 @ Netherlands
#3
Additional info: this will not work using bash4
 

The Following 4 Users Say Thank You to ade For This Useful Post:
Reply


 
Forum Jump


All times are GMT. The time now is 21:06.