ftp Command

Purpose

Transfers files between a local and a remote host.

Syntax

ftp [ -d ] [ -D DataConnTimeOut ] [ -g ] [ -i ] [ -n ] [ -v ] [ -f ] [ -K ] [ -k realm ] [ -q ] [ -C ] [-s ] [ -M ] [ HostName [ Port ] ]

Description

The ftp command uses the File Transfer Protocol (FTP) to transfer files between the local host and a remote host or between two remote hosts. Remote execution of the ftp command is not recommended.

The FTP protocol allows data transfer between hosts that use dissimilar file systems. Although the protocol provides a high degree of flexibility in transferring data, it does not attempt to preserve file attributes (such as the protection mode or modification times of a file) that are specific to a particular file system. Moreover, the FTP protocol makes few assumptions about the overall structure of a file system and does not provide or allow such functions as recursively copying subdirectories.

Note: If you are transferring files between systems and need to preserve file attributes or recursively copy subdirectories, use the rcp command.

Issuing Subcommands

At the ftp> prompt, you can enter subcommands to perform tasks such as listing remote directories, changing the current local and remote directory, transferring multiple files in a single request, creating and removing directories, and escaping to the local shell to perform shell commands. See the Subcommands section for a description of each subcommand.

If you execute the ftp command and do not specify the HostName parameter for a remote host, the ftp command immediately displays the ftp> prompt and waits for an ftp subcommand. To connect to a remote host, execute the open subcommand. When the ftp command connects to the remote host, the ftp command then prompts for the login name and password before displaying the ftp> prompt again. The ftp command is unsuccessful if no password is defined at the remote host for the login name.

The ftp command interpreter, which handles all subcommands entered at the ftp> prompt, provides facilities that are not available with most file-transfer programs, such as:

These facilities help simplify repetitive tasks and allow you to use the ftp command in unattended mode.

The command interpreter handles file-name parameters according to the following rules:

To end an ftp session when you are running interactively, use the quit or bye subcommand or the End of File (Ctrl-D) key sequence at the ftp> prompt. To end a file transfer before it has completed, press the Interrupt key sequence. The default Interrupt key sequence is Ctrl-C. The stty command can be used to redefine this key sequence.

The ftp command normally halts transfers being sent (from the local host to the remote host) immediately. The ftp command halts transfers being received (from the remote host to the local host) by sending an FTP ABOR instruction to the remote FTP server and discarding all incoming file transfer packets until the remote server stops sending them. If the remote server does not support the ABOR instruction, the ftp command does not display the ftp> prompt until the remote server has sent all of the requested file. Additionally, if the remote server does something unexpected, you may need to end the local ftp process.

Security and Automatic Login

If Standard is the current authentication method:

The ftp command also handles security by sending passwords to the remote host and permits automatic login, file transfers, and logoff.

If you execute the ftp command and specify the host name (HostName) of a remote host, the ftp command tries to establish a connection to the specified host. If the ftp command connects successfully, the ftp command searches for a local $HOME/.netrc file in your current directory or home directory. If the file exists, the ftp command searches the file for an entry initiating the login process and command macro definitions for the remote host. If the $HOME/.netrc file or automatic login entry does not exist or if your system has been secured with the securetcpip command, the ftp command prompts the user for a user name and password. The command displays the prompt whether or not the HostName parameter is specified on the command line.

Note: The queuing system does not support multibyte host names.

If the ftp command finds a $HOME/.netrc automatic login entry for the specified host, the ftp command attempts to use the information in that entry to log in to the remote host. The ftp command also loads any command macros defined in the entry. In some cases (for example, when the required password is not listed in an automatic login entry), the ftp command prompts for the password before displaying the ftp> prompt.

Once the ftp command completes the automatic login, the ftp command executes the init macro if the macro is defined in the automatic login entry. If the init macro does not exist or does not contain a quit or bye subcommand, the ftp command then displays the ftp> prompt and waits for a subcommand.

Note: The remote user name specified either at the prompt or in a $HOME/.netrc file must exist and have a password defined at the remote host. Otherwise, the ftp command fails.

If Kerberos 5 is the current authentication method

The ftp command will use the extensions to ftp specifications as defined in IETF draft document "draft-ietf-cat-ftpsec-09.txt". The FTP security extensions will be implemented using the Generic Security Service API (GSSAPI) security mechanism. The GSSAPI provides services independent to the underlying security and communication mechanism. The GSSAPI is defined in rfc 1508 and 1509.

