Some times you need to copy files or entire contents of directory to another machine, you can use scp command. scp command uses SSH data transfers, so it requires a password or passphrase for authentication.
The syntax for scp command
scp [option] [user1@server1]:[source] [user2@server2]:[destination]
For example
If user user1 on a computer called server1 and wants to copy a file called mydata.txt to a directory called backup in his account on a computer called server2, he would enter:
[user1@server1]$ scp mydata.txt user1@server2:/backup mydata.txt 100% 11 0.0KB/s 00:00
If he wanted to copy entire contents of directory called backup on server2 back to server 1, he would enter:
[user1@server1]$ scp -r user1@server2:/backup /backup mydata.txt 100% 11 0.0KB/s 00:00 mydata1.txt 100% 11 0.0KB/s 00:00
scp command with SSH certificate
If you wanted to remote file copy without password authentication for automate your tasks or automate backup, you can uses SSH certificate. For above example, type the following command:
scp -r -i /path_to_private_key user1@server2:/backup /backup
For more information about scp command
At the prompt enter:
man scp
{ 1 comment… read it below or add one }
Generally I don’t learn post on blogs, but I wish to say that this write-up very forced me to check out and do so! Your writing taste has been amazed me. Thank you, quite great post.