COMMANDS
When sftp2 is ready to accept commands, it will display
the prompt sftp> . The user can then enter any of the
following commands.
open -l or open hostname
Tries to connect to a host specified with hostname.
With the -l parameter, the "remote" end is opened
to the localhost (without connecting to an sshd2
daemon), after which for example ls can be used to
show the contents of the local file system.
lopen -l or lopen hostname
Tries to connect to a host specified with hostname.
With the -l parameter, the "local" end is opened to
the localhost (without connecting to an sshd2 dae-
mon), after which for example lls can be used to
show the contents of the local file system. The
command localopen is a synonym for this command.
close Closes the remote connection.
lclose Closes the local connection.
quit Quits the application.
cd directory
Changes the current remote working directory.
lcd directory
Changes the current local working directory.
pwd Prints the name of the current remote working
directory.
lpwd Prints the name of the current local working direc-
tory.
ls [-R] [-l [-z]] [-S] [-r] [file ...]
Lists the names of the files on the remote server.
For directories, the contents of the directory are
listed. When the -R option is specified, all direc-
tories are listed recursively. (By default, the
subdirectories of the argument directories are not
visited.) With -l, permissions, owners, sizes and
modification times are displayed. With -z, the long
format listing is generated by the client, other-
wise sftp2 shows the server generated string, if
available (with the server generated string, times-
tamps are in the server's locale; however, the
client generated string doesn't have usernames or
groups (this is a limitation in the SFTPv3 proto-
col)). This behaviour can be made default by set-
ting environment variable SSH_SFTP_LS_LONG_FORMAT
to "client" (without the quotes). If -S is given,
sorting is done based on file sizes (default:
alphabetically). If -r is given, the sort order is
reversed. When no file arguments are given, the
contents of the current working directory are
listed.
lls [options] [ file ... ]
Same as ls, but operates on local files.
get [--preserve-attributes] [-p] [--overwrite] [-I]
[--interac- tive] [--whole-file] [-W] [--checksum]
[-c] [--force-lower-case] [file ...]
Transfers the specified files from the remote end
to the local end. Directories are recursively
copied with their contents. If -p,--preserve-
attributes is given, sftp tries to retain permis-
sions and timestamps. --overwrite specifies whether
to overwrite existing destination file(s). Default
is to overwrite. -I,--interactive prompts whether
to overwrite an existing destination file (does not
work with batch mode). --force-lower-case will
cause the destination filename to be in lower case.
Only ASCII characters will be affected. If
-W,--whole-file is given, incremental checksums are
not made. If -c,--checksum is given, and source and
destination files have the same size, an MD5 check-
sum is done to determine whether the file needs to
be transferred (default: do checksum). All switches
can be toggled with no as an attribute [example:
--checksum=no].
mget [options] [file ...]
Synonymous to get.
put [options] [file ...]
Transfers the specified files from the local end to
the remote end. Directories are recursively copied
with their contents. Options are the same as for
get.
mput [options] [file ...]
Synonymous to put.
sget [--preserve-attributes] [-p] [--overwrite] [-I]
[--interac- tive] [--whole-file] [-W] [--checksum]
[-c] [--force-lower-case] source_file destina-
tion_file
Transfers single file from the remote end to the
local end. Directories are not copied. Globbing is
not performed. If -p,--preserve-attributes is
given, sftp tries to retain permissions and times-
tamps. --overwrite specifies whether to overwrite
existing destination file(s). Default is to over-
write. -I,--interactive prompts whether to over-
write an existing destination file (does not work
with batch mode). --force-lower-case will cause the
destination filename to be in lower case. Only
ASCII characters will be affected. If -W,--whole-
file is given, incremental checksums are not made.
If -c,--checksum is given, and source and destina-
tion files have the same size, an MD5 checksum is
done to determine whether the file needs to be
transferred (default: do checksum). All switches
can be toggled with no as an attribute [example:
--checksum=no].
sput [options] source_file destination_file
Transfers single file from the local end to the
remote end. Directories are not copied. Globbing
is not performed. Options are the same as for sget.
rename source target
Renames the file source to target. If target
already exists, the files are left intact.
lrename source target
Same as rename, but operates on local files.
rm file
Tries to delete the specified file.
lrm file
Same as rm, but operates on local files.
mkdir directory
Tries to create the specified directory.
lmkdir directory
Same as mkdir, but operates on local files.
rmdir directory
Tries to delete the specified directory.
lrmdir directory
Same as rmdir, but operates on local files.
help [topic]
Lists online help on topic. If topic is not given,
lists the available topics.
lsroots
Dumps the virtual roots of the server. This is an
extension required by older versions of VShell
(from VanDyke Software), and only usable against
it. SSH Tectia Server (Windows version) displays
the file system roots in the Unix style, and does
not require this extension.
ascii [-s] [-f] [<remote_nl_conv>] [<local_nl_conv>]
With the -s option, shows the current newline con-
vention. <remote_nl_conv> sets the remote newline
convention. <local_nl_conv> operates on the local
side, but is not as useful (the correct local new-
line convention is usually compiled in, so this is
mainly for testing). Please note that these are
only hints for the underlying transfer layer, which
tries to use the newline convention given by the
server wherever possible. You can set either of
these to ask, which will cause sftp to prompt you
for the newline convention when needed. With the
exception of the -s option, this command sets the
transfer mode to ASCII, i.e. newlines will be con-
verted according to the conventions. Available con-
ventions are dos, unix, and mac, using "\r\n",
"\n", and "\r" as newlines, respectively.
binary Files will be transferred unmodified.
auto Files whose extension matches the one set with
setext will be transferred using ASCII mode. Other
files will be transferred unmodified.
setext <extension> [<extension> ...]
Set the file types which will be transferred in
ASCII mode, if the transfer mode is auto. Standard
zsh-fileglob regexs can be used for matching (only
the file extension is matched, i.e. extension "*ml"
matches with files foo.html and bar.ml.
getext Displays the extensions of files which will be
transferred using ASCII (newline) conversion in the
auto transfer mode.
chmod [options] OCTAL-MODE [<file> ...]
chmod [options] [ugoa][+-=][rwxs] [<file> ...]
Sets file permissions of the specified file or
files to the bit pattern OCTAL-MODE or changes per-
missions according to the symbolic mode
[ugoa][+-=][rwxs].
Only one symbolic mode combination is supported.
Options are:
-R recursive (recursively changes files and
directories
-f silent (error messages suppressed)
-v verbose (lists every file processed)
lchmod Same as chmod, but operates on local files
! [<command> [<args>]]
Invoke an interactive shell on the local machine.
If <command> is given, it is used as the command to
be executed. Optional <args> are used as arguments
to the command.
|