SCP command Detailed (full) _linux shell

Source: Internet
Author: User
Tags file copy svn ftp client scp command

SVN deletes all the. svn files

Copy Code code as follows:

Find. -name. Svn-type d-exec rm-fr {} \;

Linux CP/SCP Command +SCP command detailed

Name: CP

Use Rights: All users

How to use:

CP [Options] source dest

CP [options] source ... directory

Note: Copy one file to another file or copy several files to another directory.

The meter

-A as far as possible, file status, permissions and other information are reproduced as the original.

-R If the source contains a directory name, then the directory of the files are also copied to the destination.

-F If a file with the same file name exists at the destination, delete it before copying it.

Example:

Copy the file AAA (already exists) and name it BBB:

CP AAA BBB

Copy all C language programs to the finished subdirectory:

CP *.c finished

Command: SCP

There are 3 common ways to copy files between different Linux types:

The first is FTP, which is one of the Linux installation FTP Server, this can be another use of FTP client program for file copy.

The second approach is to use the Samba service, similar to the Windows file copy of the way to operate, more concise and convenient.

The third way is to use the SCP command for file copying.

The SCP is a security file copy, based on SSH login. Easy to operate, such as to the current one file copy to a remote other host, you can command the following.

Scp/home/daisy/full.tar.gz Root@172.19.2.75:/home/root

You will then be prompted to enter the login password for the other 172.19.2.75 host's root user, and then copy it.

If you want to reverse the operation, it is also easy to copy the files from the remote host to the current system.

Linux CP/SCP Command +SCP command Detailed (Turn)-Linmaogan-Lone wood ★ Not forest SCP root@/full.tar.gz 172.19.2.75:/home/root/full.tar.gz Home/daisy /full.tar.gz

Linux's SCP commands allow you to copy files and directories between Linux;

==================
SCP command
==================
The SCP can replicate files between 2 Linux hosts;

Command basic format:
SCP [Optional parameters] File_source File_target

= = =
copy locally to remote
= = = Copy File:
        * Command grid Type:
                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

                1th, 2 specified user names, The command needs to enter the password after execution, the 1th specifies only the remote directory, the file name is unchanged, and the 2nd specifies the filename;  

                3rd, 4 did not specify a user name, The command needs to enter a username and password after execution, the 3rd specifies only the remote directory, the file name is unchanged, and the 4th specifies the filename;
        * 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 directory:
* Command format:
Scp-r Local_folder Remote_username@remote_ip:remote_folder
Or
Scp-r Local_folder Remote_ip:remote_folder

The 1th specifies the user name, the command needs to enter the password after the execution;

The 2nd does not specify the user name, the command needs to enter the user name and password after execution;

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, which is remotely available after replication. /others/music/Directory

======
from remote replication to local
======
From remote to local, as long as the following 2 parameters of the command will be copied from the local to the remote order can be replaced;

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 username @IP address: filename 1 remote username @IP address: filename 2

[Local username @IP address:] You may need to enter the password for the remote user name without entering it.

Several parameters that may be useful:

-V is the same as the-V meaning in most Linux commands, and is used to show progress. Can be used to view connections, authentication, or configuration errors.

-C enables compression options.

-P Select the port. Note-P has been used by RCP.

-4 forcibly use IPV4 address.

-6 forcibly use IPV6 address.

Note two points:

1. If the remote server firewall has special restrictions, the SCP will go to the special port, specific port depending on the situation, the command format is as follows:

#scp-P 4588 remote@www.abc.com:/usr/local/sin.sh /home/administrator

2. Use the SCP to be aware of whether the user you are using has permission to read the appropriate files for the remote server.

SCP Remote Copy

SSH provides commands and shells to log on to a remote server. It does not allow you to copy files by default, but it provides an "SCP" command. Suppose you want to copy a file named "Dumb" in the current directory of your local computer to a remote server www.foobar.com your home directory. And your account on the remote server is named "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, just imagine that the direct transfer of files between the two servers is completely solved with a single SCP command.

You can run #scp servername:/home/ftp/pub/file1 on a single server as root. This will be the other server on the file/home/ftp/pub/file1 directly to the current directory of the machine, of course, you can also use #scp/tmp/file2 servername:/boot the file on this machine
/tmp/file2 sent to the/boot directory of another machine.

And the entire transfer process is still encrypted with SSH.

1: Copy Local files to the remote machine:

SCP local filename 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 the Local:

SCP Account @192.168.80.80: File full path local directory

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 username and password

The SCP is a security copy of the file, based on SSH login.

There are 3 common ways to copy files between different Linux types:

The first is FTP, which is one of the Linux installation FTP Server, this can be another use of FTP client program to make copies of files.
The second approach is to use the Samba service, similar to the way Windows files are copied to operate, more concise and convenient.
The third is to use the SCP command for file copy.

The above content is this article about the SCP order detailed all content, hoped to have the help to everybody.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.