"Common Commands" "SSH" SCP

Source: Internet
Author: User
Tags ssh scp command

In general, the local network with the remote network data transfer, or data migration, there are three commonly used methods, one is FTP, the second is Wget/fetch, rsync large-scale data migration with Rysync, followed by Fetch/wget, the most times is FTP, The slowest is FTP. These days, when busy data migrations, use the SCP method of SSH to migrate the data. The speed and effect are very good. Especially now many servers in order to secure, will change SSH default 22 port, change to a special port. So. In the case of SCP or SFTP, specify what port to migrate through. Now, make a note of this special port to the SCP command.

Scp-p Port User@serverip:/home/user/filename/home/user/filename

At the upper port p as the parameter, port port user is SSH user serverip for remote server IP or domain name,/home/user/filename the file name/home/user/filename for the remote server as the local service server. The purpose of this command is to copy the remote filename to the local directory below.

SCP's role is really huge, detailed usage, can be man SCP or scp–help, below for attached an SCP use detailed ...
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

======
Replicate 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

1th, 2 specified the user name, the command needs to enter the password after the execution, the 1th specified only the remote directory, the file name unchanged, the 2nd specified the filename;
3rd, 4 did not specify the user name, the command needs to enter the user name and password, the 3rd specified only a remote directory, the file name unchanged, the 4th specified the filename;
* Routines:
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/002.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/002.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;
* Routines:
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/i.mp3
Scp-r www.cumt.edu.cn:/home/root/others//home/space/music/

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.