When we manage the server or VPS, we often upload and download data. For example, when we need to move data from one server to another, we usually download the data from the first server to our computer, and then upload the downloaded data to the remote server through the ftp tool. But this is a waste of time and energy. Why don’t we pack it on the first server and transfer the data directly to another server? The scp command in Linux just happens to be able to transfer data between the two servers.
What is scp
scp is a secure copy, which is used for remote file copy. Data transmission uses ssh, and uses the same authentication method as ssh, providing the same security guarantee. Unlike rcp, scp will ask you for a password or passphrase when authentication is required.
scp /home/backup.zip email@example.com:/home/others/backup //send the local file backup.zip to the remote backup directory
scp /home/backup.zip firstname.lastname@example.org:/home/others/otherbackup.zip //the local file backup.zip sent to the remote otherbackup.zip file.
scp -r /home/backup email@example.com:/home/others/ //Copy the local directory backup to the remote directory others
scp -r firstname.lastname@example.org:/home/backup /home/other/ //download the remote directory backup to the local directory other