2016-01-16 08:15:50 +00:00
|
|
|
# sftp
|
|
|
|
|
2016-01-31 10:36:32 +00:00
|
|
|
> Secure File Transfer Program.
|
|
|
|
> Interactive program to copy files between hosts over SSH.
|
|
|
|
> For non-interactive file transfers, see `scp` or `rsync`.
|
2016-01-16 08:15:50 +00:00
|
|
|
|
|
|
|
- Connect to a remote server and enter an interactive command mode:
|
|
|
|
|
|
|
|
`sftp {{remote_user}}@{{remote_host}}`
|
|
|
|
|
|
|
|
- Connect using an alternate port:
|
|
|
|
|
2016-01-31 10:36:32 +00:00
|
|
|
`sftp -P {{remote_port}} {{remote_user}}@{{remote_host}}`
|
2016-01-16 08:15:50 +00:00
|
|
|
|
2016-01-31 10:36:32 +00:00
|
|
|
- Transfer remote file to the local system:
|
2016-01-16 08:15:50 +00:00
|
|
|
|
2016-01-31 10:36:32 +00:00
|
|
|
`get {{/path/remote_file}}`
|
2016-01-16 08:15:50 +00:00
|
|
|
|
2016-01-31 10:36:32 +00:00
|
|
|
- Transfer local file to the remote system:
|
2016-01-16 08:15:50 +00:00
|
|
|
|
2016-01-31 10:36:32 +00:00
|
|
|
`put {{/path/local_file}}`
|
|
|
|
|
2016-04-01 15:47:57 +01:00
|
|
|
- Transfer remote folder to the local system recursively (works with `put` too):
|
2016-04-01 15:46:33 +01:00
|
|
|
|
2016-04-01 15:47:57 +01:00
|
|
|
`get -R {{/path/remote_folder}}`
|
2016-04-01 15:46:33 +01:00
|
|
|
|
2016-01-31 10:36:32 +00:00
|
|
|
- Get list of files on local machine:
|
|
|
|
|
|
|
|
`lls`
|
|
|
|
|
|
|
|
- Get list of files on remote machine:
|
|
|
|
|
|
|
|
`ls`
|