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/03 Report--
This article mainly introduces "how to understand scp commands". In daily operation, I believe many people have doubts about how to understand scp commands. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubts about "how to understand scp commands"! Next, please follow the editor to study!
Svn deletes all .svn files
The code is as follows:
Find. -name .SVN-type d-exec rm-fr {}\
Detailed explanation of cp/scp Command + scp Command of linux
Name: cp
Permissions: all users
Mode of use:
Cp [options] source destcp [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.
Linux cp/scp command + scp command detailed explanation (transfer)-linmaogan-single tree ★ is not a forest 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.
Scp remote copy
SSH provides some commands and shell to log in to the remote server. By default, it does not allow you to copy files, but it still provides a "scp" command. Suppose you want to copy a file named "dumb" from the current directory of your local computer to your home directory on the remote server www.foobar.com. And your account on the remote server is called "bilbo". You can use this command:
Scp dumb bilbo@www.foobar.com:.
Copy the file back with this command:
Scp bilbo@www.foobar.com:dumb.
The scp command is the most convenient and useful command in SSH. Imagine transferring files directly between the two servers and using only the scp command to solve the problem.
You can run # scp servername:/home/ftp/pub/file1 as root on a server. In this way, you can transfer the files / home/ftp/pub/file1 from another server directly to the current directory of this machine. Of course, you can also use # scp / tmp/file2 servername:/boot to transfer the files on this machine.
/ tmp/file2 is sent to the / boot directory on another machine.
And the whole transmission process is still encrypted with SSH.
1: copy the local file to the remote machine:
Scp local file name account @ 192.168.80.80: remote machine directory
Example: scp / home/test root@192.168.80.80:/home/testdir/
2: copy the files on the remote machine to local:
Scp account @ 192.168.80.80: full path local directory of files
Example: scp root@192.168.80.80:/home/testdir/test / home/testdir/
Scp root@10.5.0.1:/root/firewall.tar.gz. /
Scp / home/cheney/full.tar.gz root@10.5.0.1:/home/root/
Scp-r root@10.5.0.1:/mail/*. / (copy all files in the entire directory)
You need to enter the appropriate user name and password
Scp is a copy of a file with Security and is logged in based on ssh.
There are three common ways to 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 the file.
At this point, the study on "how to understand scp commands" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
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.