<>1. background

As a back-end development or operation and maintenance engineer , Server is a technology we must firmly grasp . In this section, we mainly explore ContOS7 The usage and example of remote copy file under .

Speaking of CentOS Copy in , What we use most often is cp Yes , The format is cp Source directory or file Target directory or file .

Examples , We will use the /home/test.txt copy to /tmp lower : cp /home/test.txt /tmp.

of course , This is not the protagonist we're going to talk about today , Our main character today is scp Remote copy command , This is quite convenient to copy between servers in a LAN .

<>2. Examples

grammar
scp [ Optional parameters ] [[user@]host1:]file1 [...] [[user@]host2:]file2 perhaps scp [ Optional parameters ]
file_source file_target
Examples

Copy files from local to remote server
scp local_file remote_username@remote_ip:remote_folder perhaps scp local_file
remote_username@remote_ip:remote_file perhaps scp local_file remote_ip:remote_folder
perhaps scp local_file remote_ip:remote_file
* The first 1,2 The user name is specified , After the command is executed, you need to enter the password again
* The first 3,4 There are no user names specified , The user name and password are required after the command is executed
* The first 1 Remote only directories specified , The file name remains unchanged
* The first 2 File name specified
* The first 3 Remote only directories specified , The file name remains unchanged
* The first 4 File name specified
example

Local 192.168.200.50 and 192.168.200.51 Two servers , I need to put 50 Server /home/test.txt File copy to 51 Of /tmp
Under the table of contents .
scp /home/test.txt root@192.168.200.51:/tmp/
192.168.200.50 The execution order is as follows

192.168.200.51 Execute the view command as follows

Technology
©2020 ioDraw All rights reserved
vue + element Secondary packaging is more flexible Select assembly react Background management configuration route and sidebar :python code , Easy to complete Snake games Advanced front end -Vue Component world html+css Realize loading animation Attack and defense world forgot—— A dazzling question ( Detailed dish chicken ) Voting mechanism of ensemble learning (Voting mechanism about ensemble learning) Three categories and six sorting algorithms -C From recruitment to resume to find a fresh university student in the company Madness theory java Study notes ---JAVA Basic grammar