In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces how to use the scp command in Linux. It is very detailed and has a certain reference value. Friends who are interested must finish it!
The Linux scp command is used to copy files and directories between Linux. Here is a good introduction to how to use it. There are two ways to copy from local to remote and from remote to local. Here are some specific examples:
=
Linux scp command
=
Scp can copy files between 2 linux hosts
Basic format of the command:
Scp [optional parameters] file_source file_target
=
Copy from local to remote
=
* copy files:
* 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
The 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.
* example:
Scp / home/space/music/1.mp3 root@www.cumt.edu.cn:/home/root/others/music
Scp / home/space/music/1.mp3 root@www.cumt.edu.cn:/home/root/others/music/001.mp3
Scp / home/space/music/1.mp3 www.cumt.edu.cn:/home/root/others/music
Scp / home/space/music/1.mp3 www.cumt.edu.cn:/home/root/others/music/001.mp3
* copy the directory:
* Command format:
Scp-r local_folder remote_username@remote_ip:remote_folder
Or
Scp-r local_folder remote_ip:remote_folder
The first one specifies the user name, 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.
* example:
Scp-r / home/space/music/ root@www.cumt.edu.cn:/home/root/others/
Scp-r / home/space/music/ www.cumt.edu.cn:/home/root/others/
The above command copies the local music directory to the remote others directory, that is, there is a remote.. / others/music/ directory after replication.
=
Copy from remote to local
=
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
For example:
Scp root@www.cumt.edu.cn:/home/root/others/music / home/space/music/1.mp3
Scp-r www.cumt.edu.cn:/home/root/others/ / home/space/music/
The simplest applications are as follows:
Scp local user name @ IP address: file name 1 remote user name @ IP address: file name 2
[local user name @ IP address:] you don't have to enter, you may need to enter the password corresponding to the remote user name.
Several parameters that may be useful:
-v has the same meaning as-v in most linux commands and is used to show progress. Can be used to view connections, authentication, or configuration errors.
-C enable compression option.
-P Select the port. Note that-p has been used by rcp.
-4 forcibly use IPV4 address.
-6 forcibly use IPV6 address.
The use of the Linux scp command should be sufficient for copying Linux files and directories.
The above is all the contents of the article "how to use scp commands in Linux". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
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.