Section: User Commands (1)
ftp [-46pinegvd ] [host [port ] ]
Ftp is the user interface to the Internet standard File Transfer Protocol. The program allows a user to transfer files to and from a remote network site.
Options may be specified at the command line, or to the command interpreter.
The client host and an optional port number with which ftp is to communicate may be specified on the command line. If this is done, ftp will immediately attempt to establish a connection to an FTP server on that host; otherwise, ftp will enter its command interpreter and await instructions from the user. When ftp is awaiting commands from the user the prompt `ftp>' is provided to the user. The following commands are recognized by ftp
nmap $1.$2.$3 [$1,$2].[$2,file]</BLOCKQUOTE>
would yield the output filename "myfile.data" for input filenames "myfile.data" and "myfile.data.old", "myfile.file" for the input filename "myfile", and "myfile.myfile" for the input filename ".myfile". Spaces may be included in outpattern as in the example: `nmap $1 sed "s/ *$//" > $1' . Use the `\' character to prevent special treatment of the `$','[','[', and `,' characters.
To abort a file transfer, use the terminal interrupt key (usually Ctrl-C). Sending transfers will be immediately halted. Receiving transfers will be halted by sending a ftp protocol ABOR command to the remote server, and discarding any further data received. The speed at which this is accomplished depends upon the remote server's support for ABOR processing. If the remote server does not support the ABOR command, an `ftp>' prompt will not appear until the remote server has completed sending the requested file.
The terminal interrupt key sequence will be ignored when ftp has completed any local processing and is awaiting a reply from the remote server. A long delay in this mode may result from the ABOR 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 ftp program must be killed by hand.
Files specified as arguments to ftp commands are processed according to the following rules.
<OL> <LI>If the file name `- ' is specified, the stdin (for reading) or stdout (for writing) is used.</LI> <LI>If the first character of the file name is `|' the remainder of the argument is interpreted as a shell command. Ftp then forks a shell, using popen?(3) with the argument supplied, and reads (writes) from the stdout (stdin). If the shell command includes spaces, the argument must be quoted; e.g. “" ls -lt"”. A particularly useful example of this mechanism is: “dir more”.</LI> <LI>Failing the above checks, if ``globbing'' is enabled, local file names are expanded according to the rules used in the csh?(1); c.f. the glob command. If the ftp command expects a single local file (.e.g. put ) only the first filename generated by the "globbing" operation is used.</LI> <LI>For mget commands and get commands with unspecified local file names, the local filename is the remote filename, which may be altered by a case ntrans or nmap setting. The resulting filename may then be altered if runique is on.</LI> <LI>For mput commands and put commands with unspecified remote file names, the remote filename is the local filename, which may be altered by a ntrans or nmap setting. The resulting filename may then be altered by the remote server if sunique is on.</LI> </OL>
The FTP specification specifies many parameters which may affect a file transfer. The type may be one of “ascii”, “image” (binary), “ebcdic”, and “local byte size” (for PDP -10's and PDP -20's mostly). Ftp supports the ascii and image types of file transfer, plus local byte size 8 for tenex mode transfers.
Ftp utilizes the following environment variables.
Correct execution of many commands depends upon proper behavior by the remote server.
An error in the treatment of carriage returns in the BSD 4.2 ascii-mode transfer code has been corrected. This correction may result in incorrect transfers of binary files to and from BSD 4.2 servers using the ascii type. Avoid this problem by using the binary image type.
Tutoriais de Tecnologia Web