Unix/Linux : secure copying between servers with SCP command examples
Have to write this down in case I forget again and hope you may find these SCP examples useful too.
Example 1:
To copy a single file :
scp sourceFile user@targetServer:targetDirectory/targetFile
Example 2:
To copy entire directory(plus sub directories) over to remote server :
scp -r sourceFolder user@targetServer:targetDirectory/targetFolder
Example 3:
To copy single file from remote server to local server:
scp user@remoteServer:remoteDirectory/remoteFile localFile
Example 4:
To copy entire directory from remote server to local server:
scp -r user@remoteServer:remoteDirectory/remoteFolder localFolder
NOTE : By default SCP works on port 22, in case the remote server has different port for SCP. You can specify the port number by the -p option :
scp -p 3300 -r user@remoteServer:remoteDirectory/remoteFolder localFolder
References :
By Adam Ng
IF you gain some knowledge or the information here solved your programming problem. Please consider donating to the less fortunate or some charities that you like. Apart from donation, planting trees, volunteering or reducing your carbon footprint will be great too.
Advertisement
Tutorials
+5.6k Golang : Warp text string by number of characters or runes example
+9.9k Golang : Create S3 bucket with official aws-sdk-go package
+8.2k Golang : How to generate Code 39 barcode?
+7.7k Golang : Simple histogram example
+10k Google Maps URL parameters configuration
+14.7k Golang : Read integer from file into array
+16k Golang : Multi threading or run two processes or more example
+4.2k Golang : The Tao of importing package
+13.3k Golang : package is not in GOROOT during compilation
+5.5k Golang : Calculate diameter, circumference, area, sphere surface and volume
+20.4k Golang : Join arrays or slices example
+5.4k Unix/Linux : Use netstat to find out IP addresses served by your website server