| Subcribe via RSS

Transferring Files from Remote Server to Remote Server Using SCP

June 25th, 2007 Posted in RevTI, System Administration


If you have more than one server and want to transfer files between the two, you can use SCP (Secure Copy). Here is how to do it:

$ scp /folder/file-to-tranfer username@remote.host.net:/folder/file-destination-name

SCP then will ask the password for username on the remote host that already specified, insert the username and press enter. Wait until the transfer finished and your file will be copied to the destination server.

Now, if you transfer a big file, let’s say 20 GB file. You can set SCP to run in background so you don’t need to wait in front of your computer until the transfer finished. Here is how to run SCP in background:

$ scp /folder/file-to-tranfer username@remote.host.net:/folder/file-destination-name > /dev/null 2>&1

SCP then will ask for remote server username’s password, fill in the password and press enter.

Now to suspend the process press: ctrl + z

SCP will give output:

[1]+  Stopped        scp /folder/file-to-tranfer username@remote.host.net:/folder/file-destination-name > /dev/null 2>&1

To make the process continued in background type command:

$ bg

SCP will give output:

[1]+ scp /folder/file-to-tranfer username@remote.host.net:/folder/file-destination-name > /dev/null 2>&1 &

To see what background process that is running you can type command:

$ jobs

SCP will give output:

[1]+  Running        scp /folder/file-to-tranfer username@remote.host.net:/folder/file-destination-name > /dev/null 2>&1 &

To bring the process back to foreground you can use ‘fg’ command.

From network management software to antivirus firewall software, such deals should be bought from the genuine retailers. Where norton antivirus and other chat software can be downloaded from freeware sites, it will never get through the zone alarm. This is just the reason why we advise to buy wireless speakers from a reliable outlet.

Most Commented Posts

7 Responses to “Transferring Files from Remote Server to Remote Server Using SCP”

  1. Willy Sudiarto Raharjo Says:

    You forgot to mention fg to make it running on foreground.

    One thing i missed on scp is hash mark which will tell the progress of the overall process. Adding -v only adds verbose information about the files being added, but not the percentage


  2. Markus Says:

    thanks for the additional info.

    i tried that command above and it shows progress percentage, the transfer rate and remaining time to accomplish the transfer. i think that is enough info for knowing the progress.


  3. Daniel Says:

    hi, I tried to use scp for copying file which size is 4.2 GB. it was stopped at 4G error: file size exceeded. is that any difference when you transfer it in background? fyi, both of my server using fedora core 4.

    many thanks,

    &


  4. Markus Says:

    i never get that error message, are you sure that you have enough disk space on the remote server?


  5. BUGabundo Says:

    also u can use scp -q
    so it wont out put anything


  6. Morfy Says:

    When using -r (recursive) you can get for instance an entire folder with subcontent - BUT symbolic links are not transfered ; you get the file instead. IS there a way to avoid this?


  7. Johnny5 Says:

    Daniel, are you transferring the file to a fat32 filesystem?

    Morfy: nope sorry :)


Leave a Reply

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word