In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how to use the commonly used Linux command scp for you. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.
Linux common command scp command is used to copy files and directories between Linux, scp is the abbreviation of secure copy, scp is a secure remote file copy command based on ssh login in linux system.
Syntax scp [- 1246BCpqrv] [- c cipher] [- F ssh_config] [- I identity_file] [- l limit] [- o ssh_option] [- P port] [- S program] [[user@] host1:] file1 [...] [[user@] host2:] file2 is easy to write:
Scp [optional parameters] file_source file_target parameter description:
-1: force the scp command to use the protocol ssh2
-2: force the scp command to use the protocol ssh3
-4: forces the scp command to use only IPv4 addressing
-6: force the scp command to use only IPv6 addressing
-B: use batch mode (transfer passwords or phrases are not asked during transfer)
-C: compression is allowed. (pass the-C flag to ssh to turn on compression)
-p: retain the modification time, access time and access rights of the original file.
-Q: the transmission progress bar is not displayed.
-r: copy the entire directory recursively.
-v: display the output in detail. Scp and ssh (1) show debugging information for the entire process. This information is used to debug connections, verify, and configure problems.
-c cipher: encrypts the data transfer in cipher, this option will be passed directly to ssh.
-F ssh_config: specify an alternate ssh configuration file, which is passed directly to ssh.
-I identity_file: reads the key file used for transfer from the specified file, and this parameter is passed directly to ssh.
-l limit: limits the bandwidth that users can use, in Kbit/s.
-o ssh_option: if you are accustomed to using the parameter passing method in ssh_config (5)
-P port: note that it is capitalized P, and port is the port number used to specify the data transfer.
-S program: specifies the program to be used for encrypted transmission. This program must be able to understand the options of ssh (1).
Example 1. Copy from local to remote command format:
Scp local_file remote_username@remote_ip:remote_folder or scp local_file remote_username@remote_ip:remote_file or scp local_file remote_ip:remote_folder or scp local_file remote_ip:remote_file first and second specify the user name, and then enter the password after the command is executed. The first one only specifies the remote directory, the file name remains the same, and the second specifies the file name.
The third and fourth do not specify a user name, and you need to enter a user name and password after the command is executed, the third only specifies a remote directory, the file name remains the same, and the fourth specifies a file name.
Application example:
Scp / home/space/music/1.mp3 root@www.runoob.com:/home/root/others/music scp / home/space/music/1.mp3 root@www.runoob.com:/home/root/others/music/001.mp3 scp / home/space/music/1.mp3 www.runoob.com:/home/root/others/music scp / home/space/music/1.mp3 www.runoob.com:/home/root/others/music/001.mp3 copy directory command format:
Scp-r local_folder remote_username@remote_ip:remote_folder or scp-r local_folder remote_ip:remote_folder specifies the user name first, and the password is required after the command is executed.
The second one does not specify a user name. You need to enter a user name and password after the command is executed.
Application example:
The above command scp-r / home/space/music/ root@www.runoob.com:/home/root/others/ scp-r / home/space/music/ www.runoob.com:/home/root/others/ copies the local music directory to the remote others directory.
2. Copy from remote to local, as long as you change the order of the last two parameters of the command copied from local to remote, as shown in the following example
Application example:
Scp root@www.runoob.com:/home/root/others/music / home/space/music/1.mp3 scp-r www.runoob.com:/home/root/others/ / home/space/music/ description 1. If the remote server firewall has the specified port set for the scp command, we need to use the-P parameter to set the port number of the command, which is in the following format:
The # scp command uses the port number 4588 scp-P 4588 remote@www.runoob.com:/usr/local/sin.sh / home/administrator2. Use the scp command to ensure that the user you are using has permission to read the corresponding files on the remote server, otherwise the scp command will not work. At this point, the sharing of the common Linux command scp command is over. If you have any questions about the use of the scp command, you can submit your questions to us through the comments section.
This is the end of the article on "how to use scp in Linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.