Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I happily use both ssh and scp.

Quite often I am in an ssh session and I'd like to retrieve a file from my machine and put it in the directory I'm currently in without having to open a new terminal window and work out the scp command. So effectively i'd like to be able to do this:

remotemachine#scp homeconnection:thisfile.txt .

without opening an scp server on my machine. Is it possible to use the open ssh connection to do the copy?


share|improve this question

1 Answer 1

To recieve file

ssh user@remotehost.com cat > localfile "<" remotefile
ssh user@remotehost.com "cat remotefile" | cat > localfile

To send a file

ssh user@remotehost.com cat < localfile ">" remotefile
cat localfile | ssh user@remotehost.com "cat > remotefile"

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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