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 > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article is to share with you about how to use the scp command in linux. The editor thinks it is very practical, so I share it with you. I hope you can get something after reading this article.
Svn deletes all. Svn file
Find. -name .SVN-type d-exec rm-fr {}\
Name: cp
Permissions: all users
Mode of use:
Cp [options] source dest
Cp [options] source... Directory
Description: copy one file to another, or copy several files to another directory.
Set up a plan
-a copy the file status, permissions and other information as much as possible.
-r if the directory name is included in the source, all the files in the directory will be copied to the destination in order.
-f if a file with the same file name already exists at the destination, delete it before copying it.
Example:
Copy the archive aaa (already exists) and name it bbb:
Cp aaa bbb
Copy all C programs to the Finished subdirectory:
Cp * .c Finished
Command: scp
There are three common methods for copy files between different Linux:
The first is ftp, that is, one of the Linux installs ftp Server, so that the other uses ftp's client program to copy files.
The second method is to use samba service, which is similar to Windows file copy, which is relatively simple and convenient.
The third is to use the scp command to copy files.
Scp is a file copy with Security, which is logged in based on ssh. It is easy to operate, for example, to copy a current file to another remote host, you can use the following command.
Scp / home/daisy/full.tar.gz root@172.19.2.75:/home/root
Then you will be prompted to enter the login password of the root user on the other 172.19.2.75 host, and then you will start copy.
It is also easy to copy files from the remote host to the current system if you want to do the reverse.
Scp root@/full.tar.gz 172.19.2.75:/home/root/full.tar.gz home/daisy/full.tar.gz
Linux's scp command copies files and directories between 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.
Pay attention to two points:
1. If there are special restrictions on the remote server firewall, scp will have to use a special port, which port will be used depending on the situation. The command format is as follows:
# scp-p 4588 remote@www.abc.com:/usr/local/sin.sh / home/administrator
two。 When using scp, you should pay attention to whether the user you are using has permission to read the corresponding files on the remote server.
The above is how to use the scp command in linux. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please 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.