Command ($ or #) line; smart completion?

Peter Gordon admin at ramshacklestudios.com
Mon Nov 28 20:36:07 UTC 2005


Nat Gross:
> 1. Typing a partial command that exists in history, hit <F8>, and the
> command either gets completed (if unique string), or a little menu is
> presented.
I've read that you can achieve something similar to this by using the
PgUp/PgDn keys with GNU Bash, but I've not tried it all.

> 2. Any command that involves a file or directory (in the current dir)
> can have the file/dir name auto-entered also via
> 'partial-string+function key'.

Bash's programmable completion is your friend. :-)
You need to install the bash-completion package and make sure you
source /etc/profile.d/bash-completion in your startup scripts
(probably easiest to add it at the end of /etc/bashrc so that
all users gain this benefit). 

Then you can type the first few letters of a command and 
hit the tab key, and it will fill in the command name,
or as much as it can of it if two commands start with the
same sequence of characters. It also allows this type of 
completion for files/directories, as well as many of the
standard commands.

--Peter




More information about the users mailing list