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`.
|
meshlabserver, nkf, obs, pax, pdfimages, pinky, pssh, s, sd, sendmail, sftp: add link (#6971)
2021-10-17 05:23:56 +01:00
|
|
|
> More information: <https://manned.org/sftp>.
|
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
|
|
|
|
2022-06-21 14:59:48 +01:00
|
|
|
- Connect using a predefined host (in `~/.ssh/config`):
|
|
|
|
|
|
|
|
`sftp {{host}}`
|
|
|
|
|
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}}`
|
|
|
|
|
2019-02-11 18:00:49 +00:00
|
|
|
- Transfer remote directory to the local system recursively (works with `put` too):
|
2016-04-01 15:46:33 +01:00
|
|
|
|
2019-02-11 18:00:49 +00:00
|
|
|
`get -R {{/path/remote_directory}}`
|
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`
|