How to Copy a File from/to a Remote Server
SCP is being used to copy files from one machine to an other one. It can be used to transfer (download and upload) files vis ssh.
scp command is being used to copy files from a remote server to a local machine and vice versa. It uses ssh to do secure file transfer.
1. Copy a file from a remote server to a local machine
It will ask the password for remote user
Copy a file from remote server to local machine
scp [email protected]:/remote/path/to/file /local/path* symbol can be used to copy multiple files by pattern like w3docs* which will copy w3docs.sql, w3docs1.pdf and etc.
2. Copy a directory from a remote server to a local machine
-r should be used for directories
Copy a directory from remote server to local machine
scp -r [email protected]:/remote/path/to/directory /local/path3. Copy a file from a local machine to a remote server
Copy a file from local machine to remote server
scp /local/file/path username@example:/remote/path4. Copy a directory from a local machine to a remote server
-r should be used for directories
Copy a directory from local machine to remote server
scp -r /local/directory/path username@example:/remote/directory/path5. Copy files by using RSA keys
If there is an identity key (RSA) instead of password than -i should be added
Copy files and directories on Amazon servers by using RSA key
scp -i /path/to/key [email protected]:/remote/path/to/file /local/path