scp is a beautifully simple tool for remote file transfers. My one annoyance with it was that tab completion didn't work. How could it? The connection isn't made until after the complete command is given.
Quite by accident today I noticed scp
tab completion just worked
on Debian box. What happened was that Debian has a couple different defaults that
came together to provide me a great user experience.
First, by default X window sessions are run through ssh-agent
.
This helps with password-less ssh
and scp
connections.
Earler I had simply typed ssh-add
to enable passwordless secure connections
with servers I share keys with.
Next, Debian seems to have installed the highly useful bash completion package by default. This package was working with my passwordless ssh setup to provide the seamless tab-completion. Both the hostname and the remote path names on the remote server were able to complete.
I highly recommend trying out the bash completion package. Here's a partial list
of programs bash completion
has custom completion for:
bash alias bash export bash shell function bash complete chown(1) chgrp(1) umount(8) mount(8) Linux rmmod(8) Linux insmod(8), modprobe(8) and modinfo(8) man(1) renice(8) kill(1) Linux and FreeBSD killall(1) GNU find(1) Linux ifconfig(8) Linux iwconfig(8) RedHat & Debian GNU/Linux if{up,down} Linux ipsec(8) Postfix cvs(1) helper functions for rpm rpm(8) Debian apt-get(8) Debian apt-cache(8) Debian aptitude(1) Debian apt-build(1) chsh(1) chkconfig(8) ssh(1) scp(1) rsync(1) Linux route(8) GNU make(1) GNU tar(1) wvdial(1) gpg(1) iconv(1) dict(1) cdrecord(1) mkisofs(8) mc(1) yum(8) yum-arch(8) ImageMagick dd(1) Linux iptables(8) tcpdump(8) autorpm(8) ant(1) mysqladmin(1) gzip(1) bzip2(1) openssl(1) screen(1) lftp(1) bookmark ncftp(1) bookmark gdb(1) Postgresql psql(1) createdb(1) dropdb(1) gcc(1) Linux cardctl(8) Debian dpkg(8) Debian GNU dpkg-reconfigure(8) Debian Linux dselect(8) Java java javadoc javac PINE address-book mutt Debian reportbug(1) Debian querybts(1) update-alternatives Python Perl rcs(1) lilo(8) links FreeBSD package management tool FreeBSD portupgrade FreeBSD portinstall Slackware Linux removepkg look(1) ypcat(1) and ypmatch(1) mplayer(1)
lsdkflskdlsdlfkl2lsldfklskl12l32.tmp
..mp3
files and therefore you cannot use it on the above temporary file. So you have type the filename manually or use copy-and-paste. There are similar examples and so I eventually got rid of it again.
Re:bash completion
markjugg on 2004-04-05T14:47:16
Since it's just a shell script, it seems like you could trim out the application completion with annoying behavior, and enjoy the the rest. Of course, if you end up sending more time fiddling with it than benefiting from it, I see your point.:)