Linux scp command Help and Examples

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:

The syntax of SCP command is very simple, which work with source and destination file path. It is similar like below:
$ 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 satish@linuxconcept.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  satish@linuxconcept.com:.

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 satish@linuxconcept.com:.
satish@linuxconcept.com’s password:
linuxconcept.pdf   100%   4567KB  245.3KB/s   00:21

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

five × 2 =

Related Articles