scp as a background process
To execute any linux command in background we use nohup as follows:
$ nohup SOME_COMMAND &
But the problem with scp command is that it prompts for the password (if password authentication is used). So to make scp execute as a background process do this:
$ nohup scp file_to_copy user@server:/path/to/copy/the/file > nohup.out 2>&1
Then press ctrl + z which will temporarily suspend the command, then enter the command:
$ bg
This will start executing the command in backgroud
Advertisement
12 Responses to “scp as a background process”
Trackbacks / Pingbacks
- - December 31, 2010
- - January 30, 2012




Hi man,
I’d like to thank you for your greate help regarding scp with password authentication vs. background copying!!
Viktor
At what point do we enter the password? Thanks for the help.
@c: After you enter the command it should ask you for password.
For eg:
$ nohup scp file_to_copy user@server:/path/to/copy/the/file > nohup.out 2>&1
After this command it should prompt you for password.
very good !!!!!!
I offer you a beer, man. !!! Great. !!!
Exactly what I was looking for. Thanks.
Thanx, that was a great help
sachin
thnx
Super!! Just the info I needed. Thanks for Sharing!
If you have more that one job running you can run jobs to see the status
$ jobs
$ %job_number_1
$ %job_number_2
$ %job_number_3
$ %job_number_4
You can run bg %job_number or fg %job_number to swap jobs to the background or foreground
$ bg %job_number