Secure Copy (SCP) provides a secure and authenticated method for copying files between hosts. SCP relies on Secure Shell (SSH).
Copy the file “somefile.txt” from a remote host to the local host
scp your_username@example.com:somefile.txt /some/local/directory
Copy the file “somefile.txt” from the local host to a remote host
scp somefile.txt your_username@example.com:/some/remote/directory
Copy the directory “somedir” from the local host to a remote host’s directory “anotherdir”
scp -r somedir your_username@example.com:/some/remote/directory/anotherdir
Copy the file “somefile.txt” from remote host “example1.com” to remote host “example2.com”
scp your_username@example1.com:/some/remote/directory/foobar.txt \
your_username@example2.com:/some/remote/directory/
Copying the files “somefile.txt” and “anotherfile.txt” from the local host to your home directory on the remote host
scp somefile.txt anotherfile.txt your_username@example.com:~
Copy the file “somefile.txt” from the local host to a remote host using port 1234
scp -P 1234 somefile.txt your_username@example.com:/some/remote/directory
Copy multiple files from the remote host to your current directory on the local host
scp your_username@example.com:/some/remote/directory/\{1,2,3\} . scp your_username@example.com:~/\{somefile1.txt,somefile2.txt\} .