|
|
1.1 root 1: .\" Copyright (c) 1985, 1989, 1990 The Regents of the University of California.
2: .\" All rights reserved.
3: .\"
4: .\" Redistribution and use in source and binary forms are permitted provided
5: .\" that: (1) source distributions retain this entire copyright notice and
6: .\" comment, and (2) distributions including binaries display the following
7: .\" acknowledgement: ``This product includes software developed by the
8: .\" University of California, Berkeley and its contributors'' in the
9: .\" documentation or other materials provided with the distribution and in
10: .\" all advertising materials mentioning features or use of this software.
11: .\" Neither the name of the University nor the names of its contributors may
12: .\" be used to endorse or promote products derived from this software without
13: .\" specific prior written permission.
14: .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
15: .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
16: .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17: .\"
18: .\" @(#)ftp.1 6.15 (Berkeley) 7/24/90
19: .\"
20: .Dd July 24, 1990
21: .Dt FTP 1
22: .Os BSD 4.2
23: .Sh NAME
24: .Nm ftp
25: .Nd ARPANET file transfer program
26: .Sh SYNOPSIS
27: .Nm ftp
28: .Op Fl v
29: .Op Fl d
30: .Op Fl i
31: .Op Fl n
32: .Op Fl g
33: .Op Ar host
34: .Sh DESCRIPTION
35: .Nm Ftp
36: is the user interface to the ARPANET standard File Transfer Protocol.
37: The program allows a user to transfer files to and from a
38: remote network site.
39: .Pp
40: Options may be specified at the command line, or to the
41: command interpreter.
42: .Tw Ds
43: .Tp Fl v
44: Verbose option forces
45: .Nm ftp
46: to show all responses from the remote server, as well
47: as report on data transfer statistics.
48: .Tp Fl n
49: Restrains
50: .Nm ftp
51: from attempting \*(Lqauto-login\*(Rq upon initial connection.
52: If auto-login is enabled,
53: .Nm ftp
54: will check the
55: .Pa .netrc
56: (see below) file in the user's home directory for an entry describing
57: an account on the remote machine. If no entry exists,
58: .Nm ftp
59: will prompt for the remote machine login name (default is the user
60: identity on the local machine), and, if necessary, prompt for a password
61: and an account with which to login.
62: .Tp Fl i
63: Turns off interactive prompting during
64: multiple file transfers.
65: .Tp Fl d
66: Enables debugging.
67: .Tp Fl g
68: Disables file name globbing.
69: .Tp
70: .Pp
71: The client host with which
72: .Nm ftp
73: is to communicate may be specified on the command line.
74: If this is done,
75: .Nm ftp
76: will immediately attempt to establish a connection to an FTP
77: server on that host; otherwise,
78: .Nm ftp
79: will enter its command interpreter and await instructions
80: from the user. When
81: .Nm ftp
82: is awaiting commands from the user the prompt
83: .Ql ftp>
84: is provided to the user. The following commands are recognized
85: by
86: .Nm ftp :
87: .Tw Fl
88: .Tp Cx Ic \&!
89: .Ws
90: .Op Ar command Op Ar args
91: .Cx
92: Invoke an interactive shell on the local machine.
93: If there are arguments, the first is taken to be a command to execute
94: directly, with the rest of the arguments as its arguments.
95: .Tp Cx Ic \&$
96: .Ws
97: .Ar macro-name
98: .Op Ar args
99: .Cx
100: Execute the macro
101: .Ar macro-name
102: that was defined with the
103: .Ic macdef
104: command.
105: Arguments are passed to the macro unglobbed.
106: .Tp Cx Ic account
107: .Ws
108: .Op Ar passwd
109: .Cx
110: Supply a supplemental password required by a remote system for access
111: to resources once a login has been successfully completed.
112: If no argument is included, the user will be prompted for an account
113: password in a non-echoing input mode.
114: .Tp Cx Ic append
115: .Ws
116: .Ar local-file
117: .Ws
118: .Op Ar remote-file
119: .Cx
120: Append a local file to a file on the remote machine. If
121: .Ar remote-file
122: is left unspecified, the local file name is used in naming the
123: remote file after being altered by any
124: .Ic ntrans
125: or
126: .Ic nmap
127: setting.
128: File transfer uses the current settings for
129: .Ic type ,
130: .Ic format ,
131: .Ic mode ,
132: and
133: .Ic structure .
134: .Tp Ic ascii
135: Set the file transfer
136: .Ic type
137: to network ASCII. This is the default type.
138: .Tp Ic bell
139: Arrange that a bell be sounded after each file transfer
140: command is completed.
141: .Tp Ic binary
142: Set the file transfer
143: .Ic type
144: to support binary image transfer.
145: .Tp Ic bye
146: Terminate the FTP session with the remote server
147: and exit
148: .Nm ftp .
149: An end of file will also terminate the session and exit.
150: .Tp Ic case
151: Toggle remote computer file name case mapping during
152: .Ic mget
153: commands.
154: When
155: .Ic case
156: is on (default is off), remote computer file names with all letters in
157: upper case are written in the local directory with the letters mapped
158: to lower case.
159: .Tp Cx Ic cd
160: .Ws
161: .Ar remote-directory
162: .Cx
163: Change the working directory on the remote machine
164: to
165: .Ar remote-directory .
166: .Tp Ic cdup
167: Change the remote machine working directory to the parent of the
168: current remote machine working directory.
169: .Tp Cx Ic chmod
170: .Ws
171: .Ar mode file-name
172: .Cx
173: Change the permission modes of the file
174: .Ar file-name
175: on the remote
176: sytem to
177: .Ar mode .
178: .Tp Ic close
179: Terminate the FTP session with the remote server, and
180: return to the command interpreter.
181: Any defined macros are erased.
182: .Tp Ic cr
183: Toggle carriage return stripping during
184: ascii type file retrieval.
185: Records are denoted by a carriage return/linefeed sequence
186: during ascii type file transfer.
187: When
188: .Ic cr
189: is on (the default), carriage returns are stripped from this
190: sequence to conform with the UNIX single linefeed record
191: delimiter.
192: Records on non-UNIX remote systems may contain single linefeeds;
193: when an ascii type transfer is made, these linefeeds may be
194: distinguished from a record delimiter only when
195: .Ic cr
196: is off.
197: .Tp Cx Ic delete
198: .Ws
199: .Ar remote-file
200: .Cx
201: Delete the file
202: .Ar remote-file
203: on the remote machine.
204: .Tp Cx Ic debug
205: .Ws
206: .Op Ar debug-value
207: .Cx
208: Toggle debugging mode. If an optional
209: .Ar debug-value
210: is specified it is used to set the debugging level.
211: When debugging is on,
212: .Nm ftp
213: prints each command sent to the remote machine, preceded
214: by the string
215: .Ql \-\->
216: .Tp Cx Ic dir
217: .Ws
218: .Op Ar remote-directory
219: .Ws
220: .Op Ar local-file
221: .Cx
222: Print a listing of the directory contents in the
223: directory,
224: .Ar remote-directory ,
225: and, optionally, placing the output in
226: .Ar local-file .
227: If interactive prompting is on,
228: .Nm ftp
229: will prompt the user to verify that the last argument is indeed the
230: target local file for receiving
231: .Ic dir
232: output.
233: If no directory is specified, the current working
234: directory on the remote machine is used. If no local
235: file is specified, or
236: .Ar local-file
237: is
238: .Fl ,
239: output comes to the terminal.
240: .Tp Ic disconnect
241: A synonym for
242: .Ar close .
243: .Tp Cx Ic form
244: .Ws
245: .Ar format
246: .Cx
247: Set the file transfer
248: .Ic form
249: to
250: .Ar format .
251: The default format is \*(Lqfile\*(Rq.
252: .Tp Cx Ic get
253: .Ws
254: .Ar remote-file
255: .Ws
256: .Op Ar local-file
257: .Cx
258: Retrieve the
259: .Ar remote-file
260: and store it on the local machine. If the local
261: file name is not specified, it is given the same
262: name it has on the remote machine, subject to
263: alteration by the current
264: .Ic case ,
265: .Ic ntrans ,
266: and
267: .Ic nmap
268: settings.
269: The current settings for
270: .Ic type ,
271: .Ic form ,
272: .Ic mode ,
273: and
274: .Ic structure
275: are used while transferring the file.
276: .Tp Ic glob
277: Toggle filename expansion for
278: .Ic mdelete ,
279: .Ic mget
280: and
281: .Ic mput .
282: If globbing is turned off with
283: .Ic glob ,
284: the file name arguments
285: are taken literally and not expanded.
286: Globbing for
287: .Ic mput
288: is done as in
289: .Xr csh 1 .
290: For
291: .Ic mdelete
292: and
293: .Ic mget ,
294: each remote file name is expanded
295: separately on the remote machine and the lists are not merged.
296: Expansion of a directory name is likely to be
297: different from expansion of the name of an ordinary file:
298: the exact result depends on the foreign operating system and ftp server,
299: and can be previewed by doing
300: .Ql mls remote-files \-
301: Note:
302: .Ic mget
303: and
304: .Ic mput
305: are not meant to transfer
306: entire directory subtrees of files. That can be done by
307: transferring a
308: .Xr tar 1
309: archive of the subtree (in binary mode).
310: .Tp Ic hash
311: Toggle hash-sign (``#'') printing for each data block
312: transferred. The size of a data block is 1024 bytes.
313: .Tp Cx Ic help
314: .Ws
315: .Op Ar command
316: .Cx
317: Print an informative message about the meaning of
318: .Ar command .
319: If no argument is given,
320: .Nm ftp
321: prints a list of the known commands.
322: .Tp Cx Ic idle
323: .Ws
324: .Op Ar seconds
325: .Cx
326: Set the inactivity timer on the remote server to
327: .Ar seconds
328: seconds.
329: If
330: .Ar seconds
331: is ommitted, the current inactivity timer is printed.
332: .Tp Cx Ic lcd
333: .Ws
334: .Op Ar directory
335: .Cx
336: Change the working directory on the local machine. If
337: no
338: .Ar directory
339: is specified, the user's home directory is used.
340: .Tp Cx Ic ls
341: .Ws
342: .Op Ar remote-directory
343: .Ws
344: .Op Ar local-file
345: .Cx
346: Print a listing of the contents of a
347: directory on the remote machine.
348: The listing includes any system-dependent information that the server
349: chooses to include; for example, most UNIX systems will produce
350: output from the command
351: .Ql ls \-l .
352: (See also
353: .Ic nlist .
354: )
355: If
356: .Ar remote-directory
357: is left unspecified, the current working directory is used.
358: If interactive prompting is on,
359: .Nm ftp
360: will prompt the user to verify that the last argument is indeed the
361: target local file for receiving
362: .Ic ls
363: output.
364: If no local file is specified, or if
365: .Ar local-file
366: is
367: .Sq Fl ,
368: the output is sent to the terminal.
369: .Tp Cx Ic macdef
370: .Ws
371: .Ar macro-name
372: .Cx
373: Define a macro.
374: Subsequent lines are stored as the macro
375: .Ar macro-name ;
376: a null line (consecutive newline characters
377: in a file or
378: carriage returns from the terminal) terminates macro input mode.
379: There is a limit of 16 macros and 4096 total characters in all
380: defined macros.
381: Macros remain defined until a
382: .Ic close
383: command is executed.
384: The macro processor interprets `$' and `\e' as special characters.
385: A `$' followed by a number (or numbers) is replaced by the
386: corresponding argument on the macro invocation command line.
387: A `$' followed by an `i' signals that macro processor that the
388: executing macro is to be looped. On the first pass `$i' is
389: replaced by the first argument on the macro invocation command line,
390: on the second pass it is replaced by the second argument, and so on.
391: A `\e' followed by any character is replaced by that character.
392: Use the `\e' to prevent special treatment of the `$'.
393: .Tp Cx Ic mdelete
394: .Ws
395: .Op Ar remote-files
396: .Cx
397: Delete the
398: .Ar remote-files
399: on the remote machine.
400: .Tp Cx Ic mdir
401: .Ws
402: .Ar remote-files
403: .Ws
404: .Ar local-file
405: .Cx
406: Like
407: .Ic dir ,
408: except multiple remote files may be specified.
409: If interactive prompting is on,
410: .Nm ftp
411: will prompt the user to verify that the last argument is indeed the
412: target local file for receiving
413: .Ic mdir
414: output.
415: .Tp Cx Ic mget
416: .Ws
417: .Ar remote-files
418: .Cx
419: Expand the
420: .Ar remote-files
421: on the remote machine
422: and do a
423: .Ic get
424: for each file name thus produced.
425: See
426: .Ic glob
427: for details on the filename expansion.
428: Resulting file names will then be processed according to
429: .Ic case ,
430: .Ic ntrans ,
431: and
432: .Ic nmap
433: settings.
434: Files are transferred into the local working directory,
435: which can be changed with
436: .Cx `
437: .Cx Li lcd directory
438: .Cx \';
439: new local directories can be created with
440: .Cx Li \&! mkdir directory
441: .Cx \'.
442: .Tp Cx Ic mkdir
443: .Ws
444: .Ar directory-name
445: .Cx
446: Make a directory on the remote machine.
447: .Tp Cx Ic mls
448: .Ws
449: .Ar remote-files
450: .Ws
451: .Ar local-file
452: .Cx
453: Like
454: .Ic nlist ,
455: except multiple remote files may be specified,
456: and the
457: .Ar local-file
458: must be specified.
459: If interactive prompting is on,
460: .Nm ftp
461: will prompt the user to verify that the last argument is indeed the
462: target local file for receiving
463: .Ic mls
464: output.
465: .Tp Cx Ic mode
466: .Ws
467: .Op Ar mode-name
468: .Cx
469: Set the file transfer
470: .Ic mode
471: to
472: .Ar mode-name .
473: The default mode is \*(Lqstream\*(Rq mode.
474: .Tp Cx Ic modtime
475: .Ws
476: .Ar file-name
477: .Cx
478: Show the last modification time of the file on the remote machine.
479: .Tp Cx Ic mput
480: .Ws
481: .Ar local-files
482: .Cx
483: Expand wild cards in the list of local files given as arguments
484: and do a
485: .Ic put
486: for each file in the resulting list.
487: See
488: .Ic glob
489: for details of filename expansion.
490: Resulting file names will then be processed according to
491: .Ic ntrans
492: and
493: .Ic nmap
494: settings.
495: .Tp Cx Ic newer
496: .Ws
497: .Ar file-name
498: .Cx
499: Get the file only if the modification time of the remote file is more
500: recent that the file on the current system. If the file does not
501: exist on the current system, the remote file is considered
502: .Ic newer .
503: Otherwise, this command is identical to
504: .Ar get .
505: .Tp Cx Ic nlist
506: .Ws
507: .Op Ar remote-directory
508: .Ws
509: .Op Ar local-file
510: .Cx
511: Print a list of the files in a
512: directory on the remote machine. If
513: .Ar remote-directory
514: is left unspecified, the current working directory is used.
515: If interactive prompting is on,
516: .Nm ftp
517: will prompt the user to verify that the last argument is indeed the
518: target local file for receiving
519: .Ic nlist
520: output.
521: If no local file is specified, or if
522: .Ar local-file
523: is
524: .Fl ,
525: the output is sent to the terminal.
526: .Tp Cx Ic nmap
527: .Ws
528: .Op Ar inpattern outpattern
529: .Cx
530: Set or unset the filename mapping mechanism.
531: If no arguments are specified, the filename mapping mechanism is unset.
532: If arguments are specified, remote filenames are mapped during
533: .Ic mput
534: commands and
535: .Ic put
536: commands issued without a specified remote target filename.
537: If arguments are specified, local filenames are mapped during
538: .Ic mget
539: commands and
540: .Ic get
541: commands issued without a specified local target filename.
542: This command is useful when connecting to a non-UNIX remote computer
543: with different file naming conventions or practices.
544: The mapping follows the pattern set by
545: .Ar inpattern
546: and
547: .Ar outpattern .
548: .Op Ar Inpattern
549: is a template for incoming filenames (which may have already been
550: processed according to the
551: .Ic ntrans
552: and
553: .Ic case
554: settings).
555: Variable templating is accomplished by including the sequences `$1', `$2', ..., `$9' in
556: .Ar inpattern .
557: Use `\\' to prevent this special treatment of the `$' character.
558: All other characters are treated literally, and are used to determine the
559: .Ic nmap
560: .Op Ar inpattern
561: variable values.
562: For example, given
563: .Ar inpattern
564: $1.$2 and the remote file name "mydata.data", $1 would have the value
565: "mydata", and $2 would have the value "data".
566: The
567: .Ar outpattern
568: determines the resulting mapped filename.
569: The sequences `$1', `$2', ...., `$9' are replaced by any value resulting
570: from the
571: .Ar inpattern
572: template.
573: The sequence `$0' is replace by the original filename.
574: Additionally, the sequence
575: .Cx `
576: .Op Ar seq1 , Ar seq2
577: .Cx \'
578: .Cx
579: is replaced by
580: .Op Ar seq1
581: if
582: .Ar seq1
583: is not a null string; otherwise it is replaced by
584: .Ar seq2 .
585: For example, the command
586: .Pp
587: .Df I
588: nmap $1.$2.$3
589: .Cx Op $1,$2
590: .Cx .
591: .Op $2,file
592: .Cx
593: .De
594: .Pp
595: would yield
596: the output filename "myfile.data" for input filenames "myfile.data" and
597: "myfile.data.old", "myfile.file" for the input filename "myfile", and
598: "myfile.myfile" for the input filename ".myfile".
599: Spaces may be included in
600: .Ar outpattern ,
601: as in the example: `nmap $1 sed "s/ *$//" > $1' .
602: Use the `\e' character to prevent special treatment
603: of the `$','[','[', and `,' characters.
604: .Tp Cx Ic ntrans
605: .Ws
606: .Op Ar inchars Op Ar outchars
607: .Cx
608: Set or unset the filename character translation mechanism.
609: If no arguments are specified, the filename character
610: translation mechanism is unset.
611: If arguments are specified, characters in
612: remote filenames are translated during
613: .Ic mput
614: commands and
615: .Ic put
616: commands issued without a specified remote target filename.
617: If arguments are specified, characters in
618: local filenames are translated during
619: .Ic mget
620: commands and
621: .Ic get
622: commands issued without a specified local target filename.
623: This command is useful when connecting to a non-UNIX remote computer
624: with different file naming conventions or practices.
625: Characters in a filename matching a character in
626: .Ar inchars
627: are replaced with the corresponding character in
628: .Ar outchars .
629: If the character's position in
630: .Ar inchars
631: is longer than the length of
632: .Ar outchars ,
633: the character is deleted from the file name.
634: .Tp Cx Ic open
635: .Ws
636: .Ar host
637: .Ws
638: .Op Ar port
639: .Cx
640: Establish a connection to the specified
641: .Ar host
642: FTP server. An optional port number may be supplied,
643: in which case,
644: .Nm ftp
645: will attempt to contact an FTP server at that port.
646: If the
647: .Ic auto-login
648: option is on (default),
649: .Nm ftp
650: will also attempt to automatically log the user in to
651: the FTP server (see below).
652: .Tp Ic prompt
653: Toggle interactive prompting. Interactive prompting
654: occurs during multiple file transfers to allow the
655: user to selectively retrieve or store files.
656: If prompting is turned off (default is on), any
657: .Ic mget
658: or
659: .Ic mput
660: will transfer all files, and any
661: .Ic mdelete
662: will delete all files.
663: .Tp Cx Ic proxy
664: .Ws
665: .Ar ftp-command
666: .Cx
667: Execute an ftp command on a secondary control connection.
668: This command allows simultaneous connection to two remote ftp
669: servers for transferring files between the two servers.
670: The first
671: .Ic proxy
672: command should be an
673: .Ic open ,
674: to establish the secondary control connection.
675: Enter the command "proxy ?" to see other ftp commands executable on the
676: secondary connection.
677: The following commands behave differently when prefaced by
678: .Ic proxy :
679: .Ic open
680: will not define new macros during the auto-login process,
681: .Ic close
682: will not erase existing macro definitions,
683: .Ic get
684: and
685: .Ic mget
686: transfer files from the host on the primary control connection
687: to the host on the secondary control connection, and
688: .Ic put ,
689: .Ic mput ,
690: and
691: .Ic append
692: transfer files from the host on the secondary control connection
693: to the host on the primary control connection.
694: Third party file transfers depend upon support of the ftp protocol
695: PASV command by the server on the secondary control connection.
696: .Tp Cx Ic put
697: .Ws
698: .Ar local-file
699: .Ws
700: .Op Ar remote-file
701: .Cx
702: Store a local file on the remote machine. If
703: .Ar remote-file
704: is left unspecified, the local file name is used
705: after processing according to any
706: .Ic ntrans
707: or
708: .Ic nmap
709: settings
710: in naming the remote file. File transfer uses the
711: current settings for
712: .Ic type ,
713: .Ic format ,
714: .Ic mode ,
715: and
716: .Ic structure .
717: .Tp Ic pwd
718: Print the name of the current working directory on the remote
719: machine.
720: .Tp Ic quit
721: A synonym for
722: .Ic bye .
723: .Tp Cx Ic quote
724: .Ws
725: .Ar arg1 arg2 ...
726: .Cx
727: The arguments specified are sent, verbatim, to the remote FTP
728: server.
729: .Tp Cx Ic recv
730: .Ws
731: .Ar remote-file
732: .Ws
733: .Op Ar local-file
734: .Cx
735: A synonym for get.
736: .Tp Cx Ic reget
737: .Ws
738: .Ar remote-file
739: .Ws
740: .Op Ar local-file
741: .Cx
742: Reget acts like get, except that if
743: .Ar local-file
744: exists and is
745: smaller than
746: .Ar remote-file ,
747: .Ar local-file
748: is presumed to be
749: a partially transferred copy of
750: .Ar remote-file
751: and the transfer
752: is continued from the apparent point of failure. This command
753: is useful when transferring very large files over networks that
754: are prone to dropping connections.
755: .Tp Cx Ic remotehelp
756: .Ws
757: .Op Ar command-name
758: .Cx
759: Request help from the remote FTP server. If a
760: .Ar command-name
761: is specified it is supplied to the server as well.
762: .Tp Cx Ic remotestatus
763: .Ws
764: .Op Ar file-name
765: .Cx
766: With no arguments, show status of remote machine. If
767: .Ar file-name
768: is specified, show status of
769: .Ar file-name
770: on remote machine.
771: .Tp Cx Ic rename
772: .Ws
773: .Op Ar from
774: .Ws
775: .Op Ar to
776: .Cx
777: Rename the file
778: .Ar from
779: on the remote machine, to the file
780: .Ar to .
781: .Tp Ic reset
782: Clear reply queue.
783: This command re-synchronizes command/reply sequencing with the remote
784: ftp server.
785: Resynchronization may be necessary following a violation of the ftp protocol
786: by the remote server.
787: .Tp Cx Ic restart
788: .Ws
789: .Ar marker
790: .Cx
791: Restart the immediately following
792: .Ic get
793: or
794: .Ic put
795: at the
796: indicated
797: .Ar marker .
798: On UNIX systems, marker is usually a byte
799: offset into the file.
800: .Tp Cx Ic rmdir
801: .Ws
802: .Ar directory-name
803: .Cx
804: Delete a directory on the remote machine.
805: .Tp Ic runique
806: Toggle storing of files on the local system with unique filenames.
807: If a file already exists with a name equal to the target
808: local filename for a
809: .Ic get
810: or
811: .Ic mget
812: command, a ".1" is appended to the name.
813: If the resulting name matches another existing file,
814: a ".2" is appended to the original name.
815: If this process continues up to ".99", an error
816: message is printed, and the transfer does not take place.
817: The generated unique filename will be reported.
818: Note that
819: .Ic runique
820: will not affect local files generated from a shell command
821: (see below).
822: The default value is off.
823: .Tp Cx Ic send
824: .Ws
825: .Ar local-file
826: .Ws
827: .Op Ar remote-file
828: .Cx
829: A synonym for put.
830: .Tp Ic sendport
831: Toggle the use of PORT commands. By default,
832: .Nm ftp
833: will attempt to use a PORT command when establishing
834: a connection for each data transfer.
835: The use of PORT commands can prevent delays
836: when performing multiple file transfers. If the PORT
837: command fails,
838: .Nm ftp
839: will use the default data port. When the use of PORT
840: commands is disabled, no attempt will be made to use
841: PORT commands for each data transfer. This is useful
842: for certain FTP implementations which do ignore PORT
843: commands but, incorrectly, indicate they've been accepted.
844: .Tp Cx Ic site
845: .Ws
846: .Ar arg1 arg2 ...
847: .Cx
848: The arguments specified are sent, verbatim, to the remote FTP
849: server as a SITE command.
850: .Tp Cx Ic size
851: .Ws
852: .Ar file-name
853: .Cx
854: Return size of
855: .Ar file-name
856: on remote machine.
857: .Tp Ic status
858: Show the current status of
859: .Nm ftp .
860: .Tp Cx Ic struct
861: .Ws
862: .Op Ar struct-name
863: .Cx
864: Set the file transfer
865: .Ar structure
866: to
867: .Ar struct-name .
868: By default \*(Lqstream\*(Rq structure is used.
869: .Tp Ic sunique
870: Toggle storing of files on remote machine under unique file names.
871: Remote ftp server must support ftp protocol STOU command for
872: successful completion.
873: The remote server will report unique name.
874: Default value is off.
875: .Tp Ic system
876: Show the type of operating system running on the remote machine.
877: .Tp Ic tenex
878: Set the file transfer type to that needed to
879: talk to TENEX machines.
880: .Tp Ic trace
881: Toggle packet tracing.
882: .Tp Cx Ic type
883: .Ws
884: .Op Ar type-name
885: .Cx
886: Set the file transfer
887: .Ic type
888: to
889: .Ar type-name .
890: If no type is specified, the current type
891: is printed. The default type is network ASCII.
892: .Tp Cx Ic umask
893: .Ws
894: .Op Ar newmask
895: .Cx
896: Set the default umask on the remote server to
897: .Ar newmask .
898: If
899: .Ar newmask
900: is ommitted, the current umask is printed.
901: .Tp Cx Ic user
902: .Ws
903: .Ar user-name
904: .Ws
905: .Op Ar password
906: .Ws
907: .Op Ar account
908: .Cx
909: Identify yourself to the remote FTP server. If the
910: .Ar password
911: is not specified and the server requires it,
912: .Nm ftp
913: will prompt the user for it (after disabling local echo).
914: If an
915: .Ar account
916: field is not specified, and the FTP server
917: requires it, the user will be prompted for it.
918: If an
919: .Ar account
920: field is specified, an account command will
921: be relayed to the remote server after the login sequence
922: is completed if the remote server did not require it
923: for logging in.
924: Unless
925: .Nm ftp
926: is invoked with \*(Lqauto-login\*(Rq disabled, this
927: process is done automatically on initial connection to
928: the FTP server.
929: .Tp Ic verbose
930: Toggle verbose mode. In verbose mode, all responses from
931: the FTP server are displayed to the user. In addition,
932: if verbose is on, when a file transfer completes, statistics
933: regarding the efficiency of the transfer are reported. By default,
934: verbose is on.
935: .Tp Cx Ic ?
936: .Ws
937: .Op Ar command
938: .Cx
939: A synonym for help.
940: .Tp
941: .Pp
942: Command arguments which have embedded spaces may be quoted with
943: quote `"' marks.
944: .Sh ABORTING A FILE TRANSFER
945: To abort a file transfer, use the terminal interrupt key
946: (usually Ctrl-C).
947: Sending transfers will be immediately halted.
948: Receiving transfers will be halted by sending a ftp protocol ABOR
949: command to the remote server, and discarding any further data received.
950: The speed at which this is accomplished depends upon the remote
951: server's support for ABOR processing.
952: If the remote server does not support the ABOR command, an
953: .Ql ftp>
954: prompt will not appear until the remote server has completed
955: sending the requested file.
956: .Pp
957: The terminal interrupt key sequence will be ignored when
958: .Nm ftp
959: has completed any local processing and is awaiting a reply
960: from the remote server.
961: A long delay in this mode may result from the ABOR processing described
962: above, or from unexpected behavior by the remote server, including
963: violations of the ftp protocol.
964: If the delay results from unexpected remote server behavior, the local
965: .Nm ftp
966: program must be killed by hand.
967: .Sh FILE NAMING CONVENTIONS
968: Files specified as arguments to
969: .Nm ftp
970: commands are processed according to the following rules.
971: .Tw Ds
972: .Tp \&1)
973: If the file name
974: .Sq Fl
975: is specified, the
976: .Ar stdin
977: (for reading) or
978: .Ar stdout
979: (for writing) is used.
980: .Tp \&2)
981: If the first character of the file name is
982: .Sq \&| ,
983: the
984: remainder of the argument is interpreted as a shell command.
985: .Nm Ftp
986: then forks a shell, using
987: .Xr popen 3
988: with the argument supplied, and reads (writes) from the stdout
989: (stdin). If the shell command includes spaces, the argument
990: must be quoted; e.g. \*(Lq" ls -lt"\*(Rq. A particularly
991: useful example of this mechanism is: \*(Lqdir more\*(Rq.
992: .Tp \&3)
993: Failing the above checks, if ``globbing'' is enabled,
994: local file names are expanded
995: according to the rules used in the
996: .Xr csh 1 ;
997: c.f. the
998: .Ic glob
999: command.
1000: If the
1001: .Nm ftp
1002: command expects a single local file (.e.g.
1003: .Ic put ) ,
1004: only the first filename generated by the "globbing" operation is used.
1005: .Tp \&4)
1006: For
1007: .Ic mget
1008: commands and
1009: .Ic get
1010: commands with unspecified local file names, the local filename is
1011: the remote filename, which may be altered by a
1012: .Ic case ,
1013: .Ic ntrans ,
1014: or
1015: .Ic nmap
1016: setting.
1017: The resulting filename may then be altered if
1018: .Ic runique
1019: is on.
1020: .Tp \&5)
1021: For
1022: .Ic mput
1023: commands and
1024: .Ic put
1025: commands with unspecified remote file names, the remote filename is
1026: the local filename, which may be altered by a
1027: .Ic ntrans
1028: or
1029: .Ic nmap
1030: setting.
1031: The resulting filename may then be altered by the remote server if
1032: .Ic sunique
1033: is on.
1034: .Tp
1035: .Sh FILE TRANSFER PARAMETERS
1036: The FTP specification specifies many parameters which may
1037: affect a file transfer. The
1038: .Ic type
1039: may be one of \*(Lqascii\*(Rq, \*(Lqimage\*(Rq (binary),
1040: \*(Lqebcdic\*(Rq, and \*(Lqlocal byte size\*(Rq (for PDP-10's
1041: and PDP-20's mostly).
1042: .Nm Ftp
1043: supports the ascii and image types of file transfer,
1044: plus local byte size 8 for
1045: .Ic tenex
1046: mode transfers.
1047: .Pp
1048: .Nm Ftp
1049: supports only the default values for the remaining
1050: file transfer parameters:
1051: .Ic mode ,
1052: .Ic form ,
1053: and
1054: .Ic struct .
1055: .Sh THE .netrc FILE
1056: The
1057: .Pa .netrc
1058: file contains login and initialization information
1059: used by the auto-login process.
1060: It resides in the user's home directory.
1061: The following tokens are recognized; they may be separated by spaces,
1062: tabs, or new-lines:
1063: .Tw password
1064: .Tp Cx Ic machine
1065: .Ws
1066: .Ar name
1067: .Cx
1068: Identify a remote machine
1069: .Ar name .
1070: The auto-login process searches the
1071: .Pa .netrc
1072: file for a
1073: .Ic machine
1074: token that matches the remote machine specified on the
1075: .Nm ftp
1076: command line or as an
1077: .Ic open
1078: command argument.
1079: Once a match is made, the subsequent
1080: .Pa .netrc
1081: tokens are processed,
1082: stopping when the end of file is reached or another
1083: .Ic machine
1084: or a
1085: .Ic default
1086: token is encountered.
1087: .Tp Ic default
1088: This is the same as
1089: .Ic machine
1090: .Ar name
1091: except that
1092: .Ic default
1093: matches any name.
1094: There can be only one
1095: .Ic default
1096: token, and it must be after all
1097: .Ic machine
1098: tokens.
1099: This is normally used as:
1100: .Pp
1101: .Dl default login anonymous password user@site
1102: .Pp
1103: thereby giving the user
1104: .Ar automatic
1105: anonymous ftp login to
1106: machines not specified in
1107: .Pa .netrc .
1108: This can be overridden
1109: by using the
1110: .Fl n
1111: flag to disable auto-login.
1112: .Tp Cx Ic login
1113: .Ws
1114: .Ar name
1115: .Cx
1116: Identify a user on the remote machine.
1117: If this token is present, the auto-login process will initiate
1118: a login using the specified
1119: .Ar name .
1120: .Tp Cx Ic password
1121: .Ws
1122: .Ar string
1123: .Cx
1124: Supply a password.
1125: If this token is present, the auto-login process will supply the
1126: specified string if the remote server requires a password as part
1127: of the login process.
1128: Note that if this token is present in the
1129: .Pa .netrc
1130: file for any user other
1131: than
1132: .Ar anonymous ,
1133: .Nm ftp
1134: will abort the auto-login process if the
1135: .Pa .netrc
1136: is readable by
1137: anyone besides the user.
1138: .Tp Cx Ic account
1139: .Ws
1140: .Ar string
1141: .Cx
1142: Supply an additional account password.
1143: If this token is present, the auto-login process will supply the
1144: specified string if the remote server requires an additional
1145: account password, or the auto-login process will initiate an
1146: ACCT command if it does not.
1147: .Tp Cx Ic macdef
1148: .Ws
1149: .Ar name
1150: .Cx
1151: Define a macro.
1152: This token functions like the
1153: .Nm ftp
1154: .Ic macdef
1155: command functions.
1156: A macro is defined with the specified name; its contents begin with the
1157: next
1158: .Pa .netrc
1159: line and continue until a null line (consecutive new-line
1160: characters) is encountered.
1161: If a macro named
1162: .Ic init
1163: is defined, it is automatically executed as the last step in the
1164: auto-login process.
1165: .Tp
1166: .Sh ENVIRONMENT
1167: .Nm Ftp
1168: utilizes the following environment variables.
1169: .Tw Fl
1170: .Tp Ev HOME
1171: For default location of a
1172: .Pa .netrc
1173: file, if one exists.
1174: .Tp Ev SHELL
1175: For default shell.
1176: .Tp
1177: .Sh SEE ALSO
1178: .Xr ftpd 8
1179: .Sh HISTORY
1180: .Nm Ftp
1181: appeared in 4.2 BSD.
1182: .Sh BUGS
1183: Correct execution of many commands depends upon proper behavior
1184: by the remote server.
1185: .Pp
1186: An error in the treatment of carriage returns
1187: in the 4.2BSD UNIX ascii-mode transfer code
1188: has been corrected.
1189: This correction may result in incorrect transfers of binary files
1190: to and from 4.2BSD servers using the ascii type.
1191: Avoid this problem by using the binary image type.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.