2013-12-08 09:56:16 +01:00
|
|
|
# scp
|
|
|
|
|
2013-12-09 12:12:16 +01:00
|
|
|
> Copies files between hosts on a network
|
|
|
|
> Works over a secure connection (SSH)
|
2013-12-08 09:56:16 +01:00
|
|
|
|
2014-01-30 15:30:19 +01:00
|
|
|
- upload a file, or upload and rename a file
|
2014-01-30 15:22:27 +01:00
|
|
|
|
|
|
|
`scp {{/local/file.txt}} {{10.0.0.1}}:{{/remote/path/}}`
|
2015-10-28 18:10:44 +01:00
|
|
|
|
2014-01-30 15:22:27 +01:00
|
|
|
`scp {{/local/file.txt}} {{10.0.0.1}}:{{/remote/path/newname.txt}}`
|
|
|
|
|
|
|
|
- download a file
|
2013-12-08 09:56:16 +01:00
|
|
|
|
2014-01-30 15:22:27 +01:00
|
|
|
`scp {{10.0.0.1}}:{{/remote/path/file.txt}} {{/local/folder}}`
|
|
|
|
|
2014-01-30 15:30:19 +01:00
|
|
|
- upload or download a directory
|
2014-01-30 15:22:27 +01:00
|
|
|
|
2014-01-30 15:30:19 +01:00
|
|
|
`scp -r {{/local/folder}} {{10.0.0.1}}:{{/remote/path/}}`
|
2015-10-28 18:10:44 +01:00
|
|
|
|
2014-01-30 15:22:27 +01:00
|
|
|
`scp -r {{10.0.0.1}}:{{/remote/path}} {{/local/folder}}`
|
2013-12-08 09:56:16 +01:00
|
|
|
|
2014-01-30 15:26:55 +01:00
|
|
|
- specify username on host
|
2013-12-08 09:56:16 +01:00
|
|
|
|
2014-01-30 15:22:27 +01:00
|
|
|
`scp {{/local/file.txt}} {{my_user}}@{{10.0.0.1}}:{{/remote/path}}`
|
|
|
|
|
2014-05-26 11:02:20 +02:00
|
|
|
- specify port on host
|
|
|
|
|
|
|
|
`scp -P {{port}} {{/local/file.txt}} {{10.0.0.1}}:{{/remote/path}}`
|
|
|
|
|
2014-01-30 15:22:27 +01:00
|
|
|
- copy a file from one host to another
|
|
|
|
|
|
|
|
`scp {{10.0.0.1}}:{{/remote/path/file.txt}} {{20.0.0.2}}:{{/other/remote/path}}`
|