Running Linux SCP and Rsync commands in background

I am using this alot these days to copy terabytes of data from one server to another which require running scp and rsync in background. This can be handy if you do not want to create password less connection between 2 machine which require setting up public/private keys.
It will send the SCP Rsync process in background once you have authenticated the session so that you don’t need to keep the terminal active while data is being moved.

Please follow these steps and i will be using SCP in the example

1) SSH into server
2) Execute the SCP command to transfer files on remote machine
For example to copy the folder named “data” i would be

scp -r data root@machine2.com:/home

It will ask you for root password of machine2.com, After authentication the process should start

3) Stop the process by using ctrl + z

4) Now run the bg command
root@localhost [~]# bg

bg will start the previous SCP process you killed in background

5) Confirm if the process is running by using jobs command
root@localhost [~]# jobs

If everything is ok kill the terminal with “exit” command and fetch a cup of cofee.

Post to Twitter Tweet This Post

  • Share/Bookmark

About the Author