tldr/pages/common/scp.md

31 lines
834 B
Markdown
Raw Normal View History

2013-12-08 08:56:16 +00:00
# scp
> Copies files between hosts on a network.
> Works over a secure connection (SSH).
2013-12-08 08:56:16 +00:00
- Upload a file, or upload and rename a file:
2014-01-30 14:22:27 +00:00
`scp {{/local/file.txt}} {{10.0.0.1}}:{{/remote/path/}}`
`scp {{/local/file.txt}} {{10.0.0.1}}:{{/remote/path/newname.txt}}`
- Download a file:
2013-12-08 08:56:16 +00:00
2014-01-30 14:22:27 +00:00
`scp {{10.0.0.1}}:{{/remote/path/file.txt}} {{/local/folder}}`
- Upload or download a directory:
2014-01-30 14:22:27 +00:00
2014-01-30 14:30:19 +00:00
`scp -r {{/local/folder}} {{10.0.0.1}}:{{/remote/path/}}`
2014-01-30 14:22:27 +00:00
`scp -r {{10.0.0.1}}:{{/remote/path}} {{/local/folder}}`
2013-12-08 08:56:16 +00:00
- Specify username on host:
2013-12-08 08:56:16 +00:00
2014-01-30 14:22:27 +00:00
`scp {{/local/file.txt}} {{my_user}}@{{10.0.0.1}}:{{/remote/path}}`
- Copy a file from one host to another:
2014-01-30 14:22:27 +00:00
`scp {{10.0.0.1}}:{{/remote/path/file.txt}} {{20.0.0.2}}:{{/other/remote/path}}`
2015-12-25 08:25:01 +00:00
- Download a file with ssh key:
2015-12-25 08:25:01 +00:00
`scp -i {{/local/key}} {{10.0.0.1}}:{{/remote/path/file.txt}} {{/local/folder}}`