Name

sftp (host | username@host) — openssh-clients

Synopsis

/usr/bin stdin stdout - file -- opt --help --version

The sftp program copies files interactively between two computers. (As opposed to scp, which copies files in batch.) The user interface is much like that of ftp.

$ sftp remote.example.com
Password: ********
sftp> cd MyFiles
sftp> ls
README
file1
file2
file3
sftp> get file2
Fetching /home/smith/MyFiles/file2 to file2
sftp> quit

If your username on the remote system is different from your local one, use the username@host argument:

$ sftp smith@remote.example.com

Command

Meaning

help

View a list of available commands.

ls

lls

List the files in the current remote (ls) or local (lls) directory.

pwd

lpwd

Print the remote (pwd) or local (lpwd) working directory.

cd dir

lcd dir

Change your remote (cd) or local (lcd) directory to be dir.

get file1 [file2]

Copy remote file1 to local machine, optionally renamed as file2.

put file1 [file2]

Copy local file1 to remote machine, optionally renamed as file2.

mget file*

Copy multiple remote files to the local machine using wildcards * and ?.

mput file*

Copy multiple local files to the remote machine using wildcards * and ?.

quit

Exit sftp.

Get Linux Pocket Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.