Secure copy, or secure copy protocol/secure copy program (SCP), a command for securely transferring files across UNIX-like systems
scp <file> <username>@<IP address or hostname>:<Destination>
The -r (recursive) option means to copy the whole folder and any sub-folders. You can also copy files the other way:
scp -r <file> OR <Folder> @IP address :<Destination>
scp file.txt remote_username@10.10.0.2:/remote/directory
The scp command syntax take the following form:
scp [OPTION] [user@]SRC_HOST:]file1 [user@]DEST_HOST:]file2
OPTION - scp options such as cipher, ssh configuration, ssh port, limit, recursive copy …etc.
[user@]SRC_HOST:]file1
- Source file.
[user@]DEST_HOST:]file2
- Destination file
scp provides a number of options that control every aspect of its behavior. The most widely used options are:
-
P
- Specifies the remote host ssh port.
-
p
- Preserves files modification and access times.
-
q
- Use this option if you want to suppress the progress meter and non-error messages.
-
C
- This option forces scp to compresses the data as it is sent to the destination machine.
-
r
- This option tells scp to copy directories recursively.