ftp Command Purpose Transfers files between a local and a remote host. Syntax ftp [ -d ] [ -g ] [ -i ] [ -n ] [ -v ] [ HostName ] Description The /usr/bin/ftp command is the interface to the File Transfer Protocol (FTP). This command uses FTP to transfer files between the local host and a remote host or between two remote hosts. The FTP protocol allows data transfer between hosts that use dis- similar file systems. Although the protocol provides a high de- gree of flexibility in transferring data, it does not attempt to preserve file attributes (such as the protection mode or modifi- cation 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. 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 re- quest, creating and removing directories, and escaping to the lo- cal shell to perform shell commands. Security and Automatic Login The ftp command also provides for 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 immediately 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 en- try 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. This occurs regardless of whether 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 informa- tion in that entry to automatically log in to the remote host. The ftp command also loads any command macros defined in the en- try. 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 com- mand executes the init macro if the macro is defined in the au- tomatic 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 that you specify 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. Flags The following flags can be entered on the shell command line: -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's debug level includes info level mes- sages. If you do not edit the /etc/syslog.conf file, no messages are produced. After changing the /etc/syslog.conf file, run the re- fresh -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. -g Disables the expansion of metacharacters in file names. In- terpreting metacharacters can be referred to as expanding (some- times 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 subcom- mands for descriptions of prompting during multiple file transfers. -n Prevents an automatic login on the initial connection. Other- wise, the ftp command searches for a $HOME/.netrc entry that describes the login and initialization process for the remote host. See the user subcommand. -v Displays all the responses from the remote server and provides data transfer statistics. This is the default display mode when the output of the ftp command is to a device, such as the console or a display. If standard is not a terminal, then the ftp com- mand disables verbose mode unless the user invoked the ftp com- mand with the -v flag or issued the verbose subcommand. Parameters HostName The name of the host machine to which files will be transferred. Subcommands If you execute the ftp command and do not specify the HostName of a remote host, the ftp command immediately displays the ftp> prompt and waits for an ftp subcommand. To connect to a remote host, you then execute the open subcommand. When the ftp com- mand 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 en- tered at the ftp> prompt, provides facilities that are not avail- able with most file-transfer programs, such as: * Handling file-name parameters to ftp subcommands. * Collecting a group of subcommands into a single subcommand mac- ro. * Loading macros from a $HOME/.netrc file. 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: * If a - (hyphen) is specified for the parameter, standard input is used for read operations and standard output is used for write operations. * If the preceding check does not apply and file-name expansion is enabled (see the -g command or the glob subcommand), the in- terpreter expands the file name according to the rules of the C shell. 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. * For the get, put, mget, and mput subcommands, the inter- preter has the ability to translate and map between different lo- cal and remote file-name syntax styles (see the case, ntrans, and nmap subcommands) and the ability to modify a local file name if it is not unique (see the runique subcommand). Addi- tionally, the ftp command can send instructions to a remote ftpd server to modify a remote file name if it is not unique (see the sunique subcommand). Note: The ftp command interpreter does not support pipes. 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 com- pleted, press the Interrupt key sequence. The default Interrupt key sequence is Ctrl-C. The stty command can be used to rede- fine this key sequence. Transfers being sent (from the local host to the remote host) are normally halted immediately. Transfers being received (from the remote host to the local host) are halted 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> prompt is not displayed until the remote server has sent all of the requested file. Additionally, if the remote server does something unexpected, the local ftp process may need to be ended manually. List of Subcommands The following ftp subcommands can be entered at the ftp> prompt. Use double quotes (" ") to specify parameters that include blank characters. ![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 de- fined 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 sub- commands 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 subcom- mand. case Sets a toggle for the case of file names. When the case subcommand is on, remote file names that are displayed in all capital letters are changed from uppercase to lowercase when written in the local directory. The default is off (uppercase remote file names are written in uppercase in the local directo- ry). 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. cr Strips the carriage return character from a carriage re- turn/line-feed sequence when receiving records during ASCII-type file transfers. (The ftp command terminates each ASCII-type record with a carriage return/line feed during file transfers.) This conforms with the AIX single line-feed record delimiter. Records on non-AIX remote hosts may have single line feeds embed- ded in records. To distinguish these embedded line feeds from record delimiters, set the cr subcommand to off. The cr subcom- mand toggles between on and off. delete RemoteFile Deletes the specified remote file. debug [0 | 1] Toggles debug on and off. Specify debug or debug 1 to print each command sent to the remote host and save the res- tart 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's debug level includes info level mes- sages. If you do not edit the /etc/syslog.conf file, no messages are produced. After changing the /etc/syslog.conf file, run the re- fresh -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. dir [RemoteDirectory][LocalFile] Writes a listing of the contents of the specified remote directory (RemoteDirectory) to the speci- fied 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 sub- command. 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 sub- command 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 TCP/IP protocol that opens connections to a system. get RemoteFile [LocalFile] Copies the remote file to the local host. If LocalFile 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 subcom- mand 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 may 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 sub- command: 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 ? subcom- mand. 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 list- ing 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 list- ing 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 ei- ther 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 re- placed 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 com- bination 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 speci- fied 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 subcom- mand 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 RemoteFiles 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 speci- fied in the RemoteDirectories parameter at the remote host and writes an abbreviated file listing of the indicated remote direc- tories to a local file. If the RemoteDirectories parameter con- tains 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. 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 ter- minates the subcommand. If the name specified by the FileName parameter exists on the re- mote 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 al- lowed. 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 informa- tion 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 con- tents of the specified remote directory (RemoteDirectory) to the specified local file (LocalFile). If the RemoteDirectory parame- ter 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] Sets or unsets the file-name mapping mechanism. 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) define the values of the template 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]] Sets or unsets the file- name character translation mechanism. 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 trans- lation follows the pattern set by the InCharacters and OutCharac- ters parameter. Characters in a source file name match- ing 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 will attempt to automatically log in the user to the FTP server. You must also have a $HOME/.netrc file with the correct informa- tion in it and the correct permissions set. The .netrc file must be in your home directory. prompt Toggles interactive prompting. If interactive prompting is on (the default), the ftp command prompts for verification be- fore retrieving, sending, or deleting multiple files during the mget, mput, and mdelete subcommands. Otherwise, the ftp com- mand acts accordingly on all files specified. proxy [Subcommand] Executes an ftp command on a secondary control connection. This subcommand allows the ftp command to simultane- ously connect 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 will not define new macros during the au- tomatic login process. * The close subcommand will 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 will display accurate information. File transfers require that the FTP server on the secondary con- nection 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. 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 logged in. 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 creating unique file names for local destination files during get and mget subcommands. If unique local file names 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 com- mand 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. 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 con- nection for each data transfer. When the use of PORT instruc- tions 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. 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 creating unique file names for remote destination files during put and mput subcommands. If unique remote file names 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 instruc- tion. 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 speci- fied, 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 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 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 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 param- eter 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 parameters are not specified and the remote server requires it, the ftp com- mand prompts for it locally. If the Account parameter is re- quired, 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, this process is done 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 verbose mode is on (the de- fault), 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 Note: All user input and response in the following ftp command interactions appears in bold. 1. To invoke the ftp command, log in, display local help informa- tion, 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 ? 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 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, print the working directo- ry, 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, log in, change the working directo- ry 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 $ Implementation Specifics This command is part of the TCP/IP Facility in Network Facilities in Base Operating System (BOS) Runtime. Files /usr/lpp/tcpip/samples/.netrc Sample .netrc file /etc/syslog.conf Contains configuration information for the syslogd daemon. Related Information The csh command, kill command, rcp command, refresh command, stty command, tftp command. The syslogd daemon. The .netrc file format. Copying Files Using the ftp Command in AIX Version 3.2 System User's Guide: Communications. Network Overview in AIX Version 3.2 System Management Guide: Communications and Networks. ================================================================= ================================================================= Copying Files Using the ftp Command The ftp command allows you to copy a file from a remote host. It does not preserve file attributes or copy subdirectories. If ei- ther of these conditions are necessary, use the rcp command. ftp Uses the File Transfer Protocol (FTP) to transfer files between hosts that use different file systems or character representations, such as EBCDIC and ASCII. It provides for secu- rity by sending passwords to the remote host and also permits au- tomatic login, file transfers, and logoff. rcp Copies one or more files between a local host and a remote host, between two separate remote hosts, or between files at the same remote host. This command is similar to the cp command ex- cept that it works only for remote file operations. If extra security is needed for your network, this command is disabled by the system manager. Prerequisites 1. You must have remote login permission specified in the remote host's $HOME/.netrc file if the automatic login feature is to be used. Otherwise, you must know a login name and password for the remote host. For more information about the .netrc file, refer to "Creating the .netrc File". 2. If you wish to copy a file from a remote host, you must have read permission for that file. Note: The read and write permissions for files and directories on a remote host are determined by the login name used. 3. If you wish to copy a file from your local host to a remote host, you must have write permission for the directory that is to contain the copied file. Also, if the directory on the remote host contains a file with the same name as the file that you wish to place in it, you must have write permission to append the file on the remote host. To Log in to a Remote Host 1. Change to the directory that contains the file you want to send (sending a file) or to the directory where you want the transferred file to reside (receiving a file). 2. Log in to the remote host. This can be done either directly or indirectly. To log in to a remote host directly, enter: ftp HostName If you have automatic login permission, information similar to the following appears on your local host: 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> Otherwise, information similar to the following displays on your local host. Enter your login name and password when prompted by the system. 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> 3. To log in to a remote host indirectly, enter: ftp When the ftp> prompt is displayed, enter: open HostName If you have automatic login permission, the following information appears on your local host: 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> Otherwise, information similar to the following displays on your local host. Enter your name and password when prompted by the system. 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> You are now ready to copy a file between two hosts. To Copy a File from a Remote Host to a Local Host The ftp command uses the ASCII default transfer type to copy files. 1. Determine if the file that you wish to copy is in the current directory by issuing the dir subcommand. (The dir subcommand for the ftp command functions the same as the ls -l command.) If the file is not there, use the cd subcommand to move to the proper directory. 2. If you wish to copy your local file using binary image type, enter: binary 3. To copy a file to your host, enter: get FileName The file will be placed in the directory from which you issued the ftp command. 4. To end the session, press the Ctrl-D key sequence or enter quit. To Copy a File from a Local Host to a Remote Host The ftp command uses the ASCII default transfer type to copy files. 1. If you wish to place the file in a directory other than the $HOME directory, use the cd subcommand to move to the desired directory. 2. If you wish to copy your local file using binary image type, enter: binary 3. To copy a file to the remote host, enter: put FileName The file will be placed in the working directory of the remote host. 4. To end the session, press the Ctrl-D key sequence or enter quit. Related Information The cd command, ls command, ftp command, rcp command. The ftpd daemon.