Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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 thework.zip Moshe@192.168.1.21:/home/Moshe/

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

You will end with the file copied under /home/Moshe/thework.zip 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 '15 at 18:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .