Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

My professor wants us to email him source files, but he wants us to edit over ssh using vi. How do I transfer a file over ssh from one machine to another?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

To transfer a file over ssh you should use the scp command.

Basic usage is :

[you@localhost ~]$ scp examplefile yourusername@remoteserver:/home/yourusername/

It will copy over SSH the file examplefile to the remote server at the location /home/yourusername/examplefile

More concrete example :

[Moshe@localhost ~/mywork]$ scp Moshe@

Where it is assumed your local file is /home/Moshe/mywork/ and you have permission to login to the server and to write in the remote directory /home/Moshe

You will end with the file copied under /home/Moshe/ on the remote server.

If you are not working under Linux or any Unix-based system locally (ie. you're on Windows typically), a tool like WinSCP will enable you to transfer the file over SSH with help of a graphical interface.

share|improve this answer
@Zertin - I have a .tar.gz file on one remote server. Can I unzip and untar the file in one go and copy the file from one server to another? – MontyPython Jun 24 at 18:50

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.