2016-01-16 11:15:50 +03:00
|
|
|
# sftp
|
|
|
|
|
2016-01-31 13:36:32 +03: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 11:15:50 +03: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 13:36:32 +03:00
|
|
|
`sftp -P {{remote_port}} {{remote_user}}@{{remote_host}}`
|
2016-01-16 11:15:50 +03:00
|
|
|
|
2016-01-31 13:36:32 +03:00
|
|
|
- Transfer remote file to the local system:
|
2016-01-16 11:15:50 +03:00
|
|
|
|
2016-01-31 13:36:32 +03:00
|
|
|
`get {{/path/remote_file}}`
|
2016-01-16 11:15:50 +03:00
|
|
|
|
2016-01-31 13:36:32 +03:00
|
|
|
- Transfer local file to the remote system:
|
2016-01-16 11:15:50 +03:00
|
|
|
|
2016-01-31 13:36:32 +03:00
|
|
|
`put {{/path/local_file}}`
|
|
|
|
|
2016-04-01 17:47:57 +03:00
|
|
|
- Transfer remote folder to the local system recursively (works with `put` too):
|
2016-04-01 17:46:33 +03:00
|
|
|
|
2016-04-01 17:47:57 +03:00
|
|
|
`get -R {{/path/remote_folder}}`
|
2016-04-01 17:46:33 +03:00
|
|
|
|
2016-01-31 13:36:32 +03:00
|
|
|
- Get list of files on local machine:
|
|
|
|
|
|
|
|
`lls`
|
|
|
|
|
|
|
|
- Get list of files on remote machine:
|
|
|
|
|
|
|
|
`ls`
|