D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

[LUG] bash tab completion for commands

 

This has passed me by so I thought I'd mention it here for others to
use - I'm finding it actually very useful:

http://www.debian-administration.org/articles/316

Most shells allow command completion, typically bound to the TAB key,
which allow you to complete the names of commands stored upon your
PATH, file names, or directory names. Some shells have started allowing
you to do even more: completing arguments to commands. Two notable
shells which allow this are zsh, and bash.

If you're not using it right now you can load it by typing into your
shell ". /etc/bash_completion" as shown here:

$ . /etc/bash_completion

[ you can put that line (with the . ) in ~/.bashrc ]

Once this is done you'll be able to TAB-complete many common arguments
to programs, for example:

$ apt-get upd[TAB]
$ apt-get upg[TAB]

Only certain commands have enabled bash_completion support so if you
want more commands supported, file some wishlist bugs.
;-)

--


Neil Williams
=============
http://www.data-freedom.org/
http://www.nosoftwarepatents.com/
http://www.linux.codehelp.co.uk/

Attachment: pgphMwhH1sgxU.pgp
Description: PGP signature

-- 
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/linux_adm/list-faq.html