Cool commandline completion in Ubuntu 10.04 with the default bash shell

I'm setting up my company's new servers (installing Ubuntu 12.04, the current LTS release) and since a lot of configuration/features have to be "mirrored" from our old servers, I've set up SSH public key authentication so I can simply copy stuff with scp (and without entering the password each time) from the old server(s) to the new one(s). And I just got amazed by this: entered the start of the command specifying the server like this:
scp oldserver.ourcompany.hu:/mnt/
then I hit (accidentally) tab ... and voala! The builtin (out-of-the-box) command completion listed all the contents of the /mnt directory on the other server! Brilliant. That's what I call user (or admin Smile ) experience.

P.S.: obviously this is nothing breakthrough-like ... but since I've never seen path completion from a remote server in default installations of any distribution, it just surprised me (in a good way Smile ).

P.S.2: it turns out this is fairly old stuff. Smile The feature (code) definitely already existed in 2005 as can be seen in this forum post. However bash completion only got into Ubuntu with Lucid (10.04 in 2010). It's part of the bash-completion package and the code for supporting remote path completion with scp was part of the package from day one. So I guess it's just me who didn't notice it til now. Smile I suppose it's because I rarely use public key authentication for SSH (including scp). I've changed the title of this post to reflect the actual Ubuntu version which first featured this scp completion capability.

P.S.3: Bash itself already had the completion support for quite some time, but the example completion code for supporting scp only made it into v4.0, which was released in February of 2009. So Ubuntu was not really late adopting it a year later. Smile

Syndicate content