The ftp command will use the AUTH and ADAT commands to authenticate with the ftpd daemon. If both support Kerberos authentication, then they will use the local users DCE credentials to authenticate the user on the remote system. If this fails and Standard authentication is configured on both systems, the process described above will be used.

The HostName parameter is the name of the host machine to which files are transferred. The optional Port parameter specifies the ID of the port through which to transmit. (The /etc/services file specifies the default port.)

Note: If the value of the registry is correctly set to the current authentication scheme, the FTP authentication works with the active directory password. If the value of registry is set to null, then the default value of files (local user authentication) is used.

Transport Layer Security support

The ftp command supports Transport Layer Security (TLS) as defined in RFC 4217. TLS is a cryptographic protocol that provides secure communications between clients and servers.

The ftp command uses the AUTH TLS and PROT P commands to secure the communication with the ftpd daemon. If both the AUTH TLS and PROT P commands support the TLS protocol, then a secure channel is established. Only the Standard Authentication method is supported.

If the -s flag is specified when you run the ftp command, then the ftp command searches for a local $HOME/.ftpcnf file in the your home directory. If the file is found, the ftp command uses the following configuration parameters to set up a TLS session with the server. If the file is not found or the configuration parameters are missing, the ftp command attempts to connect to the server without using the configuration parameters.

CRL_PATH
The CRL_PATH parameter provides the path to the certificate revocation list file, which must be in privacy enhanced mail (PEM) format. If specified, the digital certificate that is provided by the server is verified against the certificate revocation list. If the certificate was revoked, the TLS session fails. If not specified, the digital certificate is not verified against a certificate revocation list.
CA_PATH
The CA_PATH parameter provides the path to the certificate authority file, which must be in PEM format. If specified, the server certificate is verified against the certificate authority. If the digital certificate that is provided by the server was not signed by the security authority, the TLS session fails. If not specified, the digital certificate that is provided by the server is not verified against a certificate revocation list.
CIPHER_LIST
If the CIPHER_LIST parameter is specified, the list is used during the TLS session. If not, a default cipher list is used.
DEPHT
If the CA_PATH configuration parameter is specified, the DEPTH value is used to verify the certificate that is provided by the ftpd server in the digital certificate hierarchy. If not provided, a default value of 9 is used.
CERTIFICATE
The CERTIFICATE parameter provides a path to the chain file of a valid digital certificate in PEM format. This file is used in the TLS session.
CERTIFICATE_PRIVATE_KEY
The CERTIFICATE_PRIVATE_KEY parameter contains the path to the certificate private key, in PEM format, which is used during the TLS session. To support TLS, you must install the latest version of the OpenSSL tool from the AIX® Web Download Pack Programs website.

For Trusted AIX system

The user is assigned a default login Sensitivity Label (SL) and Integrity Label (TL), which is the effective SL and effective TL of the user's process after a successful login. If the user does not want to log in at the default login SL, the user can choose to supply a different SL at the login time by using the -e option. The SL supplied by the user must be dominated by the user's clearance and contained in the system accreditation range. The TL cannot be specified by the user at login time. The default login SL and TL are defined in the /etc/security/user file along with the user name and the clearance for each user. To use the -e option, the server side's kernel trusted network bit must be turned off.

Note: Any user with user ID less than or equal to 128 cannot log in to the remote Trusted AIX system.

Flags

Item Description
-C Allows the user to specify that the outgoing file sent using the send_file command must be cached in the Network Buffer Cache (NBC). This flag cannot be used unless the -q flag is specified. This flag is only applicable when a file is being sent out in the binary mode with no protection.
-d Sends debugging information about ftp command operations to the syslogd daemon. If you specify the -d flag, you must edit the /etc/syslog.conf file and add one of the following entries:
user.info FileName

OR

user.debug FileName
Note: The syslogd daemon debug level includes info level messages.

If you do not edit the /etc/syslog.conf file, no messages are produced. After changing the /etc/syslog.conf file, run the refresh -s syslogd or kill -1 SyslogdPID command to inform the syslogd daemon of the changes to its configuration file. For more information about debug levels, refer to the /etc/syslog.conf file. Also, refer to the debug subcommand.

-D DataConnTimeOut

Specifies the maximum number of seconds that the ftp command holds a data connection. The default value is 300 seconds and can range from 300 seconds to 3600 seconds.

