Shell tab-completion and other helpful command-line tricks
derek at pointerstop.ca
Sat Jan 24 13:52:55 UTC 2009
Nils Kassube wrote:
> Paul Rumelhart wrote:
>> Command-line switches - if you forget which switches ("--something") a
>> particular command takes, you can type the command followed by a space
>> and "--" and then press the tab key twice to get a list of possible
>> choices (for example "ls --<tab><tab>" will show you all of the
>> switches that ls will accept.
> Did you try that? It doesn't work here. Or is there some special addon to
> bash needed to make it work?
bash completion is fairly arcane to me, but aiui it's up to the command's
packager to add some relevant file with the completions. Everybody should
have apt-get - so you can try "apt-get -<tab>". Unfortunately, apt-get's
completions are part of the default system, so the "apt" package doesn't
have a special file in it.
> If you don't know the switches, use
> the --help option. Many commands answer with a usage message.
>> There are lots of others I keep finding. Many commands that have a
>> choice of arguments work to some degree. For example, typing "alias
>> <tab><tab>" will show you which aliases you have currently defined.
Works for me (doesn't need two <tab>s).
The coolest discovery I ever made about bash completion was the fact that:
> scp filename somehost::<tab>
works! It's pretty slow for the host where I usually want to use it, but so
More information about the kubuntu-users