SCP is the abbreviation of Secure Copy. It is used to make commands for remote copy files under Linux. Similar commands have CP. However, CP only copys on the machine and cannot cross the server, and SCP transmission is encrypted. It may affect the speed slightly.
When your server hard disk becomes only read Read only system, use SCP to help you move the file out. In addition, SCP is still very unsuitable, and it will not increase much system load. At this point, RSYNC is far less than it. Although RSYNC will be a little faster than SCP, when there are many small files, RSYNC will cause the hard disk I/O very high, and SCP basically does not affect the normal use of the system.
Use SCP transmission files
1. Download file from the server
scp [email protected]:/path/filename /tmp/local_destination
scp [email protected]:/home/kimi/test.txt
download the files of /home/kimi/test.txt on 192.168.0.101
/tmp/local_destination
2, upload local files to the server
scp /path/local_filename [email protected]:/path
scp /var/www/test.php [email protected]:/var/www/
Test.php file in this machine/var/www/directory to 192.168.0.101 in the/var/www/directory on the server
3. Download the entire directory from the server
scp -r [email protected]:remote_dir/ /tmp/local_dir
For example:
scp -r [email protected] /home/kimi/test /tmp/local_dir
4. Upload directory to the server
scp -r /tmp/local_dir [email protected]:remote_dir
For example:
scp -r test [email protected]:/var/www/
Upload the test directory in the current directory to the/var/www/directory of the server