Under Linux generally use the SCP command to transfer files via SSH.
First, what is the SCP?
The SCP is a secure copy shorthand for remote copy of files under Linux, and a similar command has CP, but the CP is only copied on the local computer, not across servers, and the SCP transmission is encrypted. may have a slight impact on speed.
Second, what is the use of SCP?
1, we need to get a file on the remote server, the remote server has neither configured the FTP server, did not open the Web server, did not do the sharing, can not get the file through the regular way, only need to pass the SCP command can easily achieve the goal.
2, we need to upload the files on this machine to the remote server, the remote server does not open the FTP server or share, can not be uploaded through the normal way is, only need to pass the SCP command can be easily achieved.
Iii. methods of using SCP
1, download files from the server
SCP username@servername:/path/filename/var/www/local_dir (local directory)
For example, the SCP root@192.168.0.101:/var/www/test.txt downloads/var/www/test.txt files on 192.168.0.101 to/var/www/local_dir (local directory)
2, upload local files to the server
Scp/path/filename Username@servername:/path
For example, scp/var/www/test.php root@192.168.0.101:/var/www/upload test.php files from the native/var/www/directory to 192.168.0.101 on this server In the Directory
3, download the entire directory from the server
Scp-r username@servername:/var/www/remote_dir/(remote directory)/var/www/local_dir (local directory)
For example: Scp-r root@192.168.0.101:/var/www/test/var/www/
4, upload directory to the server
Scp-r Local_dir Username@servername:remote_dir
For example: Scp-r test root@192.168.0.101:/var/www/uploads the test directory in the current directory to the server's/var/www/directory
Note: The target server will open write permission.
From:http://www.cnblogs.com/jiangyao/archive/2011/01/26/1945570.html
Http://linux.cn/article-31-1.html