-f Causes the credentials to be forwarded. This flag will be ignored if Kerberos 5 is not the current authentication method.
-g Disables the expansion of metacharacters in file names. Interpreting metacharacters can be referred to as expanding (sometimes called globbing) a file name. See the glob subcommand.
-i Turns off interactive prompting during multiple file transfers. See the prompt, mget, mput, and mdelete subcommands for descriptions of prompting during multiple file transfers.
-K Disables the SO_KEEPALIVE option defined in the sys/socket.h file on both the control and data connection.
-k realm Allows the user to specify the realm of the remote station if it is different from the local systems realm. For these purposes, a realm is synonymous with a DCE cell. This flag will be ignored if Kerberos 5 is not the current authentication method.
-n Prevents an automatic login on the initial connection. Otherwise, the ftp command searches for a $HOME/.netrc entry that describes the login and initialization process for the remote host. See the user subcommand.
-q Allows the user to specify that the send_file subroutine must be used for sending the file on the network. This flag is only applicable when a file is being sent out in the binary mode with no protection.
-v Displays all the responses from the remote server and provides data transfer statistics. This display mode is the default when the output of the ftp command is to a terminal, such as the console or a display.

If stdin is not a terminal, the ftp command disables verbose mode unless the user invoked the ftp command with the -v flag or issued the verbose subcommand.

-s Starts a TLS session with the server by sending an AUTH TLS command and a PROT P command to the ftpd daemon. If the TLS session is established, and you are authenticated by using the Standard Authentication method, the transfer of the data and commands is encrypted.
-M Prevents the ftp command from being blocked after a file is transferred between a local and a remote host.

Subcommands

The following ftp subcommands can be entered at the ftp> prompt. Use double quotes (" ") to specify parameters that include blank characters.

Item Description
![Command [Parameters]] Invokes an interactive shell on the local host. An optional command, with one or more optional parameters, can be given with the shell command.
$Macro [Parameters] Executes the specified macro, previously defined with the macdef subcommand. Parameters are not expanded.
?[Subcommand] Displays a help message describing the subcommand. If you do not specify a Subcommand parameter, the ftp command displays a list of known subcommands.
account [Password] Sends a supplemental password that a remote host may require before granting access to its resources. If the password is not supplied with the command, the user is prompted for the password. The password is not displayed on the screen.
append LocalFile [RemoteFile] Appends a local file to a file on the remote host. If the remote file name is not specified, the local file name is used, altered by any setting made with the ntrans subcommand or the nmap subcommand. The append subcommand uses the current values for form, mode, struct, and type subcommands while appending the file.
ascii Synonym for the type ascii subcommand.
bell Sounds a bell after the completion of each file transfer.
binary Synonym for the type binary subcommand.
block Synonym for the mode block subcommand.
bye Ends the file-transfer session and exits the ftp command. Same as the quit subcommand.
carriage-control Synonym for the form carriage-control subcommand.
case Sets a toggle for the case of file names. When the case subcommand is On, the ftp command changes remote file names displayed in all capital letters from uppercase to lowercase when writing them in the local directory. The default is Off (so the ftp command writes uppercase remote file names in uppercase in the local directory).
cd RemoteDirectory Changes the working directory on the remote host to the specified directory.
cdup Changes the working directory on the remote host to the parent of the current directory.
close Ends the file-transfer session, but does not exit the ftp command. Defined macros are erased. Same as the disconnect subcommand.
copylocal Toggles local copy. copylocal defaults to off. An effort is made by ftp to make sure you do not zero out a file by ftp'ing it to itself (eg. same hostname, same pathname). Turning copylocal ON bypasses this check.
cr Strips the carriage return character from a carriage return and line-feed sequence when receiving records during ASCII-type file transfers. (The ftp command terminates each ASCII-type record with a carriage return and line feed during file transfers.)

Records on remote hosts with operating systems other than the one you are running can have single line feeds embedded in records. To distinguish these embedded line feeds from record delimiters, set the cr subcommand to Off. The cr subcommand toggles between On and Off.

debug [0 | 1] Toggles debug record keeping On and Off. Specify debug or debug 1 to print each command sent to the remote host and save the restart control file. Specify debug again, or debug 0, to stop the debug record keeping. The Ctrl-C key sequence also saves the restart control file.

Specifying the debug subcommand sends debugging information about ftp command operations to the syslogd daemon. If you specify the debug subcommand, you must edit the /etc/syslog.conf file and add one of the following entries:

user.info FileName

OR

user.debug FileName
Note: The syslogd daemon debug level includes info level messages.

If you do not edit the /etc/syslog.conf file, no messages are produced. After changing the /etc/syslog.conf file, run the refresh -s syslogd or kill -1 SyslogdPID command to inform the syslogd daemon of the changes to its configuration file. For more information about debug levels, refer to the /etc/syslog.conf file. Also, refer to the ftp -d flag.

