To securely copy files across a network computer in Linux or UNIX, you can use the scp
command.
The scp
command is a secure version of the cp
command that is used to copy files between computers over a network. It uses the SSH
(Secure Shell) protocol to securely transfer the files.
To use the scp
command, you will need to specify the source file and the destination file. The source file is the file that you want to copy, and the destination file is the location where you want to copy the file.
To copy a file from your local computer to a remote computer, you can use the following scp
command:
$ scp source_file username@remote_host:destination_file
This will copy the source_file
from your local computer to the destination_file
on the remote computer. The username
is the user account on the remote computer, and the remote_host
is the hostname or IP address of the remote computer.
To copy a file from a remote computer to your local computer, you can use the following scp
command:
$ scp username@remote_host:source_file destination_file
This will copy the source_file
from the remote computer to the destination_file
on your local computer.
You can also use the scp
command to copy multiple files at once. To copy multiple files, you can specify the source files and the destination directory. For example, to copy multiple files from your local computer to a remote computer, you can use the following scp
command:
$ scp file1 file2 file3 username@remote_host:destination_directory
This will copy the file1
, file2
, and file3
files from your local computer to the destination_directory
on the remote computer.
Note that you will need to have an SSH
client and server installed on the local and remote computers to use the scp
command. You can use the ssh
command to connect to the remote computer and transfer files using scp
.