SCP stands for Secure Copy, as the name shows it use for securely copy the file, directory from one location to another.
SCP use to copy files securely between networks and system/servers. It uses SSH protocol for authentication and data transfer.
SCP command Syntax:
$ scp source_file_path destination_file_path
As per the requirement, we can use hostname, port, username, and password with SCP command options.
Here some examples of SCP command which will help you to understand the real use of SCP command.
Suggested Reading: Linux sed command Structure
SCP Command Examples:
Copy a file to remote system
To copy a file into the remote server, you can use source and destination path.
$ scp linuxconcept.pdf email@example.com:.
The above command will copy a linuxconcept.pdf file into satish’s home directory at “linuxconcept.com” system.
Get the detailed information while coping
There is an option “-v” to use to get detailed information while copying the file between host. The option “-v” is used to execute SCP command in verbose mode so that it will print debug information into the screen.
$ scp -v linuxconcept.pdf firstname.lastname@example.org:.
Use specific Port with SCP to connect remote host
To use a specific port with SCP command, you can use the “-P” option, as shown below:
$ scp -P 44444 linuxconcept.pdf email@example.com:. firstname.lastname@example.org’s password: linuxconcept.pdf 100% 4567KB 245.3KB/s 00:21