To copy and transfer files remotely on Linux, you can use the scp
(Secure Copy) and rsync
commands.
scp
is a command-line utility for securely transferring files between systems. It uses the Secure Shell (SSH) protocol to transfer files, and requires an SSH client to be installed on the local and remote systems.
To use scp
, you will need to specify the source and destination file paths, as well as the username and hostname or IP address of the remote system. For example, to copy a file from the local system to a remote system, you can use the following command:
scp file.txt user@remote:/path/to/destination
Replace file.txt
with the name of the file you want to transfer, user
with the username of the remote system, remote
with the hostname or IP address of the remote system, and /path/to/destination
with the path on the remote system where you want to save the file.
To copy a file from a remote system to the local system, you can use the following command:
scp user@remote:/path/to/source/file.txt .
This will copy the file file.txt
from the remote system to the current directory on the local system.
rsync
is a command-line utility for efficiently transferring and synchronizing files.