当前位置:网站首页>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
边栏推荐
- Unity3D 实用技巧 - 理论知识库(一)
- Opencv + clion face recognition + face model training
- Simply drag objects to the item bar
- getprop 属性
- Mac 进入mysql终端命令
- JS engine loop mechanism: synchronous, asynchronous, event loop
- Record the ThreadPoolExecutor main thread waiting for sub threads
- Implementation of switching windows and capturing data in selenium mode
- Agile practice | agile indicators to improve group predictability
- Knowledge points sorting: ES6
猜你喜欢
Windows remote connection to redis
解决ValueError: Argument must be a dense tensor: 0 - got shape [198602], but wanted [198602, 16].
redis数据类型有哪些
独立站运营 | FaceBook营销神器——聊天机器人ManyChat
Teach you how to build the ruoyi system by Tencent cloud
MySQL - index
DIY is an excel version of subnet calculator
PIP3 installation requests Library - the most complete pit sorting
多线程基本概念(并发与并行、线程与进程)和入门案例
Learning Android from scratch -- Introduction
随机推荐
scp命令详解
What's the difference between error and exception
Leetcode 1547: minimum cost of cutting sticks
PHP+MySQL 制作留言板
Set Chrome browser background to eye protection (eye escort / darkreader plug-in)
2022/4/22
Sword finger offer: push in and pop-up sequence of stack
Installation and deployment of Flink and wordcount test
The programmer starts the required application with one click of window bat
机器学习---线性回归
Sword finger offer: the path with a certain value in the binary tree (backtracking)
La caméra Unity tourne avec la souris
[database] MySQL single table query
Alibaba tip: it is better to create threads manually
How can continuous integration (CI) / continuous delivery (CD) revolutionize automated testing
Unity摄像头跟随鼠标旋转
深度学习笔记 —— 数据增广
Unity RawImage背景无缝连接移动
Graduation project
Customize the navigation bar at the top of wechat applet (adaptive wechat capsule button, flex layout)