Linux

Secure Copy (scp)

What is Secure Copy?

scp allows files to be copied to, from, or between different hosts. It uses ssh for data transfer and provides the same authentication and same level of security as ssh.

Examples

Copy the file “require.txt” from a remote host to the local host

$ scp your_username@remote_host_ip:require.txt /some/local/directory

Copy the file “require.txt” from the local host to a remote host

$ scp require.txt your_username@remote_host_ip:/some/remote/directory

Copy the file “require.txt” from remote host “remote_host_ip1” to remote host “remote_host_ip1”

$ scp your_username@remote_host_ip1:/some/remote/directory/require.txt \

your_username@remote_host_ip2:/some/remote/directory/

Copying the files “require1.txt” and “require2.txt” from the local host to your home directory on the remote host

$ scp require1.txt require2.txt your_username@remote_host_ip:~

Copy the file “require.txt” from the local host to a remote host using port 2223

$ scp -P 2223 require.txt your_username@remote_host_ip:/some/remote/directory

Copy file from the remote host to your current directory on the local host with timeout consideration

$ scp -r your_username@remote_host_ip:/some/remote/directory/

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.