Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
A person learns new things all the time. I was scp'ing a file to another machine, and happened to hit tab by habit while entering the pathname on the other machine, and lo and behold, it completed it. The path does not exist on the local machine. I found some reference to it in a post here but I had never heard of this. Does bash save the paths from machines? If so where (it was not in the history file). ...surely it does not make a connection to the other machine just for path completion. Just quite intrigued, any info is welcome.
I wouldn't have thought so, either... give's the example of
what it expanded? I had cases that an expansion gave me
a "path" on the remote machine when part of it matched ...
E.g. I was in ~, have a directory downloads ...
scp test.tar.gz tink@machine:/home/do<TAB> and it completed
the "wnloads" for me ... of course, the "full" path didn't exist on
the remote machine ...
It does make an ssh connection. I suspect it only works with the use of passwordless publickeys.
Here is a real example (except for hostname):
I have a /tmp/mp3 directory on both the host and the client, but they have totally different file structures. I know I have not accessed these on the host, but when I do the following scp /etc/hosts myhomecomputer.net:/tmp/add
Then hit tab (a few times, response is not immediate like on the local machine), I get the following:
I have a /tmp/save, a /tmp/sage, but no /tmp/save2 on the local computer.
Proof is in the log files. I use public keys, so everytime I get a little more information with the tab key (viewed with tail -f /var/log/messages in another terminal window), I get a line in the host /var/log/messages file (again computer name, login name, and IP obscured):
Feb 26 23:37:22 myhomecomputer sshd[9984]: Accepted publickey for fsbooks from ::ffff:000.000.00.0 port 52307 ssh2
Feb 26 23:37:33 myhomecomputer sshd[9992]: Accepted publickey for fsbooks from ::ffff:000.000.00.0 port 52325 ssh2
How odd ... I can't replicate that behaviour, even though
I have passwordless ssh connections to two machines
set-up here ... bash-completion is on a pretty high level,
too, but only the original version of gnu.org ... maybe the
distro you're using has hacked that thing?
The package bash-completion-20040711-noarch-1 (which is installed on this slackware-current box) adds this capability. I came across the file /etc/bash_completion accidentally.
Quote:
# swaret --show bash-completion-20040711-noarch-1
Description for bash-completion-20040711-noarch-1:
----------------------------------------------------------------------
Adds programmable completion to the bash shell. A new file called
/etc/bash_completion will be sourced for interactive bash shells
adding all sorts of enhanced command completion features. Once
installed, you may get a list of all commands that have associated
completions with 'complete -p', and examine the code for the shell
functions with 'declare -f'.
bash-completion was written by Ian Macdonald <ian@caliban.org>.
----------------------------------------------------------------------
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.