To copy all from Local Location to Remote Location (Upload)
scp -r /path/from/destination username@hostname:/path/to/destination
To copy all from Remote Location to Local Location (Download)
scp -r username@hostname:/path/from/destination /path/to/destination
Custom Port where xxxx is custom port number
scp -r -P xxxx username@hostname:/path/from/destination /path/to/destination
Copy on current directory from Remote to Local
scp -r username@hostname:/path/from/file .
Help:
-r Recursively copy all directories and files
- Always use full location from
/, Get full location by pwd
scp will replace all existing files
hostname will be hostname or IP address
- if custom port is needed (besides port 22) use
-P portnumber
- . (dot) - it means current working directory, So download/copy from server and paste here only.
Note: Sometimes the custom port will not work due to the port not being allowed in the firewall, so make sure that custom port is allowed in the firewall for incoming and outgoing connection