SCP (Secure Contain Protect)



Upload single file to host

$ scp file.txt admin@192.168.100.22:/temp

Upload single file to host with specified port number

$ scp -P 2112 file.txt admin@192.168.100.11:/temp

Upload single file to GCP (Google Cloud Platform)

$ scp -i ~/.ssh/id_rsa file.jar debian@ip_public:/home/debian/tmp

If your destination was using Windows OS, so

$ scp file.txt admin@192.168.100.22:\D:\temp


Upload multiple files

$ scp {file1,file2,file3}.txt admin@192.168.100.22:/temp

or

$ scp {file1,file2,file3}.txt admin@192.168.100.22:\D:\temp


Upload directory recursively

$ scp -r /var/www/html/blogger_api admin@192.168.100.22:/temp

or

$ scp -r C:\xampp\htdocs\blogger_api admin@192.168.100.22:\D:\temp


On the other hand if you are on the computer wanting to receive file from a remote computer:

$ scp username@remote:/file/to/send /where/to/put


scp can also send files between two remote hosts:

$ scp username@remote_1:/file/to/send username@remote_2:/where/to/put


So the basic syntax is:

$ scp username@source:/location/to/file username@destination:/where/to/put


Source :

https://stackoverflow.com/questions/8975798/copying-a-local-file-from-windows-to-a-remote-server-using-scp

https://superuser.com/questions/1310766/scp-from-remote-linux-to-local-windows-with-spaces-in-local-path

https://stackoverflow.com/questions/16886179/scp-or-sftp-copy-multiple-files-with-single-command

https://serverfault.com/questions/264595/can-scp-copy-directories-recursively

https://unix.stackexchange.com/questions/188285/how-to-copy-a-file-from-a-remote-server-to-a-local-machine

https://stackoverflow.com/questions/10341032/scp-with-port-number-specified

Comments