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