HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

sftp — Secure File Transfer Program. Interactive program to copy files between hosts over SSH. For non-inte

Submitted by: @import:tldr-pages··
0
Viewed 0 times
sftpcommandsecureclifiletransferprograminteractive

Problem

How to use the sftp command: Secure File Transfer Program. Interactive program to copy files between hosts over SSH. For non-interactive file transfers, see scp or rsync. More information: <https://manned.org/sftp>.

Solution

sftp — Secure File Transfer Program. Interactive program to copy files between hosts over SSH. For non-interactive file transfers, see scp or rsync. More information: <https://manned.org/sftp>.

Connect to a remote server and enter an interactive command mode:
sftp {{remote_user}}@{{remote_host}}


Connect using an alternate port:
sftp -P {{remote_port}} {{remote_user}}@{{remote_host}}


Connect using a predefined host (in ~/.ssh/config):
sftp {{host}}


[Interactive] Transfer remote file to the local system:
get {{path/to/remote_file}}


[Interactive] Transfer local file to the remote system:
put {{path/to/local_file}}


[Interactive] Transfer remote directory to the local system recursively (works with put too):
get -R {{path/to/remote_directory}}


[Interactive] Get list of files on local machine:
lls


[Interactive] Get a list of files on the remote machine:
ls

Code Snippets

Connect to a remote server and enter an interactive command mode

sftp {{remote_user}}@{{remote_host}}

Connect using an alternate port

sftp -P {{remote_port}} {{remote_user}}@{{remote_host}}

Connect using a predefined host (in `~/.ssh/config`)

sftp {{host}}

[Interactive] Transfer remote file to the local system

get {{path/to/remote_file}}

[Interactive] Transfer local file to the remote system

put {{path/to/local_file}}

Context

tldr-pages: common/sftp

Revisions (0)

No revisions yet.