LINUX SCP Remote File copy

Source: Internet
Author: User
Tags file copy scp command

First, make sure that the direct IP of the two machines can ping each other.




Then use the SCP command to copy files from the first host to the second host

SCP src [Email protected]:/home/chiwei/mydisk/buffer_scp_file


Ssh:connect to host 192.168.8.144 Port 22:connection refused
Lost connection


Check that the remote host does not have SSHD installed

[Email protected]:~/mydisk/buffer_scp_file$ sshd
The program "SSHD" is not installed. You can use the following command to install:
sudo apt-get install Openssh-server
[Email protected]:~/mydisk/buffer_scp_file$ sudo apt-get install Openssh-server

After the installation is complete, transfer the file, here I am the Transfer folder, the folder files are transferred to the past, so with the-r option, you can only transfer files without this option

[[email protected]/mydisk/eclispe_workspace/java]# scp-r src [email protected]:/home/chiwei/mydisk/ Buffer_scp_file[email protected] ' s password:logintest.txt 100% 977 1.0kb/s 00                                     : xx classloadertest.java 100% 0.1kb/s 00:00 Test.java    100% 298 0.3kb/s 00:00 Filereadwritebymemcached.java 100% 139 0.1kb/s 00:00                           Client.java 100% 981 1.0kb/s 00:00 Objectanalyzer.java 100% 3738 3.7kb/s 00:00 utils.java 100% 5703 5.6kb/s 00:00 Testqui  Ck.java 100% 1481 1.5kb/s 00:00 Testandpassportvalidate.java 100%                                     1348 1.3kb/s 00:00 Utilstest.java 100% 283 0.3kb/s 00:00 Test.java 100% 225 0.2kb/s 00:00 Transferrunnable.java 100% 614 0.6kb/s 00:00 Bank.java     100% 1041 1.0kb/s 00:00 Unsyncbanktest.java 100% 468                                 0.5kb/s 00:00 Test.java 100% 124 0.1kb/s 00:00 Rsautils.java 100% 7691 7.5kb/s 00:00 Rsatest.java 100% 1980 1.9                                     kb/s 00:00 Base64utils.java 100% 1924 1.9kb/s 00:00 Test.java  100% 2727 2.7kb/s 00:00 [[email protected]/mydisk/eclispe_workspace/java]#
Go to the directory of the remote host to view
[Email protected]:~/mydisk/buffer_scp_file$ lssrc[email protected]:~/mydisk/buffer_scp_file$ CD src/[email protected ]:~/mydisk/buffer_scp_file/src$ lsclassloader  JVM            memcached  RSA       Threaddemo         logintest.txt  reflect    


The above is the transfer of files to the remote host, and then try to copy files from the remote host to the local

[Email protected]/mydisk/eclispe_workspace/java]# SCP [email protected]:/home/chiwei/mydisk/buffer_scp_file/ Demo.txt/mydisk/[email protected] ' s password:demo.txt                                      100%     0.0kb/s   00:00    

To view the corresponding directory in this machine

[Email protected]/mydisk]# ls<span style= "color: #ff0000;" ><strong>demo.txt</strong></span>           Hadoop             local_repo  normandy_config  Softwareeclispe_workspace  learning_material  Maven_repo  

Very practical, very simple command!










LINUX SCP Remote File copy

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.