delete RemoteFile Deletes the specified remote file.
dir [RemoteDirectory][LocalFile] Writes a listing of the contents of the specified remote directory (RemoteDirectory) to the specified local file (LocalFile). If the RemoteDirectory parameter is not specified, the dir subcommand lists the contents of the current remote directory. If the LocalFile parameter is not specified or is a - (hyphen), the dir subcommand displays the listing on the local terminal.
disconnect Ends the file-transfer session but does not exit the ftp command. Defined macros are erased. Same as the close subcommand.
ebcdic Synonym for the type ebcdic subcommand.
exp_cmd Toggles between conventional and experimental protocol commands. The default is off.
file Synonym for the struct file subcommand.
form [ carriage-control | non-print | telnet ] Specifies the form of the file transfer. The form subcommand modifies the type subcommand to send the file transfer in the indicated form. Valid arguments are carriage-control, non-print, and telnet.
carriage-control
Sets the form of the file transfer to carriage-control.
non-print
Sets the form of the file transfer to non-print.
telnet
Sets the form of the file transfer to Telnet. Telnet is a Transmission Control Protocol/Internet Protocol (TCP/IP) protocol that opens connections to a system.
get RemoteFile [LocalFile] Copies the remote file to the local host. If the LocalFile parameter is not specified, the remote file name is used locally and is altered by any settings made by the case, ntrans, and nmap subcommands. The ftp command uses the current settings for the type, form, mode, and struct subcommands while transferring the file.
glob Toggles file-name expansion (globbing) for the mdelete, mget, and mput subcommands. If globbing is disabled, file-name parameters for these subcommands are not expanded. When globbing is enabled and a pattern-matching character is used in a subcommand that expects a single file name, results may be different than expected.

For example, the append and put subcommands perform file-name expansion and then use only the first file name generated. Other ftp subcommands, such as cd, delete, get, mkdir, rename, and rmdir, do not perform file-name expansion and take the pattern-matching characters literally.

Globbing for the mput subcommand is done locally in the same way as for the csh command. For the mdelete and mget subcommands, each file name is expanded separately at the remote machine and the lists are not merged. The expansion of a directory name can be different from the expansion of a file name, depending on the remote host and the ftp server.

To preview the expansion of a directory name, use the mls subcommand:

mls RemoteFile 

To transfer an entire directory subtree of files, transfer a tar archive of the subtree in binary form, rather than using the mget or mput subcommand.

