Transferring Files from Remote Server to Remote Server Using SCP

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 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 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:

To make the process continued in background type command:

SCP will give output:

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

SCP will give output:

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

11 thoughts on “Transferring Files from Remote Server to Remote Server Using SCP”

  1. 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. 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. 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. 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?

  5. Morfy, you can always tar the file and pipe it through ssh to get symlinks intact:

    cd /source/dir ; tar cf – . | ssh user@host ‘(cd /target/dir ; tar xf -)

Leave a Reply

Your email address will not be published. Required fields are marked *