sftp [[user@]host[:file [file]]]
sftp is an interactive file transfer program, similar to ftp, which performs all operations over an encrypted secsh transport. It may also use many features of secsh, such as public key authentication and compression. sftp connects and logs into the specified host, then enters an interactive command mode.
The second usage format will retrieve files automatically if a non-interactive authentication is used; otherwise, it will do so after successful interactive authentication.
The third usage format allows the sftp client to start in a remote directory.
The final usage format allows for automated sessions using the
Since some usage formats use colon characters to delimit host names from path names, IPv6 addresses must be enclosed in square brackets to avoid ambiguity.
Specifies the use of protocol version 1.
Specifies the use of protocol version 2.
Forces sftp to use IPv4 addresses only.
Forces sftp to use IPv6 addresses only.
Specifies the size of the buffers that sftp uses when transferring files. Larger buffers require fewer round trips at the cost of higher memory consumption. The default is 32768 bytes.
Batch mode reads a series of commands from an input batchfile instead of stdin. Since it lacks user interaction it should be used in conjunction with non-interactive authentication. sftp will abort if any of the following commands fail: get, put, rename, ln, rm, and lmkdir.
Enables compression (via secsh's
Selects the cipher to use for encrypting the data transfers. This option is directly passed to secsh.
Connect directly to a local sftp server (rather than via secsh). This option may be useful in debugging the client and server.
Selects the file from which the identity (private key) for public key authentication is read. This option is directly passed to secsh.
-ooption to secsh can be specified, and it is directly passed through when secsh is invoked. This is useful for specifying options for which there is no separate sftp command-line flag. For example, to specify an alternate port:
Specifies the port to connect to on the remote host.
Preserves modification times, access times, and modes from the original files transferred.
Quiet mode: disables the progress meter as well as warning and diagnostic messages from secsh.
Specifies how many requests may be outstanding at any one time. Increasing this may slightly improve file transfer speed but increases memory usage. The default is 64 outstanding requests.
Recursively copy entire directories when uploading and downloading. Note that sftp does not follow symbolic links encountered in the tree traversal.
Specifies the SSH2 subsystem or the path for an sftp server on the remote host. A path is useful for using sftp over protocol version 1, or when the remote secshd does not have an sftp subsystem configured.
Specifies the name of the program to use for the encrypted connection. The program must understand secsh options.
Raises logging level. This option is also passed to secsh.
Once in interactive mode, sftp understands a set of commands similar to those of ftp. Commands are case insensitive and path names may be enclosed in quotes if they contain spaces.
- cd path
Changes remote directory to path.
- lcd path
Changes local directory to path.
- chgrp grp path
Changes group of file path to grp. grp must be a numeric GID.
- chmod mode path
Changes permission of file path to mode.
- chown own path
Changes owner of file path to own. own must be a numeric UID.
- df [
Displays usage information for the file system holding the current directory (or path if specified). When the
-hflag is specified, the capacity information is displayed using "human-readable" suffixes. The -iflag requests display of inode information in addition to capacity information. This command is only supported on servers that implement the email@example.com extension.
- get [flags] remote-path [loacl-path]
Retrieves the remote-path and stores it on the local machine. If the local path name is not specified, it is given the same name it has on the remote machine.
If either the
-Por -pflag is specified, then full file permissions and access times are copied too.
-rflag is specified then directories will be copied recursively. Note that sftp does not follow symbolic links when performing recursive transfers.
Displays help text.
- lls [ls-options] [path]]
Displays local directory listing of either path or current directory if path is not specified.
- lmkdir path
Creates local directory specified by path.
- ln [
-s] oldpath newpath
Creates a link from oldpath to newpath. If the -s flag is specified the created link is a symbolic link, otherwise it is a hard link.
Displays local working directory.
- ls [flags] [path]
Displays remote directory listing of either path or current directory if path is not specified.
The following flags are recognized and alter the behavior of ls accordingly:
Produces single column output.
Lists files beginning with a dot (.).
Does not sort the listing. This default sort is lexicographical.
When used with a long format option, use unit suffixes: Byte, Kilobyte, Megabyte, Gigabyte, Terabyte, Petabyte, and Exabyte in order to reduce the number of digits to four or fewer using powers of 2 for sizes (K=1024, M=1048576, etc.).
Displays additional details including permissions and ownership information.
Produces a long listing with user and group information presented numerically.
Reserves the sort order of the listing.
Sorts the listing by file size.
Sorts the listing by last modification time.
- lumask umask
Sets local umask to umask.
- mkdir path
Creates remote directory specified by path.
- put [flags] local-path [local-path]
Uploads local-path and stores it on the remote machine. If the remote path name is not specified, it is given the same name it has on the local machine. local-path may contain glob characters and may match multiple files. If it does and remote-path is specified, then remote-path must specify a directory. If the
-Pflag is specified, then the file's full permission and access time are copied too.
If either the -P or -p flag is specified, then full file permissions and access times are copied too.If the -r flag is specified then directories will be copied recursively. Note that sftp does not follow symbolic links when performing recursive transfers.
Toggles display of progress meter.
Displays remote working directory.
- rename oldpath newpath
Renames remote file from oldpath to newpath.
- rmdir path
Removes remote directory specified by path.
- rm path
Deletes remote file specified by path.
- symlink oldpath newpath
Create a symbolic link from oldpath to newpath.
Displays sftp protocol version.
- ! command
Executes command in local shell.
Escapes to local shell.
Synonym for help.
Damien Miller <firstname.lastname@example.org>
All UNIX systems. Windows Vista. Windows 7. Windows Server 2008. Windows 8. Windows Server 2012. Windows 10.
There is no binary/text file transfer mode. All files are transferred in binary mode.
There is no file globbing capability. Thus, ls *.tar will not succeed, unless of course you are a sick and twisted individual who names files *.tar.
PTC MKS Toolkit for System Administrators
PTC MKS Toolkit for Developers
PTC MKS Toolkit for Interoperability
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
MKS Toolkit Connectivity Solutions Guide
T. Ylonen and S. Lehtinen, SSH File Transfer Protocol, draft-ietf-secsh- filexfer-00.txt, January 2001, work in progress material.
PTC MKS Toolkit 10.0 Documentation Build 6.