secure file transfer program


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]

Transfer remote file to the local system

>_ get [/path/remote_file]

Transfer local file to the remote system

>_ put [/path/local_file]

Transfer remote directory to the local system recursively (works with put too)

>_ get -R [/path/remote_directory]

Get list of files on local machine

>_ lls

Get list of files on remote machine

>_ ls


sftp [-46aCfpqrv] [-B buffer_size] [-b batchfile] [-c cipher] [-D sftp_server_path] [-F ssh_config] [-i identity_file] [-J destination] [-l limit] [-o ssh_option] [-P port] [-R num_requests] [-S program] [-s subsystem | sftp_server] destination


sftp is a file transfer program, similar to ftp(1), which performs all operations over an encrypted ssh(1) transport. It may also use many features of ssh, such as public key authentication and compression.

The destination may be specified either as off [ on or as a URI in the form off sftp:// [ on

If the destination includes a path and it is not a directory, sftp will retrieve files automatically if a non-interactive authentication method is used; otherwise it will do so after successful interactive authentication.

If no path is specified, or if the path is a directory, sftp will log in to the specified host and enter interactive command mode, changing to the remote directory if one was specified. optional trailing slash can be used to force the path to be interpreted as a directory.

Since the destination formats use colon characters to delimit host names from path names or port numbers, IPv6 addresses must be enclosed in square brackets to avoid ambiguity.

The options are as follows:


Once in interactive mode, sftp understands a set of commands similar to those of ftp(1). Commands are case insensitive. Pathnames that contain spaces must be enclosed in quotes. Any special characters contained within pathnames that are recognized by glob(3) must be escaped with backslashes (`\ .')


ftp(1), ls(1), scp(1), ssh(1), ssh-add(1), ssh-keygen(1), ssh_config(5), glob(7), sftp-server(8), sshd(8) T. Ylonen and S. Lehtinen, January 2001, draft-ietf-secsh-filexfer-00.txt, work in progress material, SSH File Transfer Protocol

Copied to clipboard
free 100$ digital ocean credit