Tools and Configuration
Copy a Local File to a Remote System with the scp Command
scp CommandTo copy a file from a local to a remote system run the following command:
scp file.txt [email protected]:/remote/directoryCopyWhere file.txt is the name of the file we want to copy, remote_username is the user on the remote server, 10.10.0.2 is the server IP address. The /remote/directory is the path to the directory you want to copy the file to. If you don’t specify a remote directory, the file will be copied to the remote user home directory.
You will be prompted to enter the user password, and the transfer process will start.
Copy a File Between Two Remote Systems using the scp Command
scp CommandUnlike rsync , when using scp you don’t have to log in to one of the servers to transfer files from one to another remote machine.
The following command will copy the file /files/file.txt from the remote host host1.com to the directory /files on the remote host host2.com.
scp [email protected]:/files/file.txt [email protected]:/filesCopyYou will be prompted to enter the passwords for both remote accounts. The data will be transfer directly from one remote host to the other.
Last updated