ftp(1) General Commands Manual ftp(1)
NAME
ftp - file transfer program
SYNOPSIS
size] [server-host]
DESCRIPTION
is a user interface to the File Transfer Protocol. copies files over a network connection between the local "client" host and a remote
"server" host. runs on the client host.
Options
The command supports the following options:
Disable file name "globbing"; see the
command, below. By default, when this option is not specified, globbing is enabled.
Disable interactive prompting by multiple-file commands; see the
command, below. By default, when this option is not specified, prompting is enabled.
Disable "auto-login"; see the
command, below. By default, when this option is not specified, auto-login is enabled.
When this option is set, the
and calls are not made by the client to the server upon establishing a connection. The option takes effect only when auto-
login is disabled, on other words, when it is invoked along with the option. This option does not disable the and commands,
but only refrains from invoking these commands upon establishing a connection.
Enable verbose output; see the
command, below. If this option is not specified, displays verbose output only if the standard input is associated with a
terminal.
Enable passive mode of operation.
Also, refer to the command in the section below. When this option is not specified, by default the passive mode is disabled.
Disables Kerberos authentication and authorization. Only
applicable in a secure environment based on Kerberos V5. When this option is specified, a password is required and the pass-
word is sent across the network in a readable form. By default, if this option is not specified, a password is not required
and Kerberos authentication and authorization takes place instead. See sis(5).
In the IPv6 environment, enable the use of LPRT and LPSV commands for data
connection. In this environment, by default uses EPRT and EPSV. In the IPv4 environment PORT and PASV commands are used.
Set the buffer size of the data socket to
size blocks of 1024 bytes. The valid range for size is an integer from 1 to 2097151 (default is 56).
Note: A large buffer size will improve the performance of on fast links, but may cause long connection times on slow links
(e.g., X.25).
Note: If the buffer size needs to be set to any value other than multiples of 1024 bytes, use immediately after size without
any space. The size value will be taken in terms of bytes. For example, to set the buffer size to a value equal to "1500",
use
The name of the server host that communicates with can be specified on the command line. If the server host is specified, immediately
opens a connection to the server host; see the command, below. Otherwise, waits for commands from the user.
The option can be set in the file within Refer to the krb5.conf(4) manpage for more information on the If is set to true and the kerberos
authentication fails, will use the non-secure mode of authentication.
Note: Command line options override the configuration file options.
File Transfer Protocol specifies file transfer parameters for type, mode, form, and struct. supports the and File Transfer Protocol types.
is the default FTP type. (It should be noted though that, whenever establishes a connection between two similar systems, it switches auto-
matically to the more efficient type.) supports only the default values for the file transfer parameters mode which defaults to form which
defaults to and struct which defaults to
COMMANDS
supports the following commands. Command arguments with embedded spaces must be enclosed in quotes (for example, "argument with embedded
spaces").
Invoke a shell on the local host.
The environment variable specifies which shell program to invoke. invokes if is undefined. If command is specified, the shell exe-
cutes it and returns to Otherwise, an interactive shell is invoked. When the shell terminates, it returns to
Execute the macro
macro-name that was defined with the command. Arguments are passed to the macro unglobbed.
Supply a supplemental password required by a remote system
for access to resources once a login has been successfully completed. If no argument is included, the user is prompted for an
account password in a non-echoing input mode.
Copy local-file to the end of remote-file. If remote-file is left unspecified, the local file name is used in naming the remote file
after being altered by any ntrans or nmap setting.
Set the file transfer
type to network ASCII. This is the default type.
Sound a bell after each file transfer completes.
Set the file transfer
type to
Close the connection to the server host if a connection was open,
and exit. Typing an end-of-file (EOF) character also terminates and exits the session.
Toggle remote computer file name case mapping during
commands. When is on (the default is off), remote computer file names with all letters in uppercase are written in the local direc-
tory with the letters mapped to lowercase.
Set the working directory on the server host to
remote-directory.
Set the working directory on the server host to the parent of the
current remote working directory.
Change the permission modes of the file
file-name on the remote system to mode.
Terminate the connection to the server host.
The command does not exit Any defined macros are erased.
Toggle carriage return stripping during
type file retrieval. Records are denoted by a carriage-return/line-feed sequence during type file transfer. When is on (the
default), carriage returns are stripped from this sequence to conform with the UNIX single line-feed record delimiter. Records on
non-UNIX remote systems may contain single line-feeds; when an type transfer is made, these line-feeds can be distinguished from a
record delimiter only when is off.
Delete remote-file. The remote-file can be an empty directory. No globbing is done.
Write a
remote-directory listing to standard output or optionally to local-file. If neither remote-directory nor local-file is specified,
list the remote working directory to standard output. If interactive prompting is on, prompts the user to verify that the last
argument is indeed the target file for output. Globbing characters are always expanded.
A synonym for
Toggle the use of the
commands for data connection in the IPv6 environment. By default, the commands are used in the IPv6 environment. In the IPv4 envi-
ronment commands are used.
Set the file transfer
form to format. The only supported format is
Copy remote-file to local-file. If local-file is unspecified, uses the specified remote-file name as the local-file name, subject to
alteration by the current case, ntrans, and nmap settings.
Toggle file name globbing.
When file name globbing is enabled, expands csh(1) metacharacters in file and directory names. These characters are and The server
host expands remote file and directory names. Globbing metacharacters are always expanded for the and commands. If globbing is
enabled, metacharacters are also expanded for the multiple-file commands and
Toggle printing of a hash-sign
for each 1024 bytes transferred. Note that the use of this feature may cause performance degradation.
Print an informative message about the
command called ftp-command. If ftp-command is unspecified, print a list of all commands.
Set the inactivity timer on the remote server to
seconds seconds. If seconds is omitted, prints the current inactivity timer.
Set the local working directory to
local-directory. If local-directory is unspecified, set the local working directory to the user's local home directory.
Write a listing of
remote-directory to local-file. The listing includes any system-dependent information that the server chooses to include. For
example, most UNIX systems, including HP-UX, produce output from the command (see also If neither remote-directory nor local-file is
specified, list the remote working directory. If globbing is enabled, globbing metacharacters are expanded.
Define a macro.
Subsequent lines are stored as the macro macro-name; an empty input line terminates macro input mode. There is a limit of 16 macros
and 4096 total characters in all defined macros. Macros remain defined until a command is executed. The macro processor interprets
and as special characters. A followed by a number (or numbers) is replaced by the corresponding argument on the macro invocation
command line. A followed by an i signals to the macro processor that the executing macro is to be looped. On the first pass is
replaced by the first argument on the macro invocation command line, on the second pass it is replaced by the second argument, and
so on. A followed by any character is replaced by that character. Use the to prevent special treatment of the
Delete remote-files. If globbing is enabled, globbing metacharacters are expanded.
Write a listing of
remote-files to local-file. If globbing is enabled, globbing metacharacters are expanded. If interactive prompting is on, prompts
the user to verify that the last argument is indeed the target local file for output.
Copy remote-files to the local system. If globbing is enabled, globbing metacharacters are expanded. The resulting local file names are
processed according to case, ntrans, and nmap settings.
Create remote
directory-name.
Write an abbreviated listing of
remote-files to local-file. If globbing is enabled, globbing metacharacters are expanded. If interactive prompting is prompts the
user to verify that the last argument is indeed the target local file for output.
Set the
FTP file transfer mode to mode-name. The only supported mode is
Show the last modification time of
remote-file.
Copy local-files from the local system to the remote system. The remote files have the same name as the local files processed according
to ntrans and nmap settings. If globbing is enabled, globbing characters are expanded.
Get the file only if the modification time of the remote file
is more recent that the file on the current system. If the file does not exist on the current system, the remote file is considered
newer. Otherwise, this command is identical to
Write an abbreviated listing of
remote-directory to local-file. If remote-directory is left unspecified, the current working directory is used. If interactive
prompting is on, prompts the user to verify that the last argument is indeed the target local file for output.
Set or unset the filename mapping mechanism.
If no arguments are specified, the filename mapping mechanism is unset. If arguments are specified, remote filenames are mapped
during commands and commands issued without a specified remote target filename. If arguments are specified, local filenames are
mapped during commands and 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. inpattern is a template for incoming filenames (which may have already been processed according to the and settings).
Variable templating is accomplished by including the sequences in inpattern. Use to prevent this special treatment of the charac-
ter. All other characters are treated literally, and are used to determine the inpattern variable values. For example, given
inpattern and the remote file name would have the value and would have the value The outpattern determines the resulting mapped
filename. The sequences are replaced by any value resulting from the inpattern template. The sequence is replaced by the original
filename. Additionally, the sequence is replaced by seq1 if seq1 is not a null string; otherwise it is replaced by seq2. For exam-
ple, the command would yield the output filename for input filenames and for the input filename and for the input filename Spaces
can be included in outpattern, as in the example: Use the character to prevent special treatment of the and characters.
Set or unset the filename character translation mechanism.
If no arguments are specified, the filename character translation mechanism is unset. If arguments are specified, characters in
remote filenames are translated during commands and commands issued without a specified remote target filename. If arguments are
specified, characters in local filenames are translated during commands and commands issued without a specified local target file-
name. 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 charac-
ter's position in inchars is longer than the length of outchars, the character is deleted from the file name.
Establish a connection to
server-host, using port-number (if specified). If auto-login is enabled, attempts to log into the server host.
Toggle passive mode of transfer. By default, the
passive mode of transfer is disabled. This command enables the server to specify the data port for the ftp transfer.
Toggle interactive prompting.
By default, prompts the user for a yes or no response for each output file during multiple-file commands. If interactive prompting
is disabled, performs the command for all specified files.
Execute an
command on a secondary control connection. This command allows simultaneous connection to two remote FTP servers for transferring
files between the two servers. The first command should be an to establish the secondary control connection. Enter the command to
see other FTP commands executable on the secondary connection. The following commands behave differently when prefaced by does not
define new macros during the auto-login process, does not erase existing macro definitions, and transfer files from the host on the
primary control connection to the host on the secondary control connection, and and 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 proto-
col command by the server on the secondary control connection.
Copy local-file to remote-file. If remote-file is unspecified, assigns the local-file name, processed according to any ntrans or nmap
settings, to the remote-file name.
Write the name of the remote working directory to
stdout.
A synonym for
Send arguments, verbatim, to the server host. See ftpd(1M).
A synonym for
acts like
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 tend to drop connections.
Request help from the server host.
If command-name is specified, supply it to the server. See ftpd(1M).
With no arguments, show status of remote machine.
If file-name is specified, show status of file-name on remote machine.
Rename remote-from, which can be either a file or a directory, to remote-to.
Clear reply queue.
This command re-synchronizes command/reply sequencing with the remote FTP server. Resynchronization may be necessary following a
violation of the FTP protocol by the remote server.
Restart the immediately following
or at the indicated marker. On UNIX systems, marker is usually a byte offset into the file.
Delete remote-directory. remote-directory must be an empty directory.
Toggle storing of files on the local system with unique filenames.
If a file already exists with a name equal to the target local filename for a or command, a is appended to the name. If the result-
ing name matches another existing file, a is appended to the original name. If this process continues up to an error message is
printed, and the transfer does not take place. reports the unique filename. Note that does not affect local files generated from a
shell command (see below). The default value is
A synonym for
Toggle the use of
commands. By default, attempts to use a command when establishing a connection for each data transfer. If the command fails, uses
the default data port. When the use of commands is disabled, makes no attempt to use commands for each data transfer. This is use-
ful for certain FTP implementations that ignore commands but (incorrectly) indicate that they've been accepted. See ftpd(1M).
Turning off may cause delays in the execution of commands.
Send arguments, verbatim, to the server host as a command. See ftpd(1M).
Show the size of
remote-file.
Show the current status of
Set the
FTP file transfer struct to struct-name. The only supported struct is
Toggle storing of files on remote machine under unique file names.
The remote server reports the unique name. By default, is
Show the type of operating system running on the remote machine.
Set the
FTP file transfer type to
Set the
FTP file transfer type to type-name. If type-name is unspecified, write the current type to stdout. and are the types currently
supported.
Set the default umask on the remote server to
newmask. If newmask is omitted, the current umask is printed.
Log into the server host on the current connection,
which must already be open. A file in the user's local home directory can provide the user-name, password, and optionally the
account; see netrc(4). Otherwise prompts the user for this information. The HP-UX FTP server does not require an account. For
security reasons, always requires a password. It does not log into remote accounts that do not have a password.
In a secure environment based on Kerberos V5, will not require a password. Instead, Kerberos authentication and authorization will
be performed as described in sis(5). In all other environments, users are considered authenticated if they have a password and that
password is correct, and authorized if an account exists for them on the remote system.
Toggle verbose output.
If verbose output is enabled, displays responses from the server host, and when a file transfer completes it reports statistics
regarding the efficiency of the transfer.
A synonym for the
command. Prints the information for the specified command.
Aborting A File Transfer
To abort a file transfer, use the terminal interrupt key (usually Sending transfers are halted immediately. halts incoming (receive)
transfers by first sending a FTP protocol command to the remote server, then discarding any further received data. The speed at which this
is accomplished depends upon the remote server's support for processing. If the remote server does not support the command, an prompt does
not appear until the remote server completes sending the requested file.
The terminal interrupt key sequence is ignored while awaits a reply from the remote server. A long delay in this mode may result from the
processing described above, or from unexpected behavior by the remote server, including violations of the FTP protocol. If the delay
results from unexpected remote server behavior, the local program must be killed manually.
File Naming Conventions
Files specified as arguments to commands are processed according to the following rules.
o If the file name is specified, uses the standard input (for reading) or standard output (for writing).
o If the first character of the file name is interprets the remainder of the argument as a shell command. forks a shell, using (see
popen(3S)) with the supplied argument, and reads (writes) from standard output (standard input). If the shell command includes spaces,
the argument must be quoted, as in:
Some useful examples of this mechanism are:
The above command lists the files in the current directory page by page.
This command copies the last twenty lines of the local file "loc_file" to the remote system as "rem_file".
o Otherwise, if globbing is enabled, expands local file names according to the rules used by the C shell (see csh(1)); see the command,
below. If the command expects a single local file (e.g., only the first filename generated by the globbing operation is used.
o For commands and commands with unspecified local file names, the local filename is named the same as the remote filename, which may be
altered by a or setting. The resulting filename may then be altered if is on.
o For commands and commands with unspecified remote file names, the remote filename is named the same as the local filename, which may be
altered by a or setting. The resulting filename may then be altered by the remote server if is on.
WARNINGS
Correct execution of many commands depends upon proper behavior by the remote server.
DIAGNOSTICS
There are two authentication mechanisms used by
One authentication mechanism is based on Kerberos and the other is not. The type of authentication mechanism is obtained from a
system file which is updated by (see inetsvcs_sec(1M)). If the system file does not contain known authentication types, the above
error is displayed.
AUTHOR
was developed by the University of California, Berkeley.
SEE ALSO
csh(1), rcp(1), ftpd(1M), inetsvcs_sec(1M), ftpusers(4), hosts(4), krb5.conf(4), netrc(4), sis(5).
ftp(1)