Effective usage of TAB button in Bash shell
The Bash shell supports good number of intuitive ways of using TAB button on your keyboard to do command or file/directory name completions. Here is the list of TAB key usage combinations bash supports.
Get lists all available commands (<TAB><TAB>)
[neo@techpulp ~]#<TAB><TAB> Display all 4136 possibilities? (y or n) : ircat pnmstitch ! irdadump pnmtile ./ irdaping pnmtoddif [neo@techpulp ~]#
Get all available commands starting with STRING (STRING<TAB><TAB>)
[neo@techpulp ~]# z<TAB><TAB> zcat zdump zfgrep zip zipnote znew zcav zegrep zforce zipcloak zipsplit zonetab2pot.py zcmp zeisstopnm zgrep zipgrep zless zsh zdiff zenity zic zipinfo zmore zsoelim [neo@techpulp ~]# z
Get entire directory structure including hidden one (/<TAB><TAB>)
[neo@techpulp ~]# /<TAB><TAB>
audio/ dev/ lost+found/ opt/ selinux/ usr/
bin/ etc/ media/ mydata/ srv/ var/
boot/ home/ misc/ proc/ sys/ video/
drive_c/ server/ mnt/ root/ tmp/ drive_d/
audio/ lib/ net/ sbin/
[neo@techpulp ~]# /usr/<TAB><TAB>
bin/ games/ kerberos/ libexec/ sbin/ src/
etc/ include/ lib/ local/ share/ tmp/
[neo@techpulp ~]# /usr/
Get all local subdirectories without hidden ones (*<TAB><TAB>)
[neo@techpulp ~]# *<TAB><TAB> Desktop/ examples/ source/ build/ music/ test/ demo/ [neo@techpulp ~]#
Get all users from “/etc/passwd” file (~<TAB><TAB>)
[neo@techpulp ~]# ~<TAB><TAB> ~adm ~ftp/ ~lp/ ~ntp/ ~rpm/ ~tomcat/ ~apache/ ~games/ ~mail/ ~openvpn/ ~shutdown/ ~torrent/ ~avahi/ ~gdm/ ~mailnull/ ~operator/ ~smmsp/ ~uucp ~backuppc/ ~gopher ~robert/ ~polkituser/ ~davem/ ~vcsa/ ~bin/ ~haldaemon/ ~news ~pulse/ ~squid/ ~vdr/ ~daemon/ ~halt/ ~nfsnobody/ ~root/ ~sshd/ ~vdradmin/ ~dbus/ ~hsqldb/ ~nobody/ ~rpc/ ~sync/ ~webalizer/ ~distcache/ ~jetty/ ~nscd/ ~rpcuser/ ~tcpdump/ [neo@techpulp ~]# ~
Get all system variables ($<TAB><TAB>)
[neo@techpulp ~]# $<TAB><TAB> $_ $KONSOLE_DCOP_SESSION $BASH $LANG $BASH_ARGC $LESSOPEN $BASH_ARGV $LINENO $BASH_COMMAND $LINES $BASH_LINENO $LOGNAME $BASH_SOURCE $LS_COLORS $BASH_SUBSHELL $MACHTYPE $BASH_VERSINFO $MAIL $BASH_VERSION $MAILCHECK $COLORS $OPTERR $COLORTERM $OPTIND $COLUMNS $OSTYPE $COMP_WORDBREAKS $PATH $consoletype $PIPESTATUS $CVS_RSH $PPID $DBUS_SESSION_BUS_ADDRESS $PROMPT_COMMAND $DESKTOP_SESSION $PS1 $DIRSTACK $PS2 $DISPLAY $PS4 $EUID $PWD $G_BROKEN_FILENAMES $QTDIR $GDM_LANG $QT_IM_MODULE . . . . [neo@techpulp ~]# $
Get all host names from “/etc/hosts” file (@<TAB><TAB>)
[neo@techpulp ~]# mail neo@<TAB><TAB> @::1 @localhost @localhost6 @localhost6.localdomain6 @localhost.localdomain [neo@techpulp ~]# mail neo@
Get output like “ls” command (=<TAB><TAB>)
[neo@techpulp /]# =<TAB><TAB> .bash_history examples/ .bash_logout me.png .bash_profile msg.txt .bashrc source/ [neo@techpulp /]# =
Happy bashing!

