Архив рубрики: scp

scp in background

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
or
$ nohup scp -r root@pravolimp.ru:/sites/project /sites > 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

ps aux | grep scp
watch tail nohup.out

 

scp

scp -r root@62.76.188.182:/tmp/dump.zip. ./

http://rtfm.co.ua/scp-primery-ispolzovaniya/

Скопировать file с удаленного хоста perun.dcv на локальный хост:

$scp setevoy@perun.dcv:/home/setevoy/file ~
setevoy@perun.dcv’s password:
file           100% 7476     7.3KB/s   00:00
  

Наоборот — с локального хоста на удаленный perun.dcv:

$ scp file  setevoy@perun.dcv:/home/setevoy/
setevoy@perun.dcv’s password:
file           7476     7.3KB/s   00:00

Скопировать с локального хоста каталог one на удаленный хост perun.dcv:

$ scp -r one setevoy@perun.dcv:/home/setevoy

Скопировать файлы file, file1 и file2 с локального хоста на удаленный perun.dcv:

$ scp file file1 file2 setevoy@perun.dcv:~
setevoy@perun.dcv’s password:
file        100%    0     0.0KB/s   00:00
file1       100%    0     0.0KB/s   00:00
file2       100%    0     0.0KB/s   00:00

Скопировать с удаленного хоста perun.dcv файлы file, file1 и file2 на локальный хост в домашнюю директорию:

$ scp setevoy@perun.dcv:/home/setevoy/\{file,file1,file2\} ~
setevoy@perun.dcv’s password:
file         100%    0     0.0KB/s   00:00
file1        100%    0     0.0KB/s   00:00
file2        100%    0     0.0KB/s   00:00