update from rfg
[unix-history] / usr / src / usr.bin / ftp / ftp.1
CommitLineData
a154ee89 1.\" Copyright (c) 1985 Regents of the University of California.
9e7fc5bf
KM
2.\" All rights reserved. The Berkeley software License Agreement
3.\" specifies the terms and conditions for redistribution.
4.\"
2c32d7db 5.\" @(#)ftp.1 6.5 (Berkeley) %G%
9e7fc5bf 6.\"
a154ee89 7.TH FTP 1C "April 29, 1985"
9e7fc5bf
KM
8.UC 5
9.SH NAME
1609770c 10ftp \- ARPANET file transfer program
9e7fc5bf
KM
11.SH SYNOPSIS
12.B ftp
13[
14.B \-v
15] [
16.B \-d
17] [
18.B \-i
19] [
20.B \-n
21] [
22.B \-g
23] [
a154ee89 24.B host
9e7fc5bf
KM
25]
26.SH DESCRIPTION
27.I Ftp
28is the user interface to the ARPANET standard File Transfer Protocol.
a154ee89
GM
29The program allows a user to transfer files to and from a
30remote network site.
31.PP
9e7fc5bf
KM
32The client host with which
33.I ftp
34is to communicate may be specified on the command line.
35If this is done,
36.I ftp
a154ee89
GM
37will immediately attempt to establish a connection to an FTP
38server on that host; otherwise,
39.I ftp
40will enter its command interpreter and await instructions
41from the user. When
42.I ftp
43is awaiting commands from the user the prompt \*(lqftp>\*(rq
44is provided the user. The following commands are recognized
9e7fc5bf
KM
45by
46.IR ftp :
47.TP
a154ee89
GM
48\fB\&!\fP [ \fIcommand\fP [ \fIargs\fP ] ]
49Invoke an interactive shell on the local machine.
50If there are arguments, the first is taken to be a command to execute
51directly, with the rest of the arguments as its arguments.
52.TP
53\fB\&$\fP \fImacro-name\fP [ \fIargs\fP ]
54Execute the macro \fImacro-name\fP that was defined with the
55\fBmacdef\fP command.
56Arguments are passed to the macro unglobbed.
57.TP
58\fBaccount\fP [ \fIpasswd\fP ]
59Supply a supplemental password required by a remote system for access
60to resources once a login has been successfully completed.
61If no argument is included, the user will be prompted for an account
62password in a non-echoing input mode.
9e7fc5bf
KM
63.TP
64\fBappend\fP \fIlocal-file\fP [ \fIremote-file\fP ]
65Append a local file to a file on the remote machine. If
66.I remote-file
67is left unspecified, the local file name is used in naming the
a154ee89
GM
68remote file after being altered by any
69.I ntrans
70or
71.I nmap
72setting.
73File transfer uses the current settings for
74.IR type ,
75.IR format ,
76.IR mode ,
77and
78.IR structure .
9e7fc5bf
KM
79.TP
80.B ascii
a154ee89
GM
81Set the file transfer
82.I type
83to network ASCII. This is the default type.
9e7fc5bf
KM
84.TP
85.B bell
86Arrange that a bell be sounded after each file transfer
87command is completed.
88.TP
89.B binary
a154ee89
GM
90Set the file transfer
91.I type
92to support binary image transfer.
9e7fc5bf
KM
93.TP
94.B bye
95Terminate the FTP session with the remote server
96and exit
97.IR ftp .
3c604e97 98An end of file will also terminate the session and exit.
9e7fc5bf 99.TP
a154ee89
GM
100.B case
101Toggle remote computer file name case mapping during
102.B mget
103commands.
104When
105.B case
106is on (default is off), remote computer file names with all letters in
107upper case are written in the local directory with the letters mapped
108to lower case.
109.TP
9e7fc5bf
KM
110.BI cd " remote-directory"
111Change the working directory on the remote machine
112to
113.IR remote-directory .
114.TP
a154ee89
GM
115.B cdup
116Change the remote machine working directory to the parent of the
117current remote machine working directory.
118.TP
9e7fc5bf
KM
119.B close
120Terminate the FTP session with the remote server, and
121return to the command interpreter.
a154ee89
GM
122Any defined macros are erased.
123.TP
124.B cr
125Toggle carriage return stripping during
126ascii type file retrieval.
127Records are denoted by a carriage return/linefeed sequence
128during ascii type file transfer.
129When
130.B cr
131is on (the default), carriage returns are stripped from this
132sequence to conform with the UNIX single linefeed record
133delimiter.
134Records on non-UNIX remote systems may contain single linefeeds;
135when an ascii type transfer is made, these linefeeds may be
136distinguished from a record delimiter only when
137.B cr
138is off.
9e7fc5bf
KM
139.TP
140.BI delete " remote-file"
141Delete the file
142.I remote-file
143on the remote machine.
144.TP
145\fBdebug\fP [ \fIdebug-value\fP ]
146Toggle debugging mode. If an optional
147.I debug-value
148is specified it is used to set the debugging level.
149When debugging is on,
150.I ftp
151prints each command sent to the remote machine, preceded
152by the string \*(lq-->\*(rq.
153.TP
154\fBdir\fP [ \fIremote-directory\fP ] [ \fIlocal-file\fP ]
155Print a listing of the directory contents in the
156directory,
157.IR remote-directory ,
158and, optionally, placing the output in
159.IR local-file .
160If no directory is specified, the current working
161directory on the remote machine is used. If no local
a154ee89 162file is specified, or \fIlocal-file\fP is \fB-\fP,
1609770c 163output comes to the terminal.
9e7fc5bf 164.TP
a154ee89
GM
165.B disconnect
166A synonym for
167.BR close .
168.TP
169.BI form " format"
170Set the file transfer
171.I form
172to
173.IR format .
174The default format is \*(lqfile\*(rq.
9e7fc5bf
KM
175.TP
176\fBget\fP \fIremote-file\fP [ \fIlocal-file\fP ]
177Retrieve the
178.I remote-file
179and store it on the local machine. If the local
180file name is not specified, it is given the same
a154ee89
GM
181name it has on the remote machine, subject to
182alteration by the current
183.IR case ,
184.IR ntrans ,
185and
186.I nmap
187settings.
188The current settings for
189.IR type ,
190.IR form ,
191.IR mode ,
192and
193.I structure
9e7fc5bf
KM
194are used while transferring the file.
195.TP
a154ee89
GM
196\fBglob\fP
197Toggle filename expansion for \fBmdelete\fP, \fBmget\fP and \fBmput\fP.
198If globbing is turned off with \fBglob\fP, the file name arguments
199are taken literally and not expanded.
200Globbing for \fBmput\fP is done as in \fBcsh\fP(1).
201For \fBmdelete\fP and \fBmget\fP, each remote file name is expanded
202separately on the remote machine and the lists are not merged.
203Expansion of a directory name is likely to be
1609770c 204different from expansion of the name of an ordinary file:
a154ee89
GM
205the exact result depends on the foreign operating system and ftp server,
206and can be previewed by doing `\fBmls\fP\ \fIremote-files\fP\ \fB-\fP'.
207Note: \fBmget\fP and \fBmput\fP are not meant to transfer
208entire directory subtrees of files. That can be done by
209transferring a \fBtar\fP(1) archive of the subtree (in binary mode).
1609770c 210.TP
a154ee89 211\fBhash\f
9e7fc5bf
KM
212Toggle hash-sign (``#'') printing for each data block
213transferred. The size of a data block is 1024 bytes.
214.TP
9e7fc5bf
KM
215\fBhelp\fP [ \fIcommand\fP ]
216Print an informative message about the meaning of
217.IR command .
218If no argument is given,
219.I ftp
220prints a list of the known commands.
221.TP
222\fBlcd\fP [ \fIdirectory\fP ]
223Change the working directory on the local machine. If
224no
225.I directory
226is specified, the user's home directory is used.
227.TP
228\fBls\fP [ \fIremote-directory\fP ] [ \fIlocal-file\fP ]
229Print an abbreviated listing of the contents of a
230directory on the remote machine. If
231.I remote-directory
232is left unspecified, the current working directory
a154ee89 233is used. If no local file is specified, or if \fIlocal-file\fR is \fB-\fR,
1609770c
KM
234the output is sent to the terminal.
235.TP
a154ee89
GM
236\fBmacdef\fP \fImacro-name\fP
237Define a macro.
238Subsequent lines are stored as the macro
239\fImacro-name\fP; a null line (consecutive newline characters
240in a file or
241carriage returns from the terminal) terminates macro input mode.
242There is a limit of 16 macros and 4096 total characters in all
243defined macros.
244Macros remain defined until a
245.B close
246command is executed.
247The macro processor interprets '$' and '\\' as special characters.
248A '$' followed by a number (or numbers) is replaced by the
249corresponding argument on the macro invocation command line.
250A '$' followed by an 'i' signals that macro processor that the
251executing macro is to be looped. On the first pass '$i' is
252replaced by the first argument on the macro invocation command line,
253on the second pass it is replaced by the second argument, and so on.
254A '\\' followed by any character is replaced by that character.
255Use the '\\' to prevent special treatment of the '$'.
256.TP
1609770c
KM
257\fBmdelete\fP [ \fIremote-files\fP ]
258Delete the \fIremote-files\fP on the remote machine.
259.TP
cd800a97 260\fBmdir\fP \fIremote-files\fP \fIlocal-file\fP
1609770c 261Like \fBdir\fP, except multiple remote files may be specified.
a154ee89
GM
262If interactive prompting is on,
263.I ftp
264will prompt the user to verify that the last argument is indeed the
265target local file for receiving
266.B mdir
267output.
9e7fc5bf
KM
268.TP
269\fBmget\fP \fIremote-files\fP
1609770c
KM
270Expand the \fIremote-files\fP on the remote machine
271and do a \fBget\fP for each file name thus produced.
272See \fBglob\fR for details on the filename expansion.
a154ee89
GM
273Resulting file names will then be processed according to
274.IR case ,
275.IR ntrans ,
276and
277.I nmap
278settings.
1609770c 279Files are transferred into the local working directory,
a154ee89
GM
280which can be changed with `\fBlcd\fP\ directory';
281new local directories can be created with `\fB!\fP\ mkdir\ directory'.
9e7fc5bf
KM
282.TP
283\fBmkdir\fP \fIdirectory-name\fP
284Make a directory on the remote machine.
285.TP
cd800a97 286\fBmls\fP \fIremote-files\fP \fIlocal-file\fP
1609770c 287Like \fBls\fP, except multiple remote files may be specified.
a154ee89
GM
288If interactive prompting is on,
289.I ftp
290will prompt the user to verify that the last argument is indeed the
291target local file for receiving
292.B mls
293output.
9e7fc5bf
KM
294.TP
295\fBmode\fP [ \fImode-name\fP ]
a154ee89
GM
296Set the file transfer
297.I mode
298to
9e7fc5bf 299.IR mode-name .
a154ee89 300The default mode is \*(lqstream\*(rq mode.
9e7fc5bf
KM
301.TP
302\fBmput\fP \fIlocal-files\fP
1609770c
KM
303Expand wild cards in the list of local files given as arguments
304and do a \fBput\fR for each file in the resulting list.
305See \fBglob\fP for details of filename expansion.
a154ee89
GM
306Resulting file names will then be processed according to
307.I ntrans
308and
309.I nmap
310settings.
311.TP
312\fBnmap\fP [ \fIinpattern\fP \fIoutpattern\fP ]
313Set or unset the filename mapping mechanism.
314If no arguments are specified, the filename mapping mechanism is unset.
315If arguments are specified, remote filenames are mapped during
316.B mput
317commands and
318.B put
319commands issued without a specified remote target filename.
320If arguments are specified, local filenames are mapped during
321.B mget
322commands and
323.B get
324commands issued without a specified local target filename.
325This command is useful when connecting to a non-UNIX remote computer
326with different file naming conventions or practices.
327The mapping follows the pattern set by
328.I inpattern
329and
330.IR outpattern .
331.I Inpattern
332is a template for incoming filenames (which may have already been
333processed according to the
334.B ntrans
335and
336.B case
337settings).
2c32d7db 338Variable templating is accomplished by including the sequences '$1', '$2', ..., '$9' in
a154ee89
GM
339.IR inpattern .
340Use '\\' to prevent this special treatment of the '$' character.
341All other characters are treated literally, and are used to determine the
342.B nmap
343.I inpattern
344variable values.
345For exmaple, given
346.I inpattern
347$1.$2 and the remote file name "mydata.data", $1 would have the value
348"mydata", and $2 would have the value "data".
349The
350.I outpattern
351determines the resulting mapped filename.
352The sequences '$1', '$2', ...., '$9' are replaced by any value resulting
353from the
354.I inpattern
355template.
356The sequence '$0' is replace by the original filename.
357Additionally, the sequence '[\fIseq1\fP,\fIseq2\f\P]' is replaced by
358.I seq1
359if
360.I seq1
361is not a null string; otherwise it is replaced by
362.IR seq2 .
363For example, the command "nmap $1.$2.$3 [$1,$2].[$2,file]" would yield
364the output filename "myfile.data" for input filenames "myfile.data" and
365"myfile.data.old", "myfile.file" for the input filename "myfile", and
366"myfile.myfile" for the input filename ".myfile".
367Spaces may be included in
368.IR outpattern ,
369as in the example: nmap $1 |sed "s/ *$//" > $1 .
370Use the '\\' character to prevent special treatment
371of the '$', '[', ']', and ',' characters.
372.TP
373\fBntrans\fP [ \fIinchars\fP [ \fIoutchars\fP ] ]
374Set or unset the filename character translation mechanism.
375If no arguments are specified, the filename character
376translation mechanism is unset.
377If arguments are specified, characters in
378remote filenames are translated during
379.B mput
380commands and
381.B put
382commands issued without a specified remote target filename.
383If arguments are specified, characters in
384local filenames are translated during
385.B mget
386commands and
387.B get
388commands issued without a specified local target filename.
389This command is useful when connecting to a non-UNIX remote computer
390with different file naming conventions or practices.
391Characters in a filename matching a character in
392.I inchars
393are replaced with the corresponding character in
394.IR outchars .
395If the character's position in
396.I inchars
397is longer than the length of
398.IR outchars ,
399the character is deleted from the file name.
9e7fc5bf
KM
400.TP
401\fBopen\fP \fIhost\fP [ \fIport\fP ]
402Establish a connection to the specified
403.I host
404FTP server. An optional port number may be supplied,
405in which case,
406.I ftp
407will attempt to contact an FTP server at that port.
408If the
409.I auto-login
410option is on (default),
411.I ftp
412will also attempt to automatically log the user in to
413the FTP server (see below).
414.TP
415.B prompt
416Toggle interactive prompting. Interactive prompting
417occurs during multiple file transfers to allow the
1609770c 418user to selectively retrieve or store files.
a154ee89 419If prompting is turned off (default is on), any \fBmget\fP or \fBmput\fP
1609770c 420will transfer all files, and any \fBmdelete\fP will delete all files.
9e7fc5bf 421.TP
a154ee89
GM
422\fBproxy\fP \fIftp-command\fP
423Execute an ftp command on a secondary control connection.
424This command allows simultaneous connection to two remote ftp
425servers for transferring files between the two servers.
426The first
427.B proxy
428command should be an
429.BR open ,
430to establish the secondary control connection.
431Enter the command "proxy ?" to see other ftp commands executable on the
432secondary connection.
433The following commands behave diffrently when prefaced by
434.BR proxy :
435.B open
436will not define new macros during the auto-login process,
437.B close
438will not erase existing macro definitions,
439.B get
440and
441.B mget
442transfer files from the host on the primary control connection
443to the host on the secondary control connection, and
444.BR put ,
445.BR mput ,
446and
447.B append
448transfer files from the host on the secondary control connection
449to the host on the primary control connection.
450Third party file transfers depend upon support of the ftp protocol
451PASV command by the server on the secondary control connection.
452.TP
9e7fc5bf
KM
453\fBput\fP \fIlocal-file\fP [ \fIremote-file\fP ]
454Store a local file on the remote machine. If
455.I remote-file
456is left unspecified, the local file name is used
a154ee89
GM
457after processing according to any
458.I ntrans
459or
460.I nmap
461settings
9e7fc5bf 462in naming the remote file. File transfer uses the
a154ee89
GM
463current settings for
464.IR type ,
465.IR format ,
466.IR mode ,
467and
468.IR structure .
9e7fc5bf
KM
469.TP
470.B pwd
471Print the name of the current working directory on the remote
472machine.
473.TP
474.B quit
3c604e97
JL
475A synonym for
476.BR bye .
9e7fc5bf 477.TP
a154ee89
GM
478.BI quote " arg1 arg2 ..."
479The arguments specified are sent, verbatim, to the remote FTP
480server.
9e7fc5bf
KM
481.TP
482\fBrecv\fP \fIremote-file\fP [ \fIlocal-file\fP ]
a154ee89 483A synonym for get.
9e7fc5bf
KM
484.TP
485\fBremotehelp\fP [ \fIcommand-name\fP ]
486Request help from the remote FTP server. If a
487.I command-name
488is specified it is supplied to the server as well.
489.TP
a154ee89 490\fBrename\fP [ \fIfrom\fP ] [ \fIto\fP ]
9e7fc5bf
KM
491Rename the file
492.I from
a154ee89 493on the remote machine, to the file
9e7fc5bf
KM
494.IR to .
495.TP
a154ee89
GM
496.B reset
497Clear reply queue.
498This command re-synchronizes command/reply sequencing with the remote
499ftp server.
500Resynchronization may be neccesary following a violation of the ftp protocol
501by the remote server.
502.TP
9e7fc5bf
KM
503.BI rmdir " directory-name"
504Delete a directory on the remote machine.
505.TP
a154ee89
GM
506.B runique
507Toggle storing of files on the local system with unique filenames.
508If a file already exists with a name equal to the target
509local filename for a
510.B get
511or
512.B mget
2c32d7db 513command, a ".1" is appended to the name.
a154ee89
GM
514If the resulting name matches another existing file,
515a ".2" is appended to the original name.
516If this process continues up to ".99", an error
517message is printed, and the transfer does not take place.
518The generated unique filename will be reported.
519Note that
520.B runique
521will not affect local files generated from a shell command
522(see below).
523The default value is off.
524.TP
9e7fc5bf 525\fBsend\fP \fIlocal-file\fP [ \fIremote-file\fP ]
a154ee89 526A synonym for put.
9e7fc5bf
KM
527.TP
528.B sendport
529Toggle the use of PORT commands. By default,
530.I ftp
531will attempt to use a PORT command when establishing
a154ee89
GM
532a connection for each data transfer.
533The use of PORT commands can prevent delays
534when performing multiple file transfers. If the PORT
9e7fc5bf
KM
535command fails,
536.I ftp
537will use the default data port. When the use of PORT
538commands is disabled, no attempt will be made to use
539PORT commands for each data transfer. This is useful
a154ee89
GM
540for certain FTP implementations which do ignore PORT
541commands but, incorrectly, indicate they've been accepted.
9e7fc5bf
KM
542.TP
543.B status
544Show the current status of
545.IR ftp .
546.TP
547\fBstruct\fP [ \fIstruct-name\fP ]
a154ee89
GM
548Set the file transfer
549.I structure
550to
9e7fc5bf 551.IR struct-name .
a154ee89
GM
552By default \*(lqstream\*(rq structure is used.
553.TP
554.B sunique
555Toggle storing of files on remote machine under unique file names.
556Remote ftp server must support ftp protocol STOU command for
557successful completion.
558The remote server will report unique name.
559Default value is off.
9e7fc5bf
KM
560.TP
561.B tenex
a154ee89 562Set the file transfer type to that needed to
9e7fc5bf
KM
563talk to TENEX machines.
564.TP
565.B trace
a154ee89 566Toggle packet tracing.
9e7fc5bf
KM
567.TP
568\fBtype\fP [ \fItype-name\fP ]
a154ee89
GM
569Set the file transfer
570.I type
571to
9e7fc5bf
KM
572.IR type-name .
573If no type is specified, the current type
a154ee89 574is printed. The default type is network ASCII.
9e7fc5bf
KM
575.TP
576\fBuser\fP \fIuser-name\fP [ \fIpassword\fP ] [ \fIaccount\fP ]
577Identify yourself to the remote FTP server. If the
578password is not specified and the server requires it,
579.I ftp
580will prompt the user for it (after disabling local echo).
581If an account field is not specified, and the FTP server
a154ee89
GM
582requires it, the user will be prompted for it.
583If an account field is specified, an account command will
584be relayed to the remote server after the login sequence
585is completed if the remote server did not require it
586for logging in.
587Unless
9e7fc5bf
KM
588.I ftp
589is invoked with \*(lqauto-login\*(rq disabled, this
590process is done automatically on initial connection to
591the FTP server.
592.TP
593.B verbose
594Toggle verbose mode. In verbose mode, all responses from
595the FTP server are displayed to the user. In addition,
a154ee89 596if verbose is on, when a file transfer completes, statistics
9e7fc5bf 597regarding the efficiency of the transfer are reported. By default,
a154ee89 598verbose is on.
9e7fc5bf
KM
599.TP
600\fB?\fP [ \fIcommand\fP ]
a154ee89
GM
601A synonym for help.
602.PP
9e7fc5bf
KM
603Command arguments which have embedded spaces may be quoted with
604quote (") marks.
a154ee89
GM
605.SH "ABORTING A FILE TRANSFER"
606To abort a file transfer, enter the terminal interrupt key sequence
607(usually Ctrl-C).
608Sending transfers will be immediately halted.
609Receiving transfers will be halted by sending a ftp protocol ABOR
610command to the remote server, and discarding any further data received.
611The speed at which this is accomplished depends upon the remote
612server's support for ABOR processing.
613If the remote server does not support the ABOR command, a "ftp>"
614prompt will not appear until the remote server has completed
615sending the requested file.
616.PP
617The terminal interrupt key sequence will be ignored when
618.I ftp
619has completed any local processing and is awaiting a reply
620from the remote server.
621A long delay in this mode may result from the ABOR processing described
622above, or from unexpected behavior by the remote server, including
623violations of the ftp protocol.
624If the delay results from unexpected remote server behavior, the local
cd800a97 625.I ftp
a154ee89 626program must be killed by hand.
9e7fc5bf 627.SH "FILE NAMING CONVENTIONS"
a154ee89 628Files specified as arguments to
9e7fc5bf
KM
629.I ftp
630commands are processed according to the following rules.
631.TP
6321)
a154ee89
GM
633If the file name \*(lq\-\*(rq is specified, the
634.B stdin
635(for reading) or
636.B stdout
9e7fc5bf
KM
637(for writing) is used.
638.TP
6392)
640If the first character of the file name is \*(lq|\*(rq, the
641remainder of the argument is interpreted as a shell command.
a154ee89 642.I Ftp
9e7fc5bf 643then forks a shell, using
a154ee89
GM
644.IR popen (3)
645with the argument supplied, and reads (writes) from the stdout
646(stdin). If the shell command includes spaces, the argument
9e7fc5bf
KM
647must be quoted; e.g. \*(lq"| ls -lt"\*(rq. A particularly
648useful example of this mechanism is: \*(lqdir |more\*(rq.
649.TP
6503)
a154ee89 651Failing the above checks, if ``globbing'' is enabled,
9e7fc5bf
KM
652local file names are expanded
653according to the rules used in the
654.IR csh (1);
a154ee89 655c.f. the
9e7fc5bf 656.I glob
a154ee89
GM
657command.
658If the
659.I ftp
660command expects a single local file ( .e.g.
661.BR put ),
662only the first filename generated by the "globbing" operation is used.
663.TP
6644)
665For
666.B mget
667commands and
668.B get
669commands with unspecified local file names, the local filename is
670the remote filename, which may be altered by a
671.BR case ,
672.BR ntrans ,
673or
674.B nmap
675setting.
676The resulting filename may then be altered if
677.B runique
678is on.
679.TP
6805)
681For
682.B mput
683commands and
684.B put
685commands with unspecified remote file names, the remote filename is
686the local filename, which may be altered by a
687.B ntrans
688or
689.B nmap
690setting.
691The resulting filename may then be altered by the remote server if
692.B sunique
693is on.
9e7fc5bf
KM
694.SH "FILE TRANSFER PARAMETERS"
695The FTP specification specifies many parameters which may
a154ee89
GM
696affect a file transfer. The
697.I type
698may be one of \*(lqascii\*(rq, \*(lqimage\*(rq (binary),
699\*(lqebcdic\*(rq, and \*(lqlocal byte size\*(rq (for PDP-10's
700and PDP-20's mostly).
701.I Ftp
702supports the ascii and image types of file transfer,
703plus local byte size 8 for \fBtenex\fP mode transfers.
704.PP
705.I Ftp
706supports only the default values for the remaining
707file transfer parameters:
708.IR mode ,
709.IR form ,
710and
711.IR struct .
9e7fc5bf
KM
712.SH OPTIONS
713Options may be specified at the command line, or to the
714command interpreter.
a154ee89
GM
715.PP
716The
9e7fc5bf 717.B \-v
a154ee89 718(verbose on) option forces
9e7fc5bf 719.I ftp
a154ee89
GM
720to show all responses from the remote server, as well
721as report on data transfer statistics.
722.PP
723The
9e7fc5bf 724.B \-n
a154ee89
GM
725option restrains
726.I ftp
727from attempting \*(lqauto-login\*(rq upon initial connection.
9e7fc5bf
KM
728If auto-login is enabled,
729.I ftp
a154ee89
GM
730will check the
731.I .netrc
732(see below) file in the user's home directory for an entry describing
9e7fc5bf
KM
733an account on the remote machine. If no entry exists,
734.I ftp
a154ee89
GM
735will prompt for the remote machine login name (default is the user
736identity on the local machine), and, if necessary, prompt for a password
737and an account with which to login.
738.PP
739The
9e7fc5bf 740.B \-i
a154ee89
GM
741option turns off interactive prompting during
742multiple file transfers.
743.PP
744The
cd800a97 745.B \-d
a154ee89
GM
746option enables debugging.
747.PP
748The
749.B \-g
750option disables file name globbing.
751.SH "THE .netrc FILE"
752The .netrc file contains login and initialization information
753used by the auto-login process.
754It resides in the user's home directory.
755The following tokens are recognized; they may be separated by spaces,
756tabs, or new-lines:
757.TP
758\fBmachine\fP \fIname\fP
759Identify a remote machine name.
760The auto-login process searches the .netrc file for a
761.B machine
2c32d7db 762token that matches the remote machine specified on the
a154ee89
GM
763.I ftp
764command line or as an
765.B open
766command argument.
a154ee89
GM
767Once a match is made, the subsequent .netrc tokens are processed,
768stopping when the end of file is reached or another
769.B machine
770token is encountered.
771.TP
772\fBlogin\fP \fIname\fP
773Identify a user on the remote machine.
774If this token is present, the auto-login process will initiate
775a login using the specified name.
776.TP
777\fBpassword\fP \fIstring\fP
778Supply a password.
779If this token is present, the auto-login process will supply the
780specified string if the remote server requires a password as part
781of the login process.
782Note that if this token is present in the .netrc file,
783.I ftp
784will abort the auto-login process if the .netrc is readable by
785anyone besides the user.
786.TP
787\fBaccount\fP \fIstring\fP
788Supply an additional account password.
789If this token is present, the auto-login process will supply the
790specified string if the remote server requires an additional
791account password, or the auto-login process will initiate an
792ACCT command if it does not.
793.TP
794\fBmacdef\fP \fIname\fP
795Define a macro.
796This token functions like the
797.I ftp
798.B macdef
799command functions.
800A macro is defined with the specified name; its contents begin with the
801next .netrc line and continue until a null line (consecutive new-line
802characters) is encountered.
803If a macro named
804.I init
805is defined, it is automatically executed as the last step in the
806auto-login process.
9e7fc5bf 807.SH BUGS
a154ee89
GM
808Correct execution of many commands depends upon proper behavior
809by the remote server.
cd800a97 810.PP
a154ee89
GM
811A protocol violation present in the UNIX 4.2 ascii transfer code
812has been corrected.
813This correction may result in incorrect transfers of binary files
814to and from UNIX 4.2 remote servers using the ascii type.
815Avoid this problem by using the binary image type.