In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article is about how to use SSH remote file/directory transfer command scp in Linux. Xiaobian thinks it is quite practical, so share it with everyone for reference. Let's follow Xiaobian and have a look.
What is SCP?
scp is the abbreviation of secure copy, used to copy files remotely under Linux, and it is similar to cp command, but cp only copy in the local machine can not cross the server, and scp transmission is encrypted. It might affect the speed a little bit.
What is SCP for?
1, we need to get a file on the remote server, the remote server is not configured ftp server, no open web server, nor do sharing, can not get the file through the conventional way, only need to pass the scp command can easily achieve the goal.
2, we need to upload files on the local machine to the remote server, the remote server does not open the ftp server or share, can not upload through the conventional way Yes, only need to pass the scp command can easily achieve the goal.
3. SCP usage method
1. Get files on remote server
The code is as follows:
scp -P 2222 root@www.yisu.com:/root/lnmp0.4.tar.gz /home/lnmp0.4.tar.gz
The upper port capital P is a parameter, 2222 indicates the port after changing the SSH port. If the SSH port is not changed, this parameter can be omitted. root@www.yisu.com means log in to the remote server www.yisu.com as root,:/root/lnmp0.4.tar.gz means files on the remote server, and the last/home/lnmp0.4.tar.gz means paths and file names saved locally.
2. Get directory on remote server
The code is as follows:
scp -P 2222 -r root@www.www.yisu.com:/root/lnmp0.4/ /home/lnmp0.4/
The upper port capital P is a parameter, 2222 indicates the port after changing the SSH port. If the SSH port has not been changed, this parameter may not be added. - The r parameter indicates recursive replication (i.e. copying the files and directories below the directory);root@wwwjb51.net indicates logging on to the remote server wwwjb51.net as root,:/root/lnmp0.4/indicates the directory on the remote server, and the last/home/lnmp0.4/indicates the path saved locally.
Upload local files to the server
The code is as follows:
scp -P 2222 /home/lnmp0.4.tar.gz root@www.www.yisu.com:/root/lnmp0.4.tar.gz
The upper port capital P is a parameter, 2222 indicates the port after changing the SSH port. If the SSH port is not changed, this parameter can be omitted. /home/lnmp0.4.tar.gz indicates the path and filename of the file to upload locally. root@wwwjb51.net means log on to the remote server as root wwwjb51.net,:/root/lnmp0.4.tar.gz means directory and file names saved on the remote server.
Upload the local directory to the server
The code is as follows:
scp -P 2222 -r /home/lnmp0.4/ root@www.www.yisu.com:/root/lnmp0.4/
The upper port capital P is a parameter, 2222 indicates the port after changing the SSH port. If the SSH port has not been changed, this parameter may not be added. - The r parameter indicates recursive replication (i.e. copying the files and directories below the directory);/home/lnmp0.4/indicates the directory ready for upload, root@wwwjb51.net indicates logging in to the remote server as root wwwjb51.net, and:/root/lnmp0.4/indicates the directory location saved on the remote server.
5. Several parameters that may be useful:
-v is the same as-v in most Linux commands and is used to show progress. Can be used to view connection, authentication, or configuration errors.
-C Enable compression option.
-4 Forcing IPV4 addresses.
-6 Forced use of IPV6 addresses.
Thank you for reading! About "Linux SSH remote file/directory transfer command scp how to use" This article is shared here, I hope the above content can have some help for everyone, so that everyone can learn more knowledge, if you think the article is good, you can share it to let more people see it!
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.