Category: Linux
Secure Copy (scp)
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.
- Example 1: Copy file "file.txt" from remote server to local computer:
$ scp user@remote.host:file.txt /some/local/directory
- Example 2: Copy file "file.txt" from the local computer to the remote server:
$ scp file.txt user@remote.host:/some/remote/directory
- Example 3: Copy the folder "dir1" from the local host to the directory "dir2" on the remote host:
$ scp -r dir1 user@remote.host:/some/remote/directory/dir2
- Example 4: Copy file "file.txt" from one remote server "remote.host1" to another remote server "remote.host2":
$ scp user@remote.host1:/directory/file.txt user@remote.host2:/some/directory/
- Example 5: Copy files "file1.txt" and "file2.txt" from your local computer to Your home directory on the remote server:
$ scp file1.txt file2.txt user@remote.host:~
- Example 6: Copy file "file.txt" from local host to remote host using port 2222.:
$ scp -P 2222 file.txt user@remote.host:/some/remote/directory
- Example 7: Copy file "file.txt" from your local computer to Your home directory on the remote server. We save time of change and access time and the rights of the copied file:
$ scp -p file.txt user@remote.host:~
- Example 8: Copy file "file.txt" from your local computer to Your home directory on the remote server. Increase the speed of SCP by changing the encryption algorithm from AES-128 (default) to Blowfish:
$ scp -c blowfish file.txt user@remote.host:~
- Example 9: Copy file "file.txt" from your local computer to Your home directory on the remote server. Limit the channel width used by the SCP command to 100 Kbit/s:
$ scp -l 100 file.txt user@remote.host:~
- Example 10: Copy several files from a remote host to the current directory on Your local host:
$ scp user@remote.host:~/\{file1,file2,file3\} .
Posted: 2019-04-14
Comments