This question already has an answer here:

It often happens that I'm SSH'd into another machine and I'd like to download a file onto my local machine without having to open a new terminal and scp. For example, something like this:

local $ ssh remote
remote $ ls
remote $ download remote_file
remote $ ^D
local $ ls

Is there any way — even a terrible hack — to let me download a file while I'm SSH'd into the remote host, without using SCP?

I'd considered playing some tricks with, ex, $SSH_CLIENT, but that won't work when my local machine is behind a NAT (which is basically all the time).

marked as duplicate by Gilles, jasonwryan, Patrick, slm, Warren Young Dec 15 '13 at 1:28

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


Instead of connecting to the remote machine using ssh use sftp. You will have a ftp client connect to the remote machine using the ssh protocol. When you'll be connect you'll be able to browse the remote machine using cd and ls. To copy the file in your local machine you'll use the get remote.file and the file will be copy to your local machine.

SFTP informations

Not the answer you're looking for? Browse other questions tagged or ask your own question.