Given host A / user a and host B / user b, and ssh from A to B: a@A$ ssh b@B
. Suppose that in B there is a file called hello.txt
. As we know, if I log into B and look for this file, I can use tab to autocomplete the file name:
a@A$ ssh b@B
b@B$ ls h
hello.txt
where at the end of the second line I typed 'tab'.
Now suppose that I am logged into A and I want to copy with scp hello.txt
from B to A, but I do not remember the full file name, I only remember that the file starts with 'h'. I would like to do
a@A$ scp b@B:h
then press 'tab', and see the list of files in B that start with 'h', just like in the example above. Is this possible?
Edit:
Here is how I tried to do this by following pLumo's suggested answer:
$ ssh b@B
Last login: xxx
b@B:~$ ls
my_file.dat
b@B:~$ exit
logout
Shared connection to B closed.
$ cat ~/.ssh/config
Host B
Hostname B.xxxx.xx
User b
ControlMaster auto
ControlPath ~/.ssh/control:%h:%p:%r
$ scp b@B:my_file.dat .
my_file.dat 100% 4 0.0KB/s 00:00
$ssh -fN b@B
$ scp b@B:my_
where at the end of the last line I pressed TAB, but nothing happens.