当前位置:网站首页>SCP command details
SCP command details
2022-04-23 04:56:00 【Huang Jiajun】
In common cases, say first :
Two machines IP Respectively :A.104.238.161.75,B.43.224.34.73.
stay A Operation on the server , take B Server /home/lk/ All files in the directory are copied to the local /root Under the table of contents , The order is :scp -r [email protected]:/home/lk /root.
stay A On the server /root/lk All the files in the directory are transferred to B Of /home/lk/cpfile Under the table of contents , The order is :scp -r /root/lk [email protected]:/home/lk/cpfile.
scp When copying across machines, in order to improve the security of data , Used ssh Connection and encryption , If the machine is configured with ssh Password free login , That's in use scp You don't have to enter a password when you're in .
Detailed command :
scp yes secure copy Abbreviation , Used in Linux Under the command to copy files remotely , Similar orders are cp, however cp It's just that copying on the local machine can't cross servers , and scp The transmission is encrypted . It may affect the speed a little . When your server hard disk becomes read-only read only system when , use scp I can help you move the files out . in addition ,scp It doesn't take up resources , It will not increase the system load much , At this point ,rsync It's far less than that . although rsync Than scp It will be faster , But when there are lots of small files ,rsync It will cause the hard disk I/O Very high , and scp Basically does not affect the normal use of the system .
1. Command format :
scp [ Parameters ] [ The original path ] [ The target path ]
2. Command function :
scp yes secure copy Abbreviation , scp yes linux Based on ssh Log in for secure remote file copy command .linux Of scp Commands can be found in the linux Copy files and directories between servers .
3. Command parameter :
-1 mandatory scp Command usage protocol ssh1
-2 mandatory scp Command usage protocol ssh2
-4 mandatory scp The command only uses IPv4 Addressing
-6 mandatory scp The command only uses IPv6 Addressing
-B Use batch mode ( Do not ask for transmission password or phrase during transmission )
-C Allow compression .( take -C The sign is passed on to ssh, To turn on compression )
-p Keep the modification time of the original document , Access time and access rights .
-q Do not show transfer progress bar .
-r Recursively copy the entire directory .
-v Detailed display output .scp and ssh(1) The debugging information of the whole process will be displayed . This information is used to debug connections , Validation and configuration issues .
-c cipher With cipher Encrypt the data transmission , This option will be passed directly to ssh.
-F ssh_config Designate an alternative ssh The configuration file , This parameter is passed directly to ssh.
-i identity_file The key file used to read the transfer from the specified file , This parameter is passed directly to ssh.
-l limit Limit the bandwidth that users can use , With Kbit/s In units of .
-o ssh_option If you are used to using ssh_config(5) Parameter passing method in ,
-P port Notice that it's capital P, port Is the port number used for data transmission
-S program Specify the program to use when encrypting the transmission . This procedure must be able to understand ssh(1) The option to .
4. Using examples :
scp Overview of practical application of command :
Copy from local server to remote server :
(1) Copy file :
Command format :
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 User name specified , After the command is executed, you need to enter the user password , The first 1 Only remote directories are specified , The file name does not change , The first 2 Specified file name
The first 3,4 No user name specified , After the command is executed, you need to enter the user name and password , The first 3 Only remote directories are specified , The file name does not change , The first 4 Specified file name
(2) duplicate catalog :
Command format :
scp -r local_folder remote_username@remote_ip:remote_folder
perhaps
scp -r local_folder remote_ip:remote_folder
The first 1 User name specified , After the command is executed, you need to enter the user password ;
The first 2 No user name specified , After the command is executed, you need to enter the user name and password ;
版权声明
本文为[Huang Jiajun]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230454290430.html
边栏推荐
- Implementation of switching windows and capturing data in selenium mode
- 2022/4/22
- Informatics Aosai yibentong 1212: letters | openjudge 2.5 156: Letters
- Innovation training (10)
- Making message board with PHP + MySQL
- Innovation training (VI) routing
- Learning Android from scratch -- Introduction
- 敏捷实践 | 提高小组可预测性的敏捷指标
- Unity3D 实用技巧 - 理论知识库(一)
- Perfect test of coil in wireless charging system with LCR meter
猜你喜欢
Spark FAQ sorting - must see before interview
redis数据类型有哪些
MySQL - index
[2022 ICLR] Pyraformer: Low-Complexity Pyramidal Attention for Long-Range 时空序列建模和预测
【数据库】MySQL多表查询(一)
多线程基本概念(并发与并行、线程与进程)和入门案例
[WinUI3]編寫一個仿Explorer文件管理器
独立站运营 | FaceBook营销神器——聊天机器人ManyChat
[database] MySQL single table query
《2021多多阅读报告》发布,95后、00后图书消费潜力攀升
随机推荐
Innovation training (10)
AQS源码阅读
[database] MySQL single table query
DIY 一个 Excel 版的子网计算器
Gets all dates between two times
C# List字段排序含有数字和字符
Learning Android V from scratch - UI
Custom switch control
The last day of 2021 is the year of harvest.
JS determines whether the numeric string contains characters
Excel protects worksheets and workbooks from damage
QPushbutton 槽函数被多次触发
Alibaba tip: it is better to create threads manually
Druid -- JDBC tool class case
Unity rawimage background seamlessly connected mobile
Installation and deployment of Flink and wordcount test
Painless upgrade of pixel series
The 8 diagrams let you see the execution sequence of async / await and promise step by step
redis数据类型有哪些
What is a blocking queue? What is the implementation principle of blocking queue? How to use blocking queue to implement producer consumer model?