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
Pingback: Buzz Lightyear is here » Blog Archive » links for 2010-12-30
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!
Pingback: scp as a background process | Gimli's Nipple
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
another variant is the use of the ‘screen’ command:
$ screen scp file_to_copy user@server:/path/to/copy/the/file
after that screen opens a new terminal, with a new shell & the command excecuted. now you should press:
ctrl + a
and after that you can press
d
to detatch the screen session. the session will resists in the background and you can logout. the main advantage of this kind of backgrounding is, that you can reconnect to the session anytime with a:
$ screen -r
hope this helps someone
another variant is the use of the ‘screen’ command:
$ screen scp file_to_copy user@server:/path/to/copy/the/file
after that screen opens a new terminal, with a new shell & the command excecuted. now you should press:
ctrl + a
and after that you should press
d
to detatch the screen session. the session will resists in the background and you can logout. the main advantage of this kind of backgrounding is, that you can reconnect to the session anytime with:
$ screen -r
hope this helps someone
Thanks buddy !
Thanks a log buddy…..woopy it worked….:)
Thanks! You save my life! LOL
Awesome!! … Helped me rather saved me…
Thanks for the great guide, you just saved me some boring times
Simple is great.
Thanks you !
Thanks for the tip.. simply awesome
Quit easy and best option… .,,,
Thanks..was very helpful