Linux Secure Copy (SCP)

SCP is a must for quick transfer of files in native environments. In order to interact with a Windows machine, an SSH server is needed on the system but you may be able to get around that be specifying a different port.

Below are a few examples of how it help you in your daily work.

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

$ scp your_username@remotehost_IP:some_data.txt /some/local/directory

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

$ scp some_data.txt your_username@remotehost_IP:/some/remote/directory

Copy the directory “some_dir” from the local host to a remote host’s directory “data”

$ scp -r some_dir your_username@remotehost_IP:/some/remote/directory/data

Copy the file “data.txt” from remote host “sys_1” to remote host “sys_2”

$ scp your_username@sys_1:/some/remote/directory/data.txt \

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

$ scp data.txt more_data.txt your_username@remotehost_IP~

Copy the file “data.txt” from the local host to a remote host using port 2264

$ scp -P 2264 data.txt your_username@remotehost_IP:/some/remote/directory

Copy multiple files from the remote host to your current directory on the local host

$ scp your_username@remotehost_IP:/some/remote/directory/\{a,b,c\} 
$ scp your_username@remotehost_IP:~/\{data.txt,more_data.txt\}