The client host with which ftp is to communicate may be specified on the command line. If this is done, ftp will immediately attempt to establish a connection to an FTP server on that host; otherwise, it will enter its command interpreter and await instructions from the user. When ftp is awaiting commands from the user the prompt ‘ftp>’ is provided to the user. The following commands are recognized by ftp:
! [
command [
args]]
$
macro-name [
args]
account [
passwd]
append
local-file [
remote-file]
ntrans
or
nmap
setting. File transfer uses the current settings for
type, format, mode, and structure.
ascii
bell
binary
bye
quit
case
mget
commands. When case is on (default is off), remote computer file
names with all letters in upper case are written in the local
directory with the letters mapped to lower case.
cd
remote-directorycdup
chmod
mode file-nameclose
disconnect
cr
cr
is on (the default),
carriage returns are stripped from this sequence to conform with the
UNIX single linefeed record delimiter. Records on non-UNIX remote
systems may contain single linefeeds; when an ASCII type transfer is
made, these linefeeds may be distinguished from a record delimiter
only when cr is off.
delete
remote-filedebug [
debug-value]
dir [
remote-directory] [
local-file]
epsv4
form
formatget
remote-file [
local-file]
recv
remote-file [
local-file]
case
, ntrans
, and nmap
settings. The current
settings for type, form, mode, and structure are used while
transferring the file.
glob
mdelete
, mget
and
mput
. If globbing is turned off with glob
, the file
name arguments are taken literally and not expanded. Globbing for
mput
is done as in csh. For mdelete
and
mget
, each remote file name is expanded separately on the
remote machine and the lists are not merged. Expansion of a directory
name is likely to be different from expansion of the name of an
ordinary file: the exact result depends on the foreign operating
system and FTP server, and can be previewed by doing mls
remote-files -
.
Note: mget
and mput
are not meant to transfer entire
directory subtrees of files. That can be done by transferring a
tar archive of the subtree (in binary mode).
hash [
size]
help [
command]
? [
command]
idle [
seconds]
ipv4
ipv6
ipany
lcd [
directory]
ls [
remote-directory] [
local-file]
macdef
macro-namemdelete [
remote-files]
mdir
remote-files local-filedir
, except multiple remote files may be specified. If
interactive prompting is on, ftp will prompt the user to
verify that the last argument is indeed the target local file for
receiving mdir
output.
mget
remote-filescase
, ntrans
, and nmap
settings. Files are transferred into the local working directory,
which can be changed with lcd directory
; new local directories
can be created with ! mkdir directory
.
mkdir
directory-namemls
remote-files local-filenlist
, except multiple remote files may be specified, and
the local-file must be specified. If interactive prompting is
on, ftp will prompt the user to verify that the last
argument is indeed the target local file for receiving mls
output.
mode [
mode-name]
modtime
file-namemput
local-filesntrans
and nmap
settings.
newer
file-namenlist [
remote-directory] [
local-file]
nmap [
inpattern outpattern]
mput
commands and
put
commands issued without a specified remote target filename.
If arguments are specified, local filenames are mapped during
mget
commands and get
commands issued without a
specified local target filename. This command is useful when
connecting to a non-UNIX remote computer with different file naming
conventions or practices.
The mapping follows the pattern set by inpattern and
outpattern. The template inpattern is used for incoming
filenames (which may have already been processed according to the
ntrans
and case settings). Variable templating is accomplished
by including the sequences ‘$1’, ‘$2’, ..., ‘$9’ in
inpattern. Use ‘\’ to prevent this special treatment of
the ‘$’ character. All other characters are treated literally,
and are used to determine the nmap
inpattern variable
values.
For example, given inpattern ‘$1.$2’ and the remote file name mydata.data, ‘$1’ would have the value ‘mydata’, and ‘$2’ would have the value ‘data’. The outpattern determines the resulting mapped filename. The sequences ‘$1’, ‘$2’, ...., ‘$9’ are replaced by any value resulting from the inpattern template. The sequence ‘$0’ is replaced by the original filename. Additionally, the sequence ‘[seq1, seq2]’ is replaced by seq1 if seq1 is not a null string; otherwise it is replaced by seq2. For example, the command
nmap $1.$2.$3 [$1,$2].[$2,file]
would yield the output filename myfile.data for input filenames myfile.data and myfile.data.old, myfile.file for the input filename myfile, and myfile.myfile for the input filename .myfile.
Spaces may be included in outpattern, as in the example:
nmap $1 sed "s/ *$//" > $1
. Use the ‘\’ character to
prevent special treatment of the ‘$’, ‘[’, ‘]’, and
‘,’ characters.
ntrans [
inchars [
outchars]]
mput
commands and put
commands
issued without a specified remote target filename. If arguments are
specified, characters in local filenames are translated during
mget
commands and get
commands issued without a
specified local target filename. This command is useful when
connecting to a non-UNIX remote computer with different file naming
conventions or practices.
Characters in a filename matching a character in inchars are
replaced with the corresponding character in outchars. If the
character's position in inchars is longer than the length of
outchars, the character is deleted from the file name.
open
host [
port]
autologin
option
is on (default), ftp will also attempt to automatically log
the user in to the FTP server.
passive
PASV
command for all data
connections instead of the usual PORT
command. The PASV
command requests that the remote server open a port for the data
connection and return the address of that port. The remote server
listens on that port and the client connects to it. When using the
more traditional PORT
command, the client listens on a port and
sends that address to the remote server, who connects back to it.
Passive mode is useful when using ftp through a gateway
router or host that controls the directionality of traffic. (Note
that though ftp servers are required to support the
PASV
command by RFC 1123, some do not.) If epsv4
has been set to on, the client will attempt EPSV
before
PASV
for IPv4. As a last resort LPSV
is attempted.
With IPv6 only EPSV
and LPSV
are possible.
prompt
mget
or mput
will transfer all files, and any
mdelete
will delete all files.
proxy
ftp-commandproxy ?
to see other ftp
commands executable on the secondary connection. The following
commands behave differently when prefaced by proxy
: open
will not define new macros during the auto-login process, close
will not erase existing macro definitions, get
and mget
transfer files from the host on the primary control connection to the
host on the secondary control connection, and put
, mput
,
and append
transfer files from the host on the secondary
control connection to the host on the primary control connection.
Third party file transfers depend upon support of the FTP protocol
PASV
command by the server on the secondary control connection.
put
local-file [
remote-file]
send
local-file [
remote-file]
ntrans
or nmap
settings in naming the
remote file. File transfer uses the current settings for type,
format, mode, and structure.
pwd
quote
arg...
reget
remote-file [
local-file]
Reget
acts like get
, except that if local-file
exists and is smaller than remote-file, local-file is
presumed to be a partially transferred copy of remote-file and
the transfer is continued from the apparent point of failure. This
command is useful when transferring very large files over networks
that are prone to dropping connections.
remotehelp [
command-name]
remotestatus [
file-name]
rename [
from] [
to]
reset
restart
markerget
or put
at the
indicated marker. On UNIX systems, marker is usually a byte offset
into the file.
rmdir
directory-namerunique
get
or mget
command, a ‘.1’ is appended to
the name. If the resulting name matches another existing file, a
‘.2’ is appended to the original name. If this process continues
up to ‘.99’, an error message is printed, and the transfer does
not take place. The generated unique filename will be reported. Note
that runique
will not affect local files generated from a shell
command. The default value is off.
sendport
PORT
commands. By default, ftp
will attempt to use a PORT
command when establishing a
connection for each data transfer. The use of PORT
commands
can prevent delays when performing multiple file transfers. If the
PORT
command fails, ftp will use the default data
port. When the use of PORT
commands is disabled, no attempt
will be made to use PORT
commands for each data transfer. This
is useful for certain FTP implementations which do ignore PORT
commands but, incorrectly, indicate they've been accepted.
site
arg...
SITE
command.
size
file-namestatus
struct [
struct-name]
sunique
STOU
command for
successful completion. The remote server will report unique name.
Default value is off.
system
tenex
trace
type [
type-name]
umask [
newmask]
user
user-name [
password] [
account]
auto-login
disabled, this process
is done automatically on initial connection to the FTP server.
verbose
Command arguments which have embedded spaces may be quoted with quote ‘"’ marks.