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 INTERPRETATION
sftp2 understands both backslashes and quotation marks on
the command line. A backslash can be used for ignoring the
special meaning of any character in the command-line
interpretation. It will be removed even if the character
it precedes has no special meaning.
Quotation marks can be used for specifying file names with
spaces.
The command-line processing and globbing use the same
escape character (a backslash), so if you want to use a
backslash to escape the meta-characters in the globbing,
you have to precede the backslash with another backslash
to escape its special meaning from the command-line pro-
cessor.
Warning: If you do get . or put . you will get or put
every file in the current directory and possibly override
files in your current directory.
GLOB PATTERNS
sftp2 supports glob patterns (wildcards) given to commands
ls, lls, get, and put. The format is described in the man
page sshregex(1).
COMMAND-LINE EDITING
The following key sequences can be used for command-line
editing:
Ctrl-Space
Set mark.
Ctrl-A Go to the beginning of the line.
Ctrl-B Move the cursor one character to the left.
Ctrl-D Erase the character to the right of the cursor, or
exit the program if the command line is empty.
Ctrl-E Go to the end of the line.
Ctrl-F Move the cursor one character to the right.
Ctrl-H Backspace.
Ctrl-I Tab.
Ctrl-J Enter.
Ctrl-K Delete the rest of the line.
Ctrl-L Redraw the line.
Ctrl-M Enter.
Ctrl-N Move to the next line.
Ctrl-P Move to the previous line.
Ctrl-T Toggle two characters.
Ctrl-U Delete the line.
Ctrl-W Delete a region (the region's other end is marked
with Ctrl-Space).
Ctrl-X Begin an extended command.
Ctrl-Y Yank deleted line.
Ctrl-_ Undo.
Ctrl-X Ctrl-L
Lower case region.
Ctrl-X Ctrl-U
Upper case region.
Ctrl-X Ctrl-X
Exchange cursor and mark.
Ctrl-X H
Mark the whole buffer.
Ctrl-X U
Undo.
Esc Ctrl-H
Backwards word delete.
Esc Delete
Backwards word delete.
Esc Space
Delete extra spaces (leaves only one space).
Esc < Go to the beginning of the line.
Esc > Go to the end of the line.
Esc @ Mark current word.
Esc A Go back one sentence.
Esc B Go back one word.
Esc C Capitalize current word.
Esc D Delete current word.
Esc E Go forward one sentence.
Esc F Go forward one word.
Esc K Delete current sentence.
Esc L Change current word to lower case.
Esc T Transpose words.
Esc U Change current word to upper case.
Delete Backspace.
AUTHORS
SSH Communications Security Corp.
For more information, see http://www.ssh.com.
SEE ALSO
sshregex(1), ssh2(1), sshd2(8), ssh-keygen2(1), ssh-
agent2(1), ssh-add2(1), scp2(1)
|