hash Toggles hash sign (#) printing. When the hash subcommand is on, the ftp command displays one hash sign for each data block (1024 bytes) transferred.
help [Subcommand] Displays help information. See the ? subcommand.
image Synonym for the type image subcommand.
lcd [Directory] Changes the working directory on the local host. If you do not specify a directory, the ftp command uses your home directory.
local M Synonym for the type local M subcommand.
ls [RemoteDirectory] [LocalFile] Writes an abbreviated file listing of a remote directory to a local file. If the RemoteDirectory parameter is not specified, the ftp command lists the current remote directory. If the LocalFile parameter is not specified or is a - (hyphen), the ftp command displays the listing on the local terminal.
macdef Macro Defines a subcommand macro. Subsequent lines up to a null line (two consecutive line feeds) are saved as the text of the macro. Up to 16 macros, containing at most 4096 characters for all macros, can be defined. Macros remain defined until either redefined or a close subcommand is executed.

The $ (dollar sign) and \ (backslash) are special characters in ftp macros. A $ symbol followed by one or more numbers is replaced by the corresponding macro parameter on the invocation line (see the $ subcommand). A $ symbol followed by the letter i indicates that the macro is to loop, with the $i character combination being replaced by consecutive parameters on each pass.

The first macro parameter is used on the first pass, the second parameter is used on the second pass, and so on. A \ symbol prevents special treatment of the next character. Use the \ symbol to turn off the special meanings of the $ and \. (backslash period) symbols.

mdelete RemoteFiles Expands the files specified by the RemoteFiles parameter at the remote host and deletes the remote files.
mdir [RemoteDirectories LocalFile] Expands the directories specified by the RemoteDirectories parameter at the remote host and writes a listing of the contents of those directories to the file specified in the LocalFile parameter. If the RemoteDirectories parameter contains a pattern-matching character, the mdir subcommand prompts for a local file if none is specified. If the RemoteDirectories parameter is a list of remote directories separated by blanks, the last argument in the list must be either a local file name or a - (hyphen).

If the LocalFile parameter is - (hyphen), the mdir subcommand displays the listing on the local terminal. If interactive prompting is on (see the prompt subcommand), the ftp command prompts the user to verify that the last parameter is a local file and not a remote directory.

mget RemoteFiles Expands the RemoteFiles parameter at the remote host and copies the indicated remote files to the current directory on the local host. See the glob subcommand for more information on file-name expansion. The remote file names are used locally and are altered by any settings made by the case, ntrans, and nmap subcommands. The ftp command uses the current settings for the form, mode, struct, and type subcommands while transferring the files.
mkdir [RemoteDirectory] Creates the directory specified in the RemoteDirectory parameter on the remote host.
mls [RemoteDirectories LocalFile] Expands the directories specified in the RemoteDirectories parameter at the remote host and writes an abbreviated file listing of the indicated remote directories to a local file. If the RemoteDirectories parameter contains a pattern-matching character, the mls subcommand prompts for a local file if none is specified. If the RemoteDirectories parameter is a list of remote directories separated by blanks, the last argument in the list must be either a local file name or a - (hyphen).

If the LocalFile parameter is - (hyphen), the mls subcommand displays the listing on the local terminal. If interactive prompting is on (see the prompt subcommand), the ftp command prompts the user to verify that the last parameter is a local file and not a remote directory.

mode [ stream | block ] Sets file-transfer mode. If an argument is not supplied, the default is stream.
block
Sets the file-transfer mode to block.
stream
Sets the file-transfer mode to stream.
Item Description
modtime Shows the last modification time of the specified file on the remote machine. If the ftp command is not connected to a host prior to execution, the modtime subcommand terminates with an error message. The ftp command ignores parameter beyond the first parameter. If the FileName parameter is not specified, the ftp command prompts for a file name. If no file name is given, the ftp command sends a usage message to standard output and terminates the subcommand.

If the name specified by the FileName parameter exists on the remote host, and the name specifies a file, then the ftp command sends a message containing the last modification time of the file to standard output and terminates the subcommand. If FileName specifies a directory, the ftp command sends an error message to standard output and terminates the subcommand.

Note: The modtime subcommand interprets metacharacters when allowed.
mput [LocalFiles] Expands the files specified in the LocalFiles parameter at the local host and copies the indicated local files to the remote host. See the glob subcommand for more information on file-name expansion. The local file names are used at the remote host and are altered by any settings made by the ntrans and nmap subcommands. The ftp command uses the current settings for the type, form, mode, and struct subcommands while transferring the files.
nlist [RemoteDirectory][LocalFile] Writes a listing of the contents of the specified remote directory (RemoteDirectory) to the specified local file (LocalFile). If the RemoteDirectory parameter is not specified, the nlist subcommand lists the contents of the current remote directory. If the LocalFile parameter is not specified or is a - (hyphen), the nlist subcommand displays the listing on the local terminal.
nmap [InPattern OutPattern] Turns the file-name mapping mechanism On or Off. If no parameters are specified, file-name mapping is turned off. If parameters are specified, source file names are mapped for the mget and mput subcommands and for the get and put subcommands when the destination file name is not specified. This subcommand is useful when the local and remote hosts use different file-naming conventions or practices. Mapping follows the pattern set by the InPattern and OutPattern parameters.

The InPattern parameter specifies the template for incoming file names, which may have already been processed according to the case and ntrans settings. The template variables $1 through $9 can be included in the InPattern parameter. All characters in the InPattern parameter, other than the $ (dollar sign) and the \$ (backslash, dollar sign), are treated literally and are used as delimiters between InPattern variables. For example, if the InPattern parameter is $1.$2 and the remote file name is mydata.dat, the value of $1 is mydata and the value of $2 is dat.

The OutPattern parameter determines the resulting file name. The variables $1 through $9 are replaced by their values as derived from the InPattern parameter, and the variable $0 is replaced by the original file name. Additionally, the sequence [Sequence1,Sequence2] is replaced by the value of Sequence1, if Sequence1 is not null; otherwise, it is replaced by the value of Sequence2. For example, the subcommand:

nmap $1.$2.$3 [$1,$2].[$2,file]

would yield myfile.data from myfile.data or myfile.data.old, myfile.file from myfile, and myfile.myfile from .myfile. Use the \ (backslash) symbol to prevent the special meanings of the $ (dollar sign), [ (left bracket), ] (right bracket), and , (comma) in the OutPattern parameter.

non-print Synonym for the form non-print subcommand.
ntrans [InCharacters [OutCharacters]] Turns the file-name character translation mechanism On and Off. If no parameters are specified, character translation is turned off. If parameters are specified, characters in source file names are translated for mget and mput subcommands and for get and put subcommands when the destination file name is not specified.

This subcommand is useful when the local and remote hosts use different file-naming conventions or practices. Character translation follows the pattern set by the InCharacters and OutCharacters parameter. Characters in a source file name matching characters in the InCharacters parameter are replaced by the corresponding characters in the OutCharacters parameter.

If the string specified by the InCharacters parameter is longer than the string specified by the OutCharacters parameter, the characters in the InCharacters parameter are deleted if they have no corresponding character in the OutCharacters parameter.

open HostName [Port] Establishes a connection to the FTP server at the host specified by the HostName parameter. If the optional port number is specified, the ftp command attempts to connect to a server at that port. If the automatic login feature is set (that is, the -n flag was not specified on the command line), the ftp command attempts to log in the user to the FTP server.

You must also have a $HOME/.netrc file with the correct information in it and the correct permissions set. The .netrc file must be in your home directory.

passive Toggles passive mode for file transfers. When a file transfer command (such as get, mget, put, or mput) is invoked with passive mode off, the ftp server opens a data connection back to the client. In passive mode, the client opens data connections to the server when sending or receiving data.
private Sets the protection level to private only when the authentication method is set. At this level, data integrity and confidentiality are protected.
prompt Toggles interactive prompting. If interactive prompting is on (the default), the ftp command prompts for verification before retrieving, sending, or deleting multiple files during the mget, mput, and mdelete subcommands. Otherwise, the ftp command acts accordingly on all files specified.
protect This command returns the current level of protection.
proxy [Subcommand] Executes an ftp command on a secondary control connection. This subcommand allows the ftp command to connect simultaneously to two remote FTP servers for transferring files between the two servers. The first proxy subcommand should be an open subcommand to establish the secondary control connection. Enter the proxy ? subcommand to see the other ftp subcommands that are executable on the secondary connection.

The following subcommands behave differently when prefaced by the proxy subcommand:

  • The open subcommand does not define new macros during the automatic login process.
  • The close subcommand does not erase existing macro definitions.
  • The get and mget subcommands transfer files from the host on the primary connection to the host on the secondary connection.
  • The put, mput, and append subcommands transfer files from the host on the secondary connection to the host on the primary connection.
  • The restart subcommand can be handled by the proxy command.
  • The status subcommand displays accurate information.

File transfers require that the FTP server on the secondary connection must support the PASV (passive) instruction.

put LocalFile [RemoteFile] Stores a local file on the remote host. If you do not specify the RemoteFile parameter, the ftp command uses the local file name to name the remote file, and the remote file name is altered by any settings made by the ntrans and nmap subcommands. The ftp command uses the current settings for the type, form, mode, and struct subcommands while transferring the files.
pwd Displays the name of the current directory on the remote host.
quit Closes the connection and exits the ftp command. Same as the bye subcommand.
quote String Sends the string specified by the String parameter verbatim to the remote host. Execute the remotehelp or quote help subcommand to display a list of valid values for the String parameter.
Note: "Quoting" commands that involve data transfers can produce unpredictable results.
record Synonym for the struct record subcommand.
recv RemoteFile [LocalFile] Copies the remote file to the local host. Same as the get subcommand.
reinitialize Reinitializes an FTP session by flushing all I/O and allowing transfers to complete. Resets all defaults as if a user had just started an FTP session without logging in to a remote host.
remotehelp [Subcommand] Requests help from the remote FTP server.
rename FromName ToName Renames a file on the remote host.
reset Clears the reply queue. This subcommand resynchronizes the command parsing.
restart get | put | append Restarts a file transfer at the point where the last checkpoint was made. To run successfully, the subcommand must be the same as the aborted subcommand, including structure, type, and form. Valid arguments are get, put, and append.
rmdir RemoteDirectory Removes the remote directory specified by the RemoteDirectory parameter at the remote host.
runique (ReceiveUnique) Toggles the facility for creating unique file names for local destination files during get and mget subcommands. If this facility is Off (the default), the ftp command overwrites local files. Otherwise, if a local file has the same name as that specified for a local destination file, the ftp command modifies the specified name of the local destination file with .1. If a local file is already using the new name, the ftp command appends the postfix .2 to the specified name. If a local file is already using this second name, the ftp command continues incrementing the postfix until it either finds a unique file name or reaches .99 without finding a unique file name. If the ftp command cannot find a unique file name, the ftp command reports an error and the transfer does not take place. Note that the runique subcommand does not affect local file names generated from a shell command.
safe Sets the protection level to "safe." At this level, data is integrity protected.
send LocalFile [RemoteFile] Stores a local file on the remote host. Same as the put subcommand.
sendport Toggles the use of FTP PORT instructions. By default, the ftp command uses a PORT instruction when establishing a connection for each data transfer. When the use of PORT instructions is disabled, the ftp command does not use PORT instructions for data transfers. The PORT instruction is useful when dealing with FTP servers that ignore PORT instructions while incorrectly indicating the instructions have been accepted.
site Args Displays or sets the idle time-out period, displays or sets the file-creation umask, or changes the permissions of a file, using the chmod command. Possible values for the Args parameter are umask and chmod.
size RemoteFile Displays the size in bytes of the remote file specified by the RemoteFile parameter.
status Displays the current status of the ftp command as well as the status of the subcommands.
stream Synonym for the mode stream subcommand.
struct [ file | record ] Sets the data transfer structure type. Valid arguments are file and record.
file
Sets the data-transfer structure type to file.
record
Sets the data-transfer structure type to record.
sunique (Send/Store Unique) Toggles the facility for creating unique file names for remote destination files during put and mput subcommands. If this facility is off (the default), the ftp command overwrites remote files. Otherwise, if a remote file has the same name as that specified for a remote destination file, the remote FTP server modifies the name of the remote destination file. Note that the remote server must support the STOU instruction.
system Shows the type of operating system running on the remote machine.
telnet Synonym for the form telnet subcommand.
tenex Synonym for the type tenex subcommand.
trace Toggles packet tracing.
type [ ascii | binary | ebcdic | image | local M | tenex ] Sets the file-transfer type. Valid arguments are ascii, binary, ebcdic, image, local M, and tenex. If an argument is not specified, the current type is printed. The default type is ascii; the binary type can be more efficient than ascii.
ascii
Sets the file-transfer type to network ASCII. This type is the default. File transfer may be more efficient with binary-image transfer. See the binary argument for further information.
binary
Sets the file-transfer type to binary image. This type can be more efficient than an ASCII transfer.
ebcdic
Sets the file-transfer type to EBCDIC.
image
Sets the file-transfer type to binary image. This type can be more efficient than an ASCII transfer.
local M
Sets the file-transfer type to local. The M parameter defines the decimal number of bits per machine word. This parameter does not have a default.
tenex
Sets the file-transfer type to that needed for TENEX machines.
user User [Password] [Account] Identifies the local user (User) to the remote FTP server. If the Password or Account parameter is not specified and the remote server requires it, the ftp command prompts for the password or account locally. If the Account parameter is required, the ftp command sends it to the remote server after the remote login process completes.
Note: Unless automatic login is disabled by specifying the -n flag on the command line, the ftp command sends the User, Password, and Account parameters automatically for the initial connection to the remote server. You also need a .netrc file in your home directory in order to issue an automatic login.
verbose Toggles verbose mode. When the verbose mode is on (the default), the ftp command displays all responses from the remote FTP server. Additionally, the ftp command displays statistics on all file transfers when the transfers complete.

Examples

  1. To invoke the ftp command, log in to the system canopus, display local help information, display remote help information, display status, toggle the bell, prompt, runique, trace, and verbose subcommands, and then quit, enter:
    $ ftp canopus
    Connected to canopus.austin.century.com.
    220 canopus.austin.century.com FTP server (Version 4.1 Sat Nov 23 12:52:09 CST 1991) ready.
    Name (canopus:eric): dee
    331 Password required for dee.
    Password:
    230 User dee logged in.
    ftp> help
    Commands may be abbreviated. Commands are:
    !          delete          mdelete          proxy          runique
    $          debug           mdir             sendport       send
    account    dir             mget             put            size
    append     disconnect      mkdir            pwd            status
    ascii      form            mls              quit           struct
    bell       get             mode             quote          sunique
    binary     glob            modtime          recv           system
    bye        hash            mput             remotehelp     tenex
    case       help            nmap             rstatus        trace
    cd         image           nlist            rhelp          type
    cdup       lcd             ntrans           rename         user
    close      ls              open             reset          verbose
    cr         macdef          prompt           rmdir          ?
    clear      private         protect          safe
    ftp> remotehelp
    214-The following commands are recognized(* =>'s unimplemented).
     USER   PORT   RETR   MSND*  ALLO   DELE   SITE*  XMKD   CDUP 
     PASS   PASV   STOR   MSOM*  REST*  CWD    STAT*  RMD    XCUP
     ACCT*  TYPE   APPE   MSAM*  RNFR   XCWD   HELP   XRMD   STOU 
     REIN*  STRU   MLFL*  MRSQ*  RNTO   LIST   NOOP   PWD 
     QUIT   MODE   MAIL*  MRCP*  ABOR   NLST   MKD    XPWD 
     AUTH   ADAT   PROT   PBSZ   MIC    ENC    CCC
    214 Direct comments to ftp-bugs@canopus.austin.century.com.
    ftp> status
    Connected to canopus.austin.century.com.
    No proxy connection.
    Mode: stream; Type: ascii; Form: non-print; Structure: file
    Verbose: on; Bell: off; Prompting: on; Globbing: on
    Store unique: off; Receive unique: off
    Case: off; CR stripping: on
    Ntrans: off
    Nmap: off
    Hash mark printing: off; Use of PORT cmds: on
    ftp> bell
    Bell mode on.
    ftp> prompt
    Interactive mode off.
    ftp> runique
    Receive unique on.
    ftp> trace
    Packet tracing on.
    ftp> verbose
    Verbose mode off.
    ftp> quit
    $ 
  2. To invoke the ftp command, log in to the system canopus, print the working directory, change the working directory, set the file transfer type to ASCII, send a local file to the remote host, change the working directory to the parent directory, and then quit, enter:
    $ ftp canopus
    Connected to canopus.austin.century.com.
    220 canopus.austin.century.com FTP server (Version 4.1 Sat Nov 23 12:52:09 CST 1991) ready.
    Name (canopus:eric): dee
    331 Password required for dee.
    Password:
    230 User dee logged in.
    ftp> pwd
    257 "/home/dee" is current directory.
    ftp> cd desktop
    250 CWD command successful.
    ftp> type ascii
    200 Type set to A.
    ftp> send typescript
    200 PORT command successful.
    150 Opening data connection for typescript (128.114.4.99,1412).
    226 Transfer complete.
    ftp> cdup
    250 CWD command successful.
    ftp> bye
    221 Goodbye.
    $ 
  3. To invoke the ftp command with automatic logon (using the .netrc file), open a session with the system canopus, log in, change the working directory to the parent directory, print the working directory, list the contents of the current directory, delete a file, write a listing of the contents of the current directory to a local file, close the session, and then quit, enter:
    $ ftp canopus
    Connected to canopus.austin.century.com.
    220 canopus.austin.century.com FTP server (Version 4.1 Sat Nov 23 12:52:09 CST 1991) ready.
    331 Password required for dee.
    230 User dee logged in.
    ftp> cdup
    250 CWD command successful.
    ftp> pwd
    257 "/home" is current directory.
    ftp> dir
    200 PORT command successful.
    150 Opening data connection for /usr/bin/ls (128.114.4.99,1407) 
    (0 bytes).
    total 104
    drwxr-xr-x   2 system        32 Feb 23 17:55 bin
    Drwxr-xr-x  26 rios        4000 May 30 17:18 bin1
    drwxr-xr-x   2 system        32 Feb 23 17:55 books
    drwxrwxrwx  18 rios        1152 Jun  5 13:41 dee
    -r--r--r--   1 system      9452 May 17 12:21 filesystems
    drwxr-xr-x   2 system        32 Feb 23 17:55 jim
    drwxr-xr-x   5 system        80 Feb 23 17:55 krs
    drwxrwxrwx   2 rios       16432 Feb 23 17:36 lost+found
    -rwxr-xr-x   1 rios        3651 May 24 16:45 oldmail
    drwxr-xr-x   2 system       256 Feb 23 17:55 pubserv
    drwxrwxrwx   2 system       144 Feb 23 17:55 rein989
    drwxr-xr-x   2 system       112 Feb 23 17:55 reinstall
    226 Transfer complete.
    ftp> delete oldmail
    250 DELE command successful.
    ftp> mdir /home/dee/bin binlist
    output to local-file: binlist? y
    200 PORT command successful.
    150 Opening data connection for /usr/bin/ls (128.114.4.99,1408) (0 bytes).
    226 Transfer complete.
    ftp> close
    221 Goodbye.
    ftp> quit
    $  

Files

Item Description
/usr/samples/tcpip/netrc Contains the sample .netrc file.
/etc/syslog.conf Contains configuration information for the syslogd daemon.