sumek
sumek

Reputation: 28212

Download files to local drive when sshed

What is the best way to download files to local hard drive when logged in to another computer using ssh in bash. I'm aware of sftp, but it is not convienent, e.g. it lacks tab completion of directory names. I'm using Ubuntu 8.04.1 . I don't have a public IP and would not like to setup dynamic Dynamic DNS solution.

Upvotes: 4

Views: 5569

Answers (6)

Derick Schoonbee
Derick Schoonbee

Reputation: 3021

How about FISH? ***Fi***le transfer over ***Sh***ell - You can use Midnight Commander in your console:

$ sudo apt-get install mc
$ mc

Then hit F9; Right (for the Right panel) -> Shell link Type in the ssh link of the remote host. At the prompt enter machine name specify:

user@host

The system will prompt for the password (or auto login if your SSH keys are setup for that)

Now you can browse the remote filesystem, select and copy over (F5) as you wish.

Upvotes: 1

ephemient
ephemient

Reputation: 204966

ssh-xfer is what you are looking for. Once you have it set up, you can type (from within the ssh session on the remote machine):

$ ssh-xfer foo.txt

and foo.txt will magically show up on your local machine.

Upvotes: 0

Sam Stokes
Sam Stokes

Reputation: 14817

I'm also running Ubuntu 8.04.1, and if I type

$ scp [email protected]:.bashr<TAB>

I do indeed get tab completion (i.e. bash is sshing to my server and getting completion results from the filesystem there). Then

$ scp [email protected]:.bashrc .

copies my .bashrc from my server to the current directory on my local machine.

If you don't get this, try sudo apt-get install bash-completion, and check that your .bashrc contains the following lines (mine did by default):

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
fi

Upvotes: 6

hangy
hangy

Reputation: 10859

I actually like to use the command line SCP client. :) I do not know how it does this, but my SCP on Ubuntu (from openssh-client 1:4.7p1-8ubuntu1.2) actually does tab-completion of remote directories and files on hosts where I usually auth via public key.

Upvotes: 0

Horst Gutmann
Horst Gutmann

Reputation: 11318

As far as I know there is no simply scp-on-steroids that lets you autocomplete on remote folder-structures. If you just want to basically mount a remote folder, take a look at sshfs. Or just try mounting a remote directory with ssh://... within Nautilus.

Upvotes: 0

Ronny Brendel
Ronny Brendel

Reputation: 4845

I don't know.

I'd $ scp host:file locallocation

Upvotes: 0

Related Questions