How to Use SCP Command in Linux

 How to Use SCP Command in Linux



SCP (Secure Copy Protocol) is used to securely copy files/folders between Linux (Unix) systems on a network. The scp command line utility is a safer variant of the cp (copy) command.

Copying files from local host to remote host.

Copying files from remote host to local host.

Copying files from remote host to remote host

Basic Syntax of SCP Command

scp [option] [user_name@source_host:path/to/source/file] [user_name@target_host:target/path]

Copy a Local File to a Remote System

$ scp file.txt remote_username@10.125.238.1:/remote/directory

Copy a Remote File to a Local System

$ scp remote_username@10.125.238.2:/remote/file.txt /local/directory

Copy a File Between Two Remote Systems

$ scp user1@host1.com:/files/file.txt user2@host2.com:/files

SCP Command Options

P(Caps) - specifies the port to establish connection with the remote host.
p(lowercase) - preserves the times-tamp for ease of modification and access.
r - copies the entire directory recursively
q - copies files quietly, doesn't display the progress messages. Also known as quiet mode.
C(Caps)  - for compression of data during transmission.
v - print debug information into the screen

No comments

Powered by Blogger.