X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/blobdiff_plain/1c15e88899094343f75aeba04122cd96a96b428e..2c5d7f0d9c585d802fda462dedefa62250eeb73d:/usr/src/usr.bin/ftp/ftp.1 diff --git a/usr/src/usr.bin/ftp/ftp.1 b/usr/src/usr.bin/ftp/ftp.1 index a9afa2f24a..9f69ff2f97 100644 --- a/usr/src/usr.bin/ftp/ftp.1 +++ b/usr/src/usr.bin/ftp/ftp.1 @@ -1,28 +1,44 @@ .\" Copyright (c) 1985, 1989, 1990 The Regents of the University of California. .\" All rights reserved. .\" -.\" Redistribution and use in source and binary forms are permitted provided -.\" that: (1) source distributions retain this entire copyright notice and -.\" comment, and (2) distributions including binaries display the following -.\" acknowledgement: ``This product includes software developed by the -.\" University of California, Berkeley and its contributors'' in the -.\" documentation or other materials provided with the distribution and in -.\" all advertising materials mentioning features or use of this software. -.\" Neither the name of the University nor the names of its contributors may -.\" be used to endorse or promote products derived from this software without -.\" specific prior written permission. -.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED -.\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF -.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. .\" -.\" @(#)ftp.1 6.15 (Berkeley) 7/24/90 +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. .\" -.Dd July 24, 1990 +.\" @(#)ftp.1 6.18 (Berkeley) 7/30/91 +.\" +.Dd July 30, 1991 .Dt FTP 1 .Os BSD 4.2 .Sh NAME .Nm ftp -.Nd ARPANET file transfer program +.Nd +.Tn ARPANET +file transfer program .Sh SYNOPSIS .Nm ftp .Op Fl v @@ -33,19 +49,21 @@ .Op Ar host .Sh DESCRIPTION .Nm Ftp -is the user interface to the ARPANET standard File Transfer Protocol. +is the user interface to the +.Tn ARPANET +standard File Transfer Protocol. The program allows a user to transfer files to and from a remote network site. .Pp Options may be specified at the command line, or to the command interpreter. -.Tw Ds -.Tp Fl v +.Bl -tag -width flag +.It Fl v Verbose option forces .Nm ftp to show all responses from the remote server, as well as report on data transfer statistics. -.Tp Fl n +.It Fl n Restrains .Nm ftp from attempting \*(Lqauto-login\*(Rq upon initial connection. @@ -54,70 +72,60 @@ If auto-login is enabled, will check the .Pa .netrc (see below) file in the user's home directory for an entry describing -an account on the remote machine. If no entry exists, +an account on the remote machine. +If no entry exists, .Nm ftp will prompt for the remote machine login name (default is the user identity on the local machine), and, if necessary, prompt for a password and an account with which to login. -.Tp Fl i +.It Fl i Turns off interactive prompting during multiple file transfers. -.Tp Fl d +.It Fl d Enables debugging. -.Tp Fl g +.It Fl g Disables file name globbing. -.Tp +.El .Pp The client host with which .Nm ftp is to communicate may be specified on the command line. If this is done, .Nm ftp -will immediately attempt to establish a connection to an FTP +will immediately attempt to establish a connection to an +.Tn FTP server on that host; otherwise, .Nm ftp will enter its command interpreter and await instructions -from the user. When +from the user. +When .Nm ftp is awaiting commands from the user the prompt .Ql ftp> -is provided to the user. The following commands are recognized +is provided to the user. +The following commands are recognized by .Nm ftp : -.Tw Fl -.Tp Cx Ic \&! -.Ws -.Op Ar command Op Ar args -.Cx +.Bl -tag -width Fl +.It Ic \&! Op Ar command Op Ar args Invoke an interactive shell on the local machine. If there are arguments, the first is taken to be a command to execute directly, with the rest of the arguments as its arguments. -.Tp Cx Ic \&$ -.Ws -.Ar macro-name -.Op Ar args -.Cx +.It Ic \&$ Ar macro-name Op Ar args Execute the macro .Ar macro-name that was defined with the .Ic macdef command. Arguments are passed to the macro unglobbed. -.Tp Cx Ic account -.Ws -.Op Ar passwd -.Cx +.It Ic account Op Ar passwd 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 will be prompted for an account password in a non-echoing input mode. -.Tp Cx Ic append -.Ws -.Ar local-file -.Ws -.Op Ar remote-file -.Cx -Append a local file to a file on the remote machine. If +.It Ic append Ar local-file Op Ar remote-file +Append a local file to a file on the remote machine. +If .Ar remote-file is left unspecified, the local file name is used in naming the remote file after being altered by any @@ -131,23 +139,27 @@ File transfer uses the current settings for .Ic mode , and .Ic structure . -.Tp Ic ascii +.It Ic ascii Set the file transfer .Ic type -to network ASCII. This is the default type. -.Tp Ic bell +to network +.Tn ASCII . +This is the default type. +.It Ic bell Arrange that a bell be sounded after each file transfer command is completed. -.Tp Ic binary +.It Ic binary Set the file transfer .Ic type to support binary image transfer. -.Tp Ic bye -Terminate the FTP session with the remote server +.It Ic bye +Terminate the +.Tn FTP +session with the remote server and exit .Nm ftp . An end of file will also terminate the session and exit. -.Tp Ic case +.It Ic case Toggle remote computer file name case mapping during .Ic mget commands. @@ -156,56 +168,51 @@ When is on (default is off), remote computer file names with all letters in upper case are written in the local directory with the letters mapped to lower case. -.Tp Cx Ic cd -.Ws -.Ar remote-directory -.Cx +.It Ic \&cd Ar remote-directory Change the working directory on the remote machine to .Ar remote-directory . -.Tp Ic cdup +.It Ic cdup Change the remote machine working directory to the parent of the current remote machine working directory. -.Tp Cx Ic chmod -.Ws -.Ar mode file-name -.Cx +.It Ic chmod Ar mode file-name Change the permission modes of the file .Ar file-name on the remote sytem to .Ar mode . -.Tp Ic close -Terminate the FTP session with the remote server, and +.It Ic close +Terminate the +.Tn FTP +session with the remote server, and return to the command interpreter. Any defined macros are erased. -.Tp Ic cr +.It Ic \&cr Toggle carriage return stripping during ascii type file retrieval. Records are denoted by a carriage return/linefeed sequence during ascii type file transfer. When -.Ic cr +.Ic \&cr is on (the default), carriage returns are stripped from this -sequence to conform with the UNIX single linefeed record +sequence to conform with the +.Ux +single linefeed record delimiter. -Records on non-UNIX remote systems may contain single linefeeds; +Records on +.Pf non\- Ns Ux +remote systems may contain single linefeeds; when an ascii type transfer is made, these linefeeds may be distinguished from a record delimiter only when -.Ic cr +.Ic \&cr is off. -.Tp Cx Ic delete -.Ws -.Ar remote-file -.Cx +.It Ic delete Ar remote-file Delete the file .Ar remote-file on the remote machine. -.Tp Cx Ic debug -.Ws -.Op Ar debug-value -.Cx -Toggle debugging mode. If an optional +.It Ic debug Op Ar debug-value +Toggle debugging mode. +If an optional .Ar debug-value is specified it is used to set the debugging level. When debugging is on, @@ -213,12 +220,11 @@ When debugging is on, prints each command sent to the remote machine, preceded by the string .Ql \-\-> -.Tp Cx Ic dir -.Ws +.It Xo +.Ic dir .Op Ar remote-directory -.Ws .Op Ar local-file -.Cx +.Xc Print a listing of the directory contents in the directory, .Ar remote-directory , @@ -231,33 +237,27 @@ target local file for receiving .Ic dir output. If no directory is specified, the current working -directory on the remote machine is used. If no local +directory on the remote machine is used. +If no local file is specified, or .Ar local-file is .Fl , output comes to the terminal. -.Tp Ic disconnect +.It Ic disconnect A synonym for .Ar close . -.Tp Cx Ic form -.Ws -.Ar format -.Cx +.It Ic form Ar format Set the file transfer .Ic form to .Ar format . The default format is \*(Lqfile\*(Rq. -.Tp Cx Ic get -.Ws -.Ar remote-file -.Ws -.Op Ar local-file -.Cx +.It Ic get Ar remote-file Op Ar local-file Retrieve the .Ar remote-file -and store it on the local machine. If the local +and store it on the local machine. +If the local file name is not specified, it is given the same name it has on the remote machine, subject to alteration by the current @@ -273,7 +273,7 @@ The current settings for and .Ic structure are used while transferring the file. -.Tp Ic glob +.It Ic glob Toggle filename expansion for .Ic mdelete , .Ic mget @@ -303,55 +303,49 @@ Note: and .Ic mput are not meant to transfer -entire directory subtrees of files. That can be done by +entire directory subtrees of files. +That can be done by transferring a .Xr tar 1 archive of the subtree (in binary mode). -.Tp Ic hash +.It Ic hash Toggle hash-sign (``#'') printing for each data block -transferred. The size of a data block is 1024 bytes. -.Tp Cx Ic help -.Ws -.Op Ar command -.Cx +transferred. +The size of a data block is 1024 bytes. +.It Ic help Op Ar command Print an informative message about the meaning of .Ar command . If no argument is given, .Nm ftp prints a list of the known commands. -.Tp Cx Ic idle -.Ws -.Op Ar seconds -.Cx +.It Ic idle Op Ar seconds Set the inactivity timer on the remote server to .Ar seconds seconds. If .Ar seconds is ommitted, the current inactivity timer is printed. -.Tp Cx Ic lcd -.Ws -.Op Ar directory -.Cx -Change the working directory on the local machine. If +.It Ic lcd Op Ar directory +Change the working directory on the local machine. +If no .Ar directory is specified, the user's home directory is used. -.Tp Cx Ic ls -.Ws +.It Xo +.Ic \&ls .Op Ar remote-directory -.Ws .Op Ar local-file -.Cx +.Xc Print a listing of the contents of a directory on the remote machine. The listing includes any system-dependent information that the server -chooses to include; for example, most UNIX systems will produce +chooses to include; for example, most +.Ux +systems will produce output from the command .Ql ls \-l . (See also -.Ic nlist . -) +.Ic nlist . ) If .Ar remote-directory is left unspecified, the current working directory is used. @@ -359,17 +353,14 @@ If interactive prompting is on, .Nm ftp will prompt the user to verify that the last argument is indeed the target local file for receiving -.Ic ls +.Ic \&ls output. If no local file is specified, or if .Ar local-file is .Sq Fl , the output is sent to the terminal. -.Tp Cx Ic macdef -.Ws -.Ar macro-name -.Cx +.It Ic macdefNs Ar macro-name Define a macro. Subsequent lines are stored as the macro .Ar macro-name ; @@ -385,24 +376,17 @@ The macro processor interprets `$' and `\e' 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 that macro processor that the -executing macro is to be looped. On the first pass `$i' is +executing macro is to be looped. +On the first pass `$i' 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 `\e' followed by any character is replaced by that character. Use the `\e' to prevent special treatment of the `$'. -.Tp Cx Ic mdelete -.Ws -.Op Ar remote-files -.Cx +.It Ic mdelete Op Ar remote-files Delete the .Ar remote-files on the remote machine. -.Tp Cx Ic mdir -.Ws -.Ar remote-files -.Ws -.Ar local-file -.Cx +.It Ic mdir Ar remote-files local-file Like .Ic dir , except multiple remote files may be specified. @@ -412,10 +396,7 @@ will prompt the user to verify that the last argument is indeed the target local file for receiving .Ic mdir output. -.Tp Cx Ic mget -.Ws -.Ar remote-files -.Cx +.It Ic mget Ar remote-files Expand the .Ar remote-files on the remote machine @@ -433,23 +414,12 @@ and settings. Files are transferred into the local working directory, which can be changed with -.Cx ` -.Cx Li lcd directory -.Cx \'; +.Ql lcd directory ; new local directories can be created with -.Cx Li \&! mkdir directory -.Cx \'. -.Tp Cx Ic mkdir -.Ws -.Ar directory-name -.Cx +.Ql "\&! mkdir directory" . +.It Ic mkdir Ar directory-name Make a directory on the remote machine. -.Tp Cx Ic mls -.Ws -.Ar remote-files -.Ws -.Ar local-file -.Cx +.It Ic mls Ar remote-files local-file Like .Ic nlist , except multiple remote files may be specified, @@ -462,24 +432,15 @@ will prompt the user to verify that the last argument is indeed the target local file for receiving .Ic mls output. -.Tp Cx Ic mode -.Ws -.Op Ar mode-name -.Cx +.It Ic mode Op Ar mode-name Set the file transfer .Ic mode to .Ar mode-name . The default mode is \*(Lqstream\*(Rq mode. -.Tp Cx Ic modtime -.Ws -.Ar file-name -.Cx +.It Ic modtime Ar file-name Show the last modification time of the file on the remote machine. -.Tp Cx Ic mput -.Ws -.Ar local-files -.Cx +.It Ic mput Ar local-files Expand wild cards in the list of local files given as arguments and do a .Ic put @@ -492,24 +453,22 @@ Resulting file names will then be processed according to and .Ic nmap settings. -.Tp Cx Ic newer -.Ws -.Ar file-name -.Cx +.It Ic newer Ar file-name 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 +recent that the file on the current system. +If the file does not exist on the current system, the remote file is considered .Ic newer . Otherwise, this command is identical to .Ar get . -.Tp Cx Ic nlist -.Ws +.It Xo +.Ic nlist .Op Ar remote-directory -.Ws .Op Ar local-file -.Cx +.Xc Print a list of the files in a -directory on the remote machine. If +directory on the remote machine. +If .Ar remote-directory is left unspecified, the current working directory is used. If interactive prompting is on, @@ -523,10 +482,7 @@ If no local file is specified, or if is .Fl , the output is sent to the terminal. -.Tp Cx Ic nmap -.Ws -.Op Ar inpattern outpattern -.Cx +.It Ic nmap Op Ar inpattern outpattern 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 @@ -539,7 +495,9 @@ If arguments are specified, local filenames are mapped during commands and .Ic get commands issued without a specified local target filename. -This command is useful when connecting to a non-UNIX remote computer +This command is useful when connecting to a +.No non\- Ns Ux +remote computer with different file naming conventions or practices. The mapping follows the pattern set by .Ar inpattern @@ -552,7 +510,8 @@ processed according to the and .Ic case settings). -Variable templating is accomplished by including the sequences `$1', `$2', ..., `$9' in +Variable templating is accomplished by including the +sequences `$1', `$2', ..., `$9' in .Ar inpattern . Use `\\' to prevent this special treatment of the `$' character. All other characters are treated literally, and are used to determine the @@ -572,10 +531,7 @@ from the template. The sequence `$0' is replace by the original filename. Additionally, the sequence -.Cx ` -.Op Ar seq1 , Ar seq2 -.Cx \' -.Cx +.Ql Op Ar seq1 , Ar seq2 is replaced by .Op Ar seq1 if @@ -584,13 +540,9 @@ is not a null string; otherwise it is replaced by .Ar seq2 . For example, the command .Pp -.Df I -nmap $1.$2.$3 -.Cx Op $1,$2 -.Cx . -.Op $2,file -.Cx -.De +.Bd -literal -offset indent -compact +nmap $1.$2.$3 [$1,$2].[$2,file] +.Ed .Pp would yield the output filename "myfile.data" for input filenames "myfile.data" and @@ -601,10 +553,7 @@ Spaces may be included in as in the example: `nmap $1 sed "s/ *$//" > $1' . Use the `\e' character to prevent special treatment of the `$','[','[', and `,' characters. -.Tp Cx Ic ntrans -.Ws -.Op Ar inchars Op Ar outchars -.Cx +.It Ic ntrans Op Ar inchars Op Ar outchars Set or unset the filename character translation mechanism. If no arguments are specified, the filename character translation mechanism is unset. @@ -620,7 +569,9 @@ local filenames are translated during commands and .Ic get commands issued without a specified local target filename. -This command is useful when connecting to a non-UNIX remote computer +This command is useful when connecting to a +.No non\- Ns Ux +remote computer with different file naming conventions or practices. Characters in a filename matching a character in .Ar inchars @@ -631,26 +582,28 @@ If the character's position in is longer than the length of .Ar outchars , the character is deleted from the file name. -.Tp Cx Ic open -.Ws -.Ar host -.Ws -.Op Ar port -.Cx +.It Ic open Ar host Op Ar port Establish a connection to the specified .Ar host -FTP server. An optional port number may be supplied, +.Tn FTP +server. +An optional port number may be supplied, in which case, .Nm ftp -will attempt to contact an FTP server at that port. +will attempt to contact an +.Tn FTP +server at that port. If the .Ic auto-login option is on (default), .Nm ftp will also attempt to automatically log the user in to -the FTP server (see below). -.Tp Ic prompt -Toggle interactive prompting. Interactive prompting +the +.Tn FTP +server (see below). +.It Ic prompt +Toggle interactive prompting. +Interactive prompting occurs during multiple file transfers to allow the user to selectively retrieve or store files. If prompting is turned off (default is on), any @@ -660,10 +613,7 @@ or will transfer all files, and any .Ic mdelete will delete all files. -.Tp Cx Ic proxy -.Ws -.Ar ftp-command -.Cx +.It Ic proxy Ar ftp-command Execute an ftp command on a secondary control connection. This command allows simultaneous connection to two remote ftp servers for transferring files between the two servers. @@ -692,14 +642,11 @@ 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 protocol -PASV command by the server on the secondary control connection. -.Tp Cx Ic put -.Ws -.Ar local-file -.Ws -.Op Ar remote-file -.Cx -Store a local file on the remote machine. If +.Dv PASV +command by the server on the secondary control connection. +.It Ic put Ar local-file Op Ar remote-file +Store a local file on the remote machine. +If .Ar remote-file is left unspecified, the local file name is used after processing according to any @@ -707,38 +654,27 @@ after processing according to any or .Ic nmap settings -in naming the remote file. File transfer uses the +in naming the remote file. +File transfer uses the current settings for .Ic type , .Ic format , .Ic mode , and .Ic structure . -.Tp Ic pwd +.It Ic pwd Print the name of the current working directory on the remote machine. -.Tp Ic quit +.It Ic quit A synonym for .Ic bye . -.Tp Cx Ic quote -.Ws -.Ar arg1 arg2 ... -.Cx -The arguments specified are sent, verbatim, to the remote FTP +.It Ic quote Ar arg1 arg2 ... +The arguments specified are sent, verbatim, to the remote +.Tn FTP server. -.Tp Cx Ic recv -.Ws -.Ar remote-file -.Ws -.Op Ar local-file -.Cx +.It Ic recv Ar remote-file Op Ar local-file A synonym for get. -.Tp Cx Ic reget -.Ws -.Ar remote-file -.Ws -.Op Ar local-file -.Cx +.It Ic reget Ar remote-file Op Ar local-file Reget acts like get, except that if .Ar local-file exists and is @@ -749,45 +685,40 @@ is presumed to be a partially transferred copy of .Ar remote-file and the transfer -is continued from the apparent point of failure. This command +is continued from the apparent point of failure. +This command is useful when transferring very large files over networks that are prone to dropping connections. -.Tp Cx Ic remotehelp -.Ws -.Op Ar command-name -.Cx -Request help from the remote FTP server. If a +.It Ic remotehelp Op Ar command-name +Request help from the remote +.Tn FTP +server. +If a .Ar command-name is specified it is supplied to the server as well. -.Tp Cx Ic remotestatus -.Ws -.Op Ar file-name -.Cx -With no arguments, show status of remote machine. If +.It Ic remotestatus Op Ar file-name +With no arguments, show status of remote machine. +If .Ar file-name is specified, show status of .Ar file-name on remote machine. -.Tp Cx Ic rename -.Ws +.It Xo +.Ic rename .Op Ar from -.Ws .Op Ar to -.Cx +.Xc Rename the file .Ar from on the remote machine, to the file .Ar to . -.Tp Ic reset +.It Ic reset 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. -.Tp Cx Ic restart -.Ws -.Ar marker -.Cx +.It Ic restart Ar marker Restart the immediately following .Ic get or @@ -795,14 +726,13 @@ or at the indicated .Ar marker . -On UNIX systems, marker is usually a byte +On +.Ux +systems, marker is usually a byte offset into the file. -.Tp Cx Ic rmdir -.Ws -.Ar directory-name -.Cx +.It Ic rmdir Ar directory-name Delete a directory on the remote machine. -.Tp Ic runique +.It Ic runique 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 @@ -820,100 +750,107 @@ Note that will not affect local files generated from a shell command (see below). The default value is off. -.Tp Cx Ic send -.Ws -.Ar local-file -.Ws -.Op Ar remote-file -.Cx +.It Ic send Ar local-file Op Ar remote-file A synonym for put. -.Tp Ic sendport -Toggle the use of PORT commands. By default, +.It Ic sendport +Toggle the use of +.Dv PORT +commands. +By default, .Nm ftp -will attempt to use a PORT command when establishing +will attempt to use a +.Dv PORT +command when establishing a connection for each data transfer. -The use of PORT commands can prevent delays -when performing multiple file transfers. If the PORT +The use of +.Dv PORT +commands can prevent delays +when performing multiple file transfers. +If the +.Dv PORT command fails, .Nm ftp -will use the default data port. When the use of PORT +will use the default data port. +When the use of +.Dv PORT commands is disabled, no attempt will be made to use -PORT commands for each data transfer. This is useful -for certain FTP implementations which do ignore PORT +.Dv PORT +commands for each data transfer. +This is useful +for certain +.Tn FTP +implementations which do ignore +.Dv PORT commands but, incorrectly, indicate they've been accepted. -.Tp Cx Ic site -.Ws -.Ar arg1 arg2 ... -.Cx -The arguments specified are sent, verbatim, to the remote FTP -server as a SITE command. -.Tp Cx Ic size -.Ws -.Ar file-name -.Cx +.It Ic site Ar arg1 arg2 ... +The arguments specified are sent, verbatim, to the remote +.Tn FTP +server as a +.Dv SITE +command. +.It Ic size Ar file-name Return size of .Ar file-name on remote machine. -.Tp Ic status +.It Ic status Show the current status of .Nm ftp . -.Tp Cx Ic struct -.Ws -.Op Ar struct-name -.Cx +.It Ic struct Op Ar struct-name Set the file transfer .Ar structure to .Ar struct-name . By default \*(Lqstream\*(Rq structure is used. -.Tp Ic sunique +.It Ic sunique Toggle storing of files on remote machine under unique file names. -Remote ftp server must support ftp protocol STOU command for +Remote ftp server must support ftp protocol +.Dv STOU +command for successful completion. The remote server will report unique name. Default value is off. -.Tp Ic system +.It Ic system Show the type of operating system running on the remote machine. -.Tp Ic tenex +.It Ic tenex Set the file transfer type to that needed to -talk to TENEX machines. -.Tp Ic trace +talk to +.Tn TENEX +machines. +.It Ic trace Toggle packet tracing. -.Tp Cx Ic type -.Ws -.Op Ar type-name -.Cx +.It Ic type Op Ar type-name Set the file transfer .Ic type to .Ar type-name . If no type is specified, the current type -is printed. The default type is network ASCII. -.Tp Cx Ic umask -.Ws -.Op Ar newmask -.Cx +is printed. +The default type is network +.Tn ASCII . +.It Ic umask Op Ar newmask Set the default umask on the remote server to .Ar newmask . If .Ar newmask is ommitted, the current umask is printed. -.Tp Cx Ic user -.Ws -.Ar user-name -.Ws +.It Xo +.Ic user Ar user-name .Op Ar password -.Ws .Op Ar account -.Cx -Identify yourself to the remote FTP server. If the +.Xc +Identify yourself to the remote +.Tn FTP +server. +If the .Ar password is not specified and the server requires it, .Nm ftp will prompt the user for it (after disabling local echo). If an .Ar account -field is not specified, and the FTP server +field is not specified, and the +.Tn FTP +server requires it, the user will be prompted for it. If an .Ar account @@ -925,19 +862,23 @@ Unless .Nm ftp is invoked with \*(Lqauto-login\*(Rq disabled, this process is done automatically on initial connection to -the FTP server. -.Tp Ic verbose -Toggle verbose mode. In verbose mode, all responses from -the FTP server are displayed to the user. In addition, +the +.Tn FTP +server. +.It Ic verbose +Toggle verbose mode. +In verbose mode, all responses from +the +.Tn FTP +server are displayed to the user. +In addition, if verbose is on, when a file transfer completes, statistics -regarding the efficiency of the transfer are reported. By default, +regarding the efficiency of the transfer are reported. +By default, verbose is on. -.Tp Cx Ic ? -.Ws -.Op Ar command -.Cx +.It Ic ? Op Ar command A synonym for help. -.Tp +.El .Pp Command arguments which have embedded spaces may be quoted with quote `"' marks. @@ -945,11 +886,16 @@ quote `"' marks. 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 +Receiving transfers will be halted by sending a ftp protocol +.Dv 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 +server's support for +.Dv ABOR +processing. +If the remote server does not support the +.Dv ABOR +command, an .Ql ftp> prompt will not appear until the remote server has completed sending the requested file. @@ -968,8 +914,8 @@ program must be killed by hand. Files specified as arguments to .Nm ftp commands are processed according to the following rules. -.Tw Ds -.Tp \&1) +.Bl -enum +.It If the file name .Sq Fl is specified, the @@ -977,7 +923,7 @@ is specified, the (for reading) or .Ar stdout (for writing) is used. -.Tp \&2) +.It If the first character of the file name is .Sq \&| , the @@ -986,10 +932,13 @@ remainder of the argument is interpreted as a shell command. then forks a shell, using .Xr 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. \*(Lq" ls -lt"\*(Rq. A particularly +(stdin). +If the shell command includes spaces, the argument +must be quoted; e.g. +\*(Lq" ls -lt"\*(Rq. +A particularly useful example of this mechanism is: \*(Lqdir more\*(Rq. -.Tp \&3) +.It Failing the above checks, if ``globbing'' is enabled, local file names are expanded according to the rules used in the @@ -1002,7 +951,7 @@ If the command expects a single local file (.e.g. .Ic put ) , only the first filename generated by the "globbing" operation is used. -.Tp \&4) +.It For .Ic mget commands and @@ -1017,7 +966,7 @@ setting. The resulting filename may then be altered if .Ic runique is on. -.Tp \&5) +.It For .Ic mput commands and @@ -1031,14 +980,18 @@ setting. The resulting filename may then be altered by the remote server if .Ic sunique is on. -.Tp +.El .Sh FILE TRANSFER PARAMETERS The FTP specification specifies many parameters which may -affect a file transfer. The +affect a file transfer. +The .Ic type may be one of \*(Lqascii\*(Rq, \*(Lqimage\*(Rq (binary), -\*(Lqebcdic\*(Rq, and \*(Lqlocal byte size\*(Rq (for PDP-10's -and PDP-20's mostly). +\*(Lqebcdic\*(Rq, and \*(Lqlocal byte size\*(Rq (for +.Tn PDP Ns -10's +and +.Tn PDP Ns -20's +mostly). .Nm Ftp supports the ascii and image types of file transfer, plus local byte size 8 for @@ -1060,11 +1013,8 @@ used by the auto-login process. It resides in the user's home directory. The following tokens are recognized; they may be separated by spaces, tabs, or new-lines: -.Tw password -.Tp Cx Ic machine -.Ws -.Ar name -.Cx +.Bl -tag -width password +.It Ic machine Ar name Identify a remote machine .Ar name . The auto-login process searches the @@ -1084,7 +1034,7 @@ stopping when the end of file is reached or another or a .Ic default token is encountered. -.Tp Ic default +.It Ic default This is the same as .Ic machine .Ar name @@ -1109,18 +1059,12 @@ This can be overridden by using the .Fl n flag to disable auto-login. -.Tp Cx Ic login -.Ws -.Ar name -.Cx +.It Ic login Ar name Identify a user on the remote machine. If this token is present, the auto-login process will initiate a login using the specified .Ar name . -.Tp Cx Ic password -.Ws -.Ar string -.Cx +.It Ic password Ar string Supply a password. If this token is present, the auto-login process will supply the specified string if the remote server requires a password as part @@ -1135,19 +1079,14 @@ will abort the auto-login process if the .Pa .netrc is readable by anyone besides the user. -.Tp Cx Ic account -.Ws -.Ar string -.Cx +.It Ic account Ar string Supply an additional account password. If this token is present, the auto-login process will supply the specified string if the remote server requires an additional account password, or the auto-login process will initiate an -ACCT command if it does not. -.Tp Cx Ic macdef -.Ws -.Ar name -.Cx +.Dv ACCT +command if it does not. +.It Ic macdef Ar name Define a macro. This token functions like the .Nm ftp @@ -1162,30 +1101,36 @@ If a macro named .Ic init is defined, it is automatically executed as the last step in the auto-login process. -.Tp +.El .Sh ENVIRONMENT .Nm Ftp utilizes the following environment variables. -.Tw Fl -.Tp Ev HOME +.Bl -tag -width Fl +.It Ev HOME For default location of a .Pa .netrc file, if one exists. -.Tp Ev SHELL +.It Ev SHELL For default shell. -.Tp +.El .Sh SEE ALSO .Xr ftpd 8 .Sh HISTORY -.Nm Ftp -appeared in 4.2 BSD. +The +.Nm ftp +command appeared in +.Bx 4.2 . .Sh BUGS Correct execution of many commands depends upon proper behavior by the remote server. .Pp An error in the treatment of carriage returns -in the 4.2BSD UNIX ascii-mode transfer code +in the +.Bx 4.2 +ascii-mode transfer code has been corrected. This correction may result in incorrect transfers of binary files -to and from 4.2BSD servers using the ascii type. +to and from +.Bx 4.2 +servers using the ascii type. Avoid this problem by using the binary image type.