Debian Codegraph @

upstream/debian-unstable/man1/tnftp.1

raw
1 .\" $NetBSD: ftp.1,v 1.20 2026/02/08 07:11:12 lukem Exp $
2 .\" from NetBSD: ftp.1,v 1.163 2026/02/07 03:11:20 lukem Exp
3 .\"
4 .\" Copyright (c) 1996-2026 The NetBSD Foundation, Inc.
5 .\" All rights reserved.
6 .\"
7 .\" This code is derived from software contributed to The NetBSD Foundation
8 .\" by Luke Mewburn.
9 .\"
10 .\" Redistribution and use in source and binary forms, with or without
11 .\" modification, are permitted provided that the following conditions
12 .\" are met:
13 .\" 1. Redistributions of source code must retain the above copyright
14 .\" notice, this list of conditions and the following disclaimer.
15 .\" 2. Redistributions in binary form must reproduce the above copyright
16 .\" notice, this list of conditions and the following disclaimer in the
17 .\" documentation and/or other materials provided with the distribution.
18 .\"
19 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 .\" POSSIBILITY OF SUCH DAMAGE.
30 .\"
31 .\"
32 .\" Copyright (c) 1985, 1989, 1990, 1993
33 .\" The Regents of the University of California. All rights reserved.
34 .\"
35 .\" Redistribution and use in source and binary forms, with or without
36 .\" modification, are permitted provided that the following conditions
37 .\" are met:
38 .\" 1. Redistributions of source code must retain the above copyright
39 .\" notice, this list of conditions and the following disclaimer.
40 .\" 2. Redistributions in binary form must reproduce the above copyright
41 .\" notice, this list of conditions and the following disclaimer in the
42 .\" documentation and/or other materials provided with the distribution.
43 .\" 3. Neither the name of the University nor the names of its contributors
44 .\" may be used to endorse or promote products derived from this software
45 .\" without specific prior written permission.
46 .\"
47 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
48 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
49 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
50 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
51 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
52 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
53 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
54 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
55 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
56 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
57 .\" SUCH DAMAGE.
58 .\"
59 .\" @(#)ftp.1 8.3 (Berkeley) 10/9/94
60 .\"
61 .Dd February 7, 2026
62 .Dt TNFTP 1
63 .Os
64 .Sh NAME
65 .Nm tnftp
66 .Nd Internet file transfer program
67 .Sh SYNOPSIS
68 .Nm
69 .Op Fl 46AadefginpRtVv
70 .Op Fl b Ar bufsize
71 .Op Fl H Ar header
72 .Op Fl N Ar netrc
73 .Op Fl o Ar output
74 .Op Fl P Ar port
75 .Op Fl q Ar quittime
76 .Op Fl r Ar retry
77 .Op Fl s Ar srcaddr
78 .Bk -words
79 .\" [-T dir,max[,inc]]
80 .Oo
81 .Fl T Xo
82 .Sm off
83 .Ar dir Cm \&,
84 .Ar max
85 .Op Cm \&, Ar inc
86 .Sm on
87 .Xc
88 .Oc
89 .Ek
90 .Op Fl x Ar xfersize
91 .Bk -words
92 .\" [[user@]host [port]]
93 .Oo
94 .Oo Ar user Ns Li \&@ Oc Ns Ar host Oo Ar port Oc
95 .Oc
96 .Ek
97 .Bk -words
98 .\" [[user@]host:[path][/]]
99 .Sm off
100 .Oo
101 .Op Ar user Li \&@
102 .Ar host Li \&:
103 .Op Ar path
104 .Op Li /
105 .Oc
106 .Sm on
107 .Ek
108 .Bk -words
109 .\" [file:///path]
110 .Sm off
111 .Oo
112 .Li file:/// Ar path
113 .Oc
114 .Sm on
115 .Ek
116 .Bk -words
117 .\" [ftp://[user[:password]@]host[:port]/path[/]]
118 .Sm off
119 .Oo
120 .Li ftp://
121 .Oo Ar user
122 .Op Li \&: Ar password
123 .Li \&@ Oc
124 .Ar host Oo Li \&: Ar port Oc
125 .Li / Ar path
126 .Op Li /
127 .Op Li ;type= Ar type
128 .Oc
129 .Sm on
130 .Ek
131 .Bk -words
132 .\" [http://[user[:password]@]host[:port]/path]
133 .Sm off
134 .Oo
135 .Li http://
136 .Oo Ar user
137 .Op Li \&: Ar password
138 .Li \&@ Oc
139 .Ar host Oo Li \&: Ar port Oc
140 .Li / Ar path
141 .Oc
142 .Sm on
143 .Ek
144 .Bk -words
145 .\" [https://[user[:password]@]host[:port]/path]
146 .Sm off
147 .Oo
148 .Li https://
149 .Oo Ar user
150 .Op Li \&: Ar password
151 .Li \&@ Oc
152 .Ar host Oo Li \&: Ar port Oc
153 .Li / Ar path
154 .Oc
155 .Sm on
156 .Ek
157 .Ar \&...
158 .Nm
159 .Bk -words
160 .Fl u Ar url Ar
161 .Ek
162 .Nm
163 .Fl \&?
164 .Sh DESCRIPTION
165 .Nm
166 is the user interface to the Internet standard File Transfer Protocol.
167 The program allows a user to transfer files to and from a
168 remote network site.
169 .Pp
170 The last five arguments will fetch a file using the
171 .Tn FTP
172 or
173 .Tn HTTP
174 protocols, or by direct copying, into the current directory.
175 This is ideal for scripts.
176 Refer to
177 .Sx AUTO-FETCHING FILES
178 below for more information.
179 .Pp
180 Options may be specified at the command line, or to the
181 command interpreter.
182 .Bl -tag -width Fl
183 .It Fl 4
184 Forces
185 .Nm
186 to only use IPv4 addresses.
187 .It Fl 6
188 Forces
189 .Nm
190 to only use IPv6 addresses.
191 .It Fl A
192 Force active mode
193 .Tn FTP .
194 By default,
195 .Nm
196 will try to use passive mode
197 .Tn FTP
198 and fall back to active mode
199 if passive is not supported by the server.
200 This option causes
201 .Nm
202 to always use an active connection.
203 It is only useful for connecting to very old servers that do not
204 implement passive mode properly.
205 .It Fl a
206 Causes
207 .Nm
208 to bypass normal login procedure, and use an anonymous login instead.
209 .It Fl b Ar bufsize
210 Change the buffer size used for parsing HTTP response lines to
211 .Ar bufsize
212 bytes.
213 The default
214 .Ar bufsize
215 is
216 .Dv 16384
217 (16 KiB).
218 .It Fl d
219 Enables debugging.
220 .It Fl e
221 Disables command line editing.
222 This is useful for Emacs ange-ftp mode.
223 .It Fl f
224 Forces a cache reload for transfers that go through the
225 .Tn FTP
226 or
227 .Tn HTTP
228 proxies.
229 .It Fl g
230 Disables file name globbing.
231 .It Fl H Ar header
232 Include the provided
233 .Ar header
234 string as a custom
235 .Tn HTTP
236 header for an
237 .Tn HTTP
238 request.
239 The
240 .Fl H
241 option can be repeated to add additional headers.
242 .It Fl i
243 Turns off interactive prompting during
244 multiple file transfers.
245 .It Fl N Ar netrc
246 Use
247 .Ar netrc
248 instead of
249 .Pa ~/.netrc .
250 Refer to
251 .Sx THE .netrc FILE
252 for more information.
253 .It Fl n
254 Restrains
255 .Nm
256 from attempting
257 .Dq auto-login
258 upon initial connection for non auto-fetch transfers.
259 If auto-login is enabled,
260 .Nm
261 will check the
262 .Pa .netrc
263 (see below) file in the user's home directory for an entry describing
264 an account on the remote machine.
265 If no entry exists,
266 .Nm
267 will prompt for the remote machine login name
268 .Pq default is the user identity on the local machine ,
269 and, if necessary, prompt for a password
270 and an account with which to login.
271 To override the auto-login for auto-fetch transfers, specify the
272 username
273 .Pq and optionally, password
274 as appropriate.
275 .It Fl o Ar output
276 When auto-fetching files, save the contents in
277 .Ar output .
278 .Ar output
279 is parsed according to the
280 .Sx FILE NAMING CONVENTIONS
281 below.
282 If
283 .Ar output
284 is not
285 .Sq Fl
286 or doesn't start with
287 .Sq Cm \&| ,
288 then only the first file specified will be retrieved into
289 .Ar output ;
290 all other files will be retrieved into the basename of their
291 remote name.
292 .It Fl P Ar port
293 Sets the port number to
294 .Ar port .
295 .It Fl p
296 Enable passive mode operation for use behind connection filtering firewalls.
297 This option has been deprecated as
298 .Nm
299 now tries to use passive mode by default, falling back to active mode
300 if the server does not support passive connections.
301 .It Fl q Ar quittime
302 Quit if the connection has stalled for
303 .Ar quittime
304 seconds.
305 .It Fl R
306 Restart all non-proxied auto-fetches.
307 .It Fl r Ar retry
308 Retry the connection attempt if it failed, pausing for
309 .Ar retry
310 seconds.
311 .It Fl s Ar srcaddr
312 Uses
313 .Ar srcaddr
314 as the local IP address for all connections.
315 .It Fl t
316 Enables packet tracing.
317 .It Fl T Ar direction Ns Cm \&, Ns Ar maximum Ns Oo Cm \&, Ns Ar increment Oc
318 Set the maximum transfer rate for
319 .Ar direction
320 to
321 .Ar maximum
322 bytes/second,
323 and if specified, the increment to
324 .Ar increment
325 bytes/second.
326 Refer to
327 .Ic rate
328 for more information.
329 .It Fl u Ar url Ar
330 Upload files on the command line to
331 .Ar url
332 where
333 .Ar url
334 is one of the
335 .Ql ftp://
336 URL types as supported by auto-fetch
337 .Pq with an optional target filename for single file uploads ,
338 and
339 .Ar file
340 is one or more local files to be uploaded.
341 .It Fl V
342 Disable
343 .Ic verbose
344 and
345 .Ic progress ,
346 overriding the default of enabled when output is to a terminal.
347 .It Fl v
348 Enable
349 .Ic verbose
350 and
351 .Ic progress .
352 This is the default if output is to a terminal
353 .Po
354 and in the case of
355 .Ic progress ,
356 .Nm
357 is the foreground process
358 .Pc .
359 Forces
360 .Nm
361 to show all responses from the remote server, as well
362 as report on data transfer statistics.
363 .It Fl x Ar xfersize
364 Set the size of the socket send and receive buffers to
365 .Ar xfersize
366 bytes.
367 Refer to
368 .Ic xferbuf
369 for more information.
370 .It Fl \&?
371 Display help to stdout, and exit.
372 .El
373 .Pp
374 The client host with which
375 .Nm
376 is to communicate may be specified on the command line.
377 If this is done,
378 .Nm
379 will immediately attempt to establish a connection to an
380 .Tn FTP
381 server on that host; otherwise,
382 .Nm
383 will enter its command interpreter and await instructions
384 from the user.
385 When
386 .Nm
387 is awaiting commands from the user the prompt
388 .Ql ftp>
389 is provided to the user.
390 The following commands are recognized
391 by
392 .Nm :
393 .Bl -tag -width Ic
394 .It Ic \&! Op Ar command Op Ar args
395 Invoke an interactive shell on the local machine.
396 If there are arguments, the first is taken to be a command to execute
397 directly, with the rest of the arguments as its arguments.
398 .It Ic \&$ Ar macro-name Op Ar args
399 Execute the macro
400 .Ar macro-name
401 that was defined with the
402 .Ic macdef
403 command.
404 Arguments are passed to the macro unglobbed.
405 .It Ic account Op Ar passwd
406 Supply a supplemental password required by a remote system for access
407 to resources once a login has been successfully completed.
408 If no argument is included, the user will be prompted for an account
409 password in a non-echoing input mode.
410 .It Ic append Ar local-file Op Ar remote-file
411 Append a local file to a file on the remote machine.
412 If
413 .Ar remote-file
414 is left unspecified, the local file name is used in naming the
415 remote file after being altered by any
416 .Ic ntrans
417 or
418 .Ic nmap
419 setting.
420 File transfer uses the current settings for
421 .Ic type ,
422 .Ic form ,
423 .Ic mode ,
424 and
425 .Ic struct .
426 .It Ic ascii
427 A synonym for
428 .Ic type Cm ascii .
429 .It Ic bell
430 Arrange that a bell be sounded after each file transfer
431 command is completed.
432 .It Ic binary
433 A synonym for
434 .Ic type Cm binary .
435 .It Ic bye
436 Terminate the
437 .Tn FTP
438 session with the remote server
439 and exit
440 .Nm tnftp .
441 An end of file will also terminate the session and exit.
442 .It Ic case
443 Toggle remote computer file name case mapping during
444 .Ic get ,
445 .Ic mget
446 and
447 .Ic mput
448 commands.
449 When
450 .Ic case
451 is on (default is off), remote computer file names with all letters in
452 upper case are written in the local directory with the letters mapped
453 to lower case.
454 .It Ic \&cd Ar remote-directory
455 Change the working directory on the remote machine
456 to
457 .Ar remote-directory .
458 .It Ic cdup
459 Change the remote machine working directory to the parent of the
460 current remote machine working directory.
461 .It Ic chmod Ar mode remote-file
462 Change the permission modes of the file
463 .Ar remote-file
464 on the remote
465 system to
466 .Ar mode .
467 .It Ic close
468 Terminate the
469 .Tn FTP
470 session with the remote server, and
471 return to the command interpreter.
472 Any defined macros are erased.
473 .It Ic connect Ar host Op Ar port
474 A synonym for
475 .Ic open .
476 .It Ic \&cr
477 Toggle carriage return stripping during
478 .Ic type Cm ascii
479 file retrieval.
480 Records are denoted by a carriage return/linefeed sequence
481 during
482 .Ic type Cm ascii
483 file transfer.
484 When
485 .Ic \&cr
486 is on (the default), carriage returns are stripped from this
487 sequence to conform with the
488 .Ux
489 single linefeed record
490 delimiter.
491 Records on
492 .Pf non\- Ux
493 remote systems may contain single linefeeds;
494 when a
495 .Ic type Cm ascii
496 transfer is made, these linefeeds may be
497 distinguished from a record delimiter only when
498 .Ic \&cr
499 is off.
500 .It Ic debug Op Ar debug-value
501 Toggle debugging mode.
502 If an optional
503 .Ar debug-value
504 is specified it is used to set the debugging level.
505 When debugging is on,
506 .Nm
507 prints each command sent to the remote machine, preceded
508 by the string
509 .Ql \-\-> .
510 .It Ic delete Ar remote-file
511 Delete the file
512 .Ar remote-file
513 on the remote machine.
514 .It Ic dir Op Ar remote-path Op Ar local-file
515 Print a listing of the contents of a
516 directory on the remote machine.
517 The listing includes any system-dependent information that the server
518 chooses to include; for example, most
519 .Ux
520 systems will produce
521 output from the command
522 .Ql ls \-l .
523 If
524 .Ar remote-path
525 is left unspecified, the current working directory is used.
526 If interactive prompting is on,
527 .Nm
528 will prompt the user to verify that the last argument is indeed the
529 target local file for receiving
530 .Ic dir
531 output.
532 If no local file is specified, or if
533 .Ar local-file
534 is
535 .Sq Fl ,
536 the output is sent to the terminal.
537 .It Ic disconnect
538 A synonym for
539 .Ic close .
540 .It Ic edit
541 Toggle command line editing, and context sensitive command and file
542 completion.
543 This is automatically enabled if input is from a terminal, and
544 disabled otherwise.
545 .It Ic epsv , epsv4 , epsv6
546 Toggle the use of the extended
547 .Dv EPSV
548 and
549 .Dv EPRT
550 commands on all IP, IPv4, and IPv6 connections respectively.
551 First try
552 .Dv EPSV Ns \^/\^ Ns Dv EPRT ,
553 and then
554 .Dv PASV Ns \^/\^ Ns Dv PORT .
555 This is enabled by default.
556 If an extended command fails then this option will be temporarily
557 disabled for the duration of the current connection, or until
558 .Ic epsv ,
559 .Ic epsv4 ,
560 or
561 .Ic epsv6
562 is executed again.
563 .It Ic exit
564 A synonym for
565 .Ic bye .
566 .It Ic features
567 Display what features the remote server supports
568 .Pq using the Dv FEAT No command .
569 .It Ic fget Ar localfile
570 Retrieve the files listed in
571 .Ar localfile ,
572 which has one line per filename.
573 .It Ic form Ar format
574 Set the file transfer format control to
575 .Ar format .
576 The default (and only supported)
577 .Ar format
578 is
579 .Ql non-print .
580 .It Ic ftp Ar host Op Ar port
581 A synonym for
582 .Ic open .
583 .It Ic gate Op Ar host Op Ar port
584 Toggle gate-ftp mode, which used to connect through the
585 TIS FWTK and Gauntlet
586 .Tn FTP
587 proxies.
588 This will not be permitted if the gate-ftp server hasn't been set
589 .Po
590 either explicitly by the user, or from the
591 .Ev FTPSERVER
592 environment variable
593 .Pc .
594 If
595 .Ar host
596 is given,
597 then gate-ftp mode will be enabled, and the gate-ftp server will be set to
598 .Ar host .
599 If
600 .Ar port
601 is also given, that will be used as the port to connect to on the
602 gate-ftp server.
603 .It Ic get Ar remote-file Op Ar local-file
604 Retrieve the
605 .Ar remote-file
606 and store it on the local machine.
607 If the local
608 file name is not specified, it is given the same
609 name it has on the remote machine, subject to
610 alteration by the current
611 .Ic case ,
612 .Ic ntrans ,
613 and
614 .Ic nmap
615 settings.
616 The current settings for
617 .Ic type ,
618 .Ic form ,
619 .Ic mode ,
620 and
621 .Ic struct
622 are used while transferring the file.
623 .It Ic glob
624 Toggle filename expansion for
625 .Ic mdelete ,
626 .Ic mget ,
627 .Ic mput ,
628 and
629 .Ic mreget .
630 If globbing is turned off with
631 .Ic glob ,
632 the file name arguments
633 are taken literally and not expanded.
634 Globbing for
635 .Ic mput
636 is done as in
637 .Xr csh 1 .
638 For
639 .Ic mdelete ,
640 .Ic mget ,
641 and
642 .Ic mreget ,
643 each remote file name is expanded
644 separately on the remote machine and the lists are not merged.
645 Expansion of a directory name is likely to be
646 different from expansion of the name of an ordinary file:
647 the exact result depends on the foreign operating system and
648 .Tn FTP
649 server,
650 and can be previewed by doing
651 .Sq Li mls remote-files \- .
652 Note:
653 .Ic mget ,
654 .Ic mput
655 and
656 .Ic mreget
657 are not meant to transfer
658 entire directory subtrees of files.
659 That can be done by
660 transferring a
661 .Xr tar 1
662 archive of the subtree (in
663 .Ic type Cm binary
664 mode).
665 .It Ic hash Op Ar size
666 Toggle hash-sign
667 .Pq Ql #
668 printing for each data block transferred.
669 The size of a data block defaults to 1024 bytes.
670 This can be changed by specifying
671 .Ar size
672 in bytes.
673 Enabling
674 .Ic hash
675 disables
676 .Ic progress .
677 .It Ic help Op Ar command
678 Print an informative message about the meaning of
679 .Ar command .
680 If no argument is given,
681 .Nm
682 prints a list of the known commands.
683 .It Ic idle Op Ar seconds
684 Set the inactivity timer on the remote server to
685 .Ar seconds
686 seconds.
687 If
688 .Ar seconds
689 is omitted, the current inactivity timer is printed.
690 .It Ic image
691 A synonym for
692 .Ic type Cm binary .
693 .It Ic lcd Op Ar directory
694 Change the working directory on the local machine.
695 If
696 no
697 .Ar directory
698 is specified, the user's home directory is used.
699 .It Ic less Ar file
700 A synonym for
701 .Ic page .
702 .It Ic lpage Ar local-file
703 Display
704 .Ar local-file
705 with the program specified by the
706 .Ic "set pager"
707 option.
708 .It Ic lpwd
709 Print the working directory on the local machine.
710 .It Ic \&ls Op Ar remote-path Op Ar local-file
711 A synonym for
712 .Ic dir .
713 .It Ic macdef Ar macro-name
714 Define a macro.
715 Subsequent lines are stored as the macro
716 .Ar macro-name ;
717 a null line
718 .Po
719 consecutive newline characters in a file or carriage
720 returns from the terminal
721 .Pc
722 terminates macro input mode.
723 There is a limit of 16 macros and 4096 total characters in all
724 defined macros.
725 Macro names can be a maximum of 8 characters.
726 Macros are only applicable to the current session they are
727 defined within
728 .Po
729 or if defined outside a session, to the session
730 invoked with the next
731 .Ic open
732 command
733 .Pc ,
734 and remain defined until a
735 .Ic close
736 command is executed.
737 To invoke a macro, use the
738 .Ic $
739 command (see above).
740 .Pp
741 The macro processor interprets
742 .Ql $
743 and
744 .Ql \e
745 as special characters.
746 A
747 .Ql $
748 followed by a number (or numbers) is replaced by the
749 corresponding argument on the macro invocation command line.
750 A
751 .Ql $
752 followed by an
753 .Ql i
754 signals the macro processor that the executing macro is to be
755 looped.
756 On the first pass
757 .Ql $i
758 is replaced by the first argument on the macro invocation command
759 line, on the second pass it is replaced by the second argument,
760 and so on.
761 A
762 .Ql \e
763 followed by any character is replaced by that character.
764 Use the
765 .Ql \e
766 to prevent special treatment of the
767 .Ql $ .
768 .It Ic mdelete Op Ar remote-files
769 Delete the
770 .Ar remote-files
771 on the remote machine.
772 .It Ic mdir Ar remote-files local-file
773 Like
774 .Ic dir ,
775 except multiple remote files may be specified.
776 If interactive prompting is on,
777 .Nm
778 will prompt the user to verify that the last argument is indeed the
779 target local file for receiving
780 .Ic mdir
781 output.
782 .It Ic mget Ar remote-files
783 Expand the
784 .Ar remote-files
785 on the remote machine
786 and do a
787 .Ic get
788 for each file name thus produced.
789 See
790 .Ic glob
791 for details on the filename expansion.
792 Resulting file names will then be processed according to
793 .Ic case ,
794 .Ic ntrans ,
795 and
796 .Ic nmap
797 settings.
798 Files are transferred into the local working directory,
799 which can be changed with
800 .Ic lcd Ar directory ;
801 new local directories can be created with
802 .Ic \&! mkdir Ar directory .
803 .It Ic mkdir Ar directory-name
804 Make a directory on the remote machine.
805 .It Ic mls Ar remote-files local-file
806 Like
807 .Ic ls ,
808 except multiple remote files may be specified,
809 and the
810 .Ar local-file
811 must be specified.
812 If interactive prompting is on,
813 .Nm
814 will prompt the user to verify that the last argument is indeed the
815 target local file for receiving
816 .Ic mls
817 output.
818 .It Ic mlsd Op Ar remote-path
819 Display the contents of
820 .Ar remote-path
821 .Pq which should default to the current directory if not given
822 in a machine-parsable form, using
823 .Dv MLSD .
824 The format of display can be changed with
825 .Sq Ic remopts mlst Ar \&... .
826 .It Ic mlst Op Ar remote-path
827 Display the details about
828 .Ar remote-path
829 .Pq which should default to the current directory if not given
830 in a machine-parsable form, using
831 .Dv MLST .
832 The format of display can be changed with
833 .Sq Ic remopts mlst Ar \&... .
834 .It Ic mode Ar mode-name
835 Set the file transfer transmission mode to
836 .Ar mode-name .
837 The default
838 .Pq and only supported
839 .Ar mode-name
840 is
841 .Ql stream .
842 .It Ic modtime Ar remote-file
843 Show the last modification time of the file on the remote machine, in
844 .Li RFC 2822
845 format.
846 .It Ic more Ar file
847 A synonym for
848 .Ic page .
849 .It Ic mput Ar local-files
850 Expand wild cards in the list of local files given as arguments
851 and do a
852 .Ic put
853 for each file in the resulting list.
854 See
855 .Ic glob
856 for details of filename expansion.
857 Resulting file names will then be processed according to
858 .Ic ntrans
859 and
860 .Ic nmap
861 settings.
862 .It Ic mreget Ar remote-files
863 As per
864 .Ic mget ,
865 but performs a
866 .Ic reget
867 instead of
868 .Ic get .
869 .It Ic msend Ar local-files
870 A synonym for
871 .Ic mput .
872 .It Ic newer Ar remote-file Op Ar local-file
873 Get the file only if the modification time of the remote file is more
874 recent that the file on the current system.
875 If the file does not
876 exist on the current system, the remote file is considered
877 .Ic newer .
878 Otherwise, this command is identical to
879 .Ic get .
880 .It Ic nlist Op Ar remote-path Op Ar local-file
881 A synonym for
882 .Ic ls .
883 .It Ic nmap Op Ar inpattern outpattern
884 Set or unset the filename mapping mechanism.
885 If no arguments are specified, the filename mapping mechanism is unset.
886 If arguments are specified, remote filenames are mapped during
887 .Ic mput
888 commands and
889 .Ic put
890 commands issued without a specified remote target filename.
891 If arguments are specified, local filenames are mapped during
892 .Ic mget
893 commands and
894 .Ic get
895 commands issued without a specified local target filename.
896 This command is useful when connecting to a
897 .No non\- Ns Ux
898 remote computer
899 with different file naming conventions or practices.
900 The mapping follows the pattern set by
901 .Ar inpattern
902 and
903 .Ar outpattern .
904 .Pp
905 .Ar inpattern
906 is a template for incoming filenames
907 .Po
908 which may have already been processed according to the
909 .Ic ntrans
910 and
911 .Ic case
912 settings
913 .Pc .
914 Variable templating is accomplished by including the
915 sequences
916 .Ql $1 ,
917 .Ql $2 ,
918 \&...\|,
919 .Ql $9
920 in
921 .Ar inpattern .
922 Use
923 .Ql \e
924 to prevent this special treatment of the
925 .Ql $
926 character.
927 All other characters are treated literally, and are used to determine the
928 .Ic nmap
929 .Op Ar inpattern
930 variable values.
931 For example, given
932 .Ar inpattern
933 .Ql $1.$2
934 and the remote file name
935 .Ql mydata.data ,
936 .Ql $1
937 would have the value
938 .Ql mydata ,
939 and
940 .Ql $2
941 would have the value
942 .Ql data .
943 .Pp
944 The
945 .Ar outpattern
946 determines the resulting mapped filename.
947 The sequences
948 .Ql $1 ,
949 .Ql $2 ,
950 \&...\|,
951 .Ql $9
952 are replaced by any value resulting from the
953 .Ar inpattern
954 template.
955 The sequence
956 .Ql $0
957 is replaced by the original filename.
958 Additionally, the sequence
959 .Sm off
960 .Li \&[ Ar seq1 Li \&, Ar seq2 Li \&]
961 .Sm on
962 is replaced by
963 .Ar seq1
964 if
965 .Ar seq1
966 is not a null string; otherwise it is replaced by
967 .Ar seq2 .
968 For example, the command
969 .Pp
970 .Dl nmap $1.$2.$3 [$1,$2].[$2,file]
971 .Pp
972 would yield
973 the output filename
974 .Ql myfile.data
975 for input filenames
976 .Ql myfile.data
977 and
978 .Ql myfile.data.old ,
979 .Ql myfile.file
980 for the input filename
981 .Ql myfile ,
982 and
983 .Ql myfile.myfile
984 for the input filename
985 .Ql \&.myfile .
986 Spaces may be included in
987 .Ar outpattern ,
988 as in the example:
989 .Pp
990 .Dl nmap $1 sed "s/ *$//" > $1
991 .Pp
992 Use the
993 .Ql \e
994 character to prevent special treatment
995 of the
996 .Ql $ ,
997 .Ql \&[ ,
998 .Ql \&] ,
999 and
1000 .Ql \&,
1001 characters.
1002 .It Ic ntrans Op Ar inchars Op Ar outchars
1003 Set or unset the filename character translation mechanism.
1004 If no arguments are specified, the filename character
1005 translation mechanism is unset.
1006 If arguments are specified, characters in
1007 remote filenames are translated during
1008 .Ic mput
1009 commands and
1010 .Ic put
1011 commands issued without a specified remote target filename.
1012 If arguments are specified, characters in
1013 local filenames are translated during
1014 .Ic mget
1015 commands and
1016 .Ic get
1017 commands issued without a specified local target filename.
1018 This command is useful when connecting to a
1019 .No non\- Ns Ux
1020 remote computer
1021 with different file naming conventions or practices.
1022 Characters in a filename matching a character in
1023 .Ar inchars
1024 are replaced with the corresponding character in
1025 .Ar outchars .
1026 If the character's position in
1027 .Ar inchars
1028 is longer than the length of
1029 .Ar outchars ,
1030 the character is deleted from the file name.
1031 .It Ic open Ar host Op Ar port
1032 Establish a connection to the specified
1033 .Ar host
1034 .Tn FTP
1035 server.
1036 An optional port number may be supplied,
1037 in which case,
1038 .Nm
1039 will attempt to contact an
1040 .Tn FTP
1041 server at that port.
1042 If the
1043 .Ic "set auto-login"
1044 option is on (default),
1045 .Nm
1046 will also attempt to automatically log the user in to
1047 the
1048 .Tn FTP
1049 server (see below).
1050 .It Ic page Ar file
1051 Retrieve
1052 .Ic file
1053 and display with the program specified by the
1054 .Ic "set pager"
1055 option.
1056 .It Ic passive Op Cm auto
1057 Toggle passive mode (if no arguments are given).
1058 If
1059 .Cm auto
1060 is given, act as if
1061 .Ev FTPMODE
1062 is set to
1063 .Sq auto .
1064 If passive mode is turned on (default),
1065 .Nm
1066 will send a
1067 .Dv PASV
1068 command for all data connections instead of a
1069 .Dv PORT
1070 command.
1071 The
1072 .Dv PASV
1073 command requests that the remote server open a port for the data connection
1074 and return the address of that port.
1075 The remote server listens on that port and the client connects to it.
1076 When using the more traditional
1077 .Dv PORT
1078 command, the client listens on a port and sends that address to the remote
1079 server, who connects back to it.
1080 Passive mode is useful when using
1081 .Nm
1082 through a gateway router or host that controls the directionality of
1083 traffic.
1084 .Po
1085 Note that though
1086 .Tn FTP
1087 servers are required to support the
1088 .Dv PASV
1089 command by
1090 .Li RFC 1123 ,
1091 some do not.
1092 .Pc
1093 .It Ic pdir Op Ar remote-path
1094 Perform
1095 .Ic dir
1096 .Op Ar remote-path ,
1097 and display the result with the program specified by the
1098 .Ic "set pager"
1099 option.
1100 .It Ic pls Op Ar remote-path
1101 Perform
1102 .Ic ls
1103 .Op Ar remote-path ,
1104 and display the result with the program specified by the
1105 .Ic "set pager"
1106 option.
1107 .It Ic pmlsd Op Ar remote-path
1108 Perform
1109 .Ic mlsd
1110 .Op Ar remote-path ,
1111 and display the result with the program specified by the
1112 .Ic "set pager"
1113 option.
1114 .It Ic preserve
1115 Toggle preservation of modification times on retrieved files.
1116 .It Ic progress
1117 Toggle display of transfer progress bar.
1118 The progress bar will be disabled for a transfer that has
1119 .Ar local-file
1120 as
1121 .Sq Fl
1122 or a command that starts with
1123 .Ql \&| .
1124 Refer to
1125 .Sx FILE NAMING CONVENTIONS
1126 for more information.
1127 Enabling
1128 .Ic progress
1129 disables
1130 .Ic hash .
1131 .It Ic prompt
1132 Toggle interactive prompting.
1133 Interactive prompting
1134 occurs during multiple file transfers to allow the
1135 user to selectively retrieve or store files.
1136 If prompting is turned off (default is on), any
1137 .Ic mget
1138 or
1139 .Ic mput
1140 will transfer all files, and any
1141 .Ic mdelete
1142 will delete all files.
1143 .Pp
1144 When prompting is on, the following commands are available at a prompt:
1145 .Bl -tag -width 2n -offset indent
1146 .It Cm a
1147 Answer
1148 .Sq yes
1149 to the current file, and automatically answer
1150 .Sq yes
1151 to any remaining files for the current command.
1152 .It Cm n
1153 Answer
1154 .Sq no ,
1155 and do not transfer the file.
1156 .It Cm p
1157 Answer
1158 .Sq yes
1159 to the current file, and turn off prompt mode
1160 .Po
1161 as if
1162 .Ic prompt off
1163 had been given
1164 .Pc .
1165 .It Cm q
1166 Terminate the current operation.
1167 .It Cm y
1168 Answer
1169 .Sq yes ,
1170 and transfer the file.
1171 .It Cm \&?
1172 Display a help message.
1173 .El
1174 .Pp
1175 Any other response will answer
1176 .Sq yes
1177 to the current file.
1178 .It Ic proxy Ar ftp-command
1179 Execute an
1180 .Tn FTP
1181 command on a secondary control connection.
1182 This command allows simultaneous connection to two remote
1183 .Tn FTP
1184 servers for transferring files between the two servers.
1185 The first
1186 .Ic proxy
1187 command should be an
1188 .Ic open ,
1189 to establish the secondary control connection.
1190 Enter the command
1191 .Sq Li "proxy \&?"
1192 to see other
1193 .Tn FTP
1194 commands executable on the secondary connection.
1195 The following commands behave differently when prefaced by
1196 .Ic proxy\^ :
1197 .Ic open
1198 will not define new macros during the auto-login process,
1199 .Ic close
1200 will not erase existing macro definitions,
1201 .Ic get
1202 and
1203 .Ic mget
1204 transfer files from the host on the primary control connection
1205 to the host on the secondary control connection, and
1206 .Ic put ,
1207 .Ic mput ,
1208 and
1209 .Ic append
1210 transfer files from the host on the secondary control connection
1211 to the host on the primary control connection.
1212 Third party file transfers depend upon support of the
1213 .Tn FTP
1214 protocol
1215 .Dv PASV
1216 command by the server on the secondary control connection.
1217 .It Ic put Ar local-file Op Ar remote-file
1218 Store a local file on the remote machine.
1219 If
1220 .Ar remote-file
1221 is left unspecified, the local file name is used
1222 after processing according to any
1223 .Ic ntrans
1224 or
1225 .Ic nmap
1226 settings
1227 in naming the remote file.
1228 File transfer uses the
1229 current settings for
1230 .Ic type ,
1231 .Ic form ,
1232 .Ic mode ,
1233 and
1234 .Ic struct .
1235 .It Ic pwd
1236 Print the name of the current working directory on the remote
1237 machine.
1238 .It Ic quit
1239 A synonym for
1240 .Ic bye .
1241 .It Ic quote Op Ar arg ...
1242 The arguments specified are sent, verbatim, to the remote
1243 .Tn FTP
1244 server.
1245 .It Ic rate Ar direction Oo Ar maximum Oo Ar increment Oc Oc
1246 Throttle the maximum transfer rate to
1247 .Ar maximum
1248 bytes/second.
1249 If
1250 .Ar maximum
1251 is 0, disable the throttle.
1252 .Pp
1253 .Ar direction
1254 may be one of:
1255 .Bl -tag -width ".Cm all" -offset indent -compact
1256 .It Cm all
1257 Both directions.
1258 .It Cm get
1259 Incoming transfers.
1260 .It Cm put
1261 Outgoing transfers.
1262 .El
1263 .Pp
1264 .Ar maximum
1265 can be modified on the fly by
1266 .Ar increment
1267 bytes (default: 1024) each time a given signal is received:
1268 .Bl -tag -width ".Dv SIGUSR1" -offset indent
1269 .It Dv SIGUSR1
1270 Increment
1271 .Ar maximum
1272 by
1273 .Ar increment
1274 bytes.
1275 .It Dv SIGUSR2
1276 Decrement
1277 .Ar maximum
1278 by
1279 .Ar increment
1280 bytes.
1281 The result must be a positive number.
1282 .El
1283 .Pp
1284 If
1285 .Ar maximum
1286 is not supplied, the current throttle rates are displayed.
1287 .Pp
1288 Note:
1289 .Ic rate
1290 is not yet implemented for
1291 .Ic type Cm ascii
1292 transfers.
1293 .It Ic rcvbuf Ar size
1294 Set the size of the socket receive buffer to
1295 .Ar size .
1296 .It Ic recv Ar remote-file Op Ar local-file
1297 A synonym for
1298 .Ic get .
1299 .It Ic reget Ar remote-file Op Ar local-file
1300 .Ic reget
1301 acts like
1302 .Ic get ,
1303 except that if
1304 .Ar local-file
1305 exists and is
1306 smaller than
1307 .Ar remote-file ,
1308 .Ar local-file
1309 is presumed to be
1310 a partially transferred copy of
1311 .Ar remote-file
1312 and the transfer
1313 is continued from the apparent point of failure.
1314 This command
1315 is useful when transferring very large files over networks that
1316 are prone to dropping connections.
1317 .It Ic remopts Ar command Op Ar command-options
1318 Set options on the remote
1319 .Tn FTP
1320 server for
1321 .Ar command
1322 to
1323 .Ar command-options
1324 .Pq whose absence is handled on a command-specific basis .
1325 Remote
1326 .Tn FTP
1327 commands known to support options include:
1328 .Dv MLST
1329 .Po
1330 used for
1331 .Dv MLSD
1332 and
1333 .Dv MLST
1334 .Pc .
1335 .It Ic rename Op Ar from Op Ar to
1336 Rename the file
1337 .Ar from
1338 on the remote machine, to the file
1339 .Ar to .
1340 .It Ic reset
1341 Clear reply queue.
1342 This command re-synchronizes command/reply sequencing with the remote
1343 .Tn FTP
1344 server.
1345 Resynchronization may be necessary following a violation of the
1346 .Tn FTP
1347 protocol by the remote server.
1348 .It Ic restart Ar marker
1349 Restart the immediately following
1350 .Ic get
1351 or
1352 .Ic put
1353 at the
1354 indicated
1355 .Ar marker .
1356 On
1357 .Ux
1358 systems, marker is usually a byte
1359 offset into the file.
1360 .It Ic rhelp Op Ar command-name
1361 Request help from the remote
1362 .Tn FTP
1363 server.
1364 If a
1365 .Ar command-name
1366 is specified it is supplied to the server as well.
1367 .It Ic rmdir Ar directory-name
1368 Delete a directory on the remote machine.
1369 .It Ic rstatus Op Ar remote-file
1370 With no arguments, show status of remote machine.
1371 If
1372 .Ar remote-file
1373 is specified, show status of
1374 .Ar remote-file
1375 on remote machine.
1376 .It Ic runique
1377 Toggle storing of files on the local system with unique filenames.
1378 If a file already exists with a name equal to the target
1379 local filename for a
1380 .Ic get
1381 or
1382 .Ic mget
1383 command, a
1384 .Ql \&.1
1385 is appended to the name.
1386 If the resulting name matches another existing file,
1387 a
1388 .Ql \&.2
1389 is appended to the original name.
1390 If this process continues up to
1391 .Ql .99 ,
1392 an error
1393 message is printed, and the transfer does not take place.
1394 The generated unique filename will be reported.
1395 Note that
1396 .Ic runique
1397 will not affect local files generated from a shell command
1398 (see below).
1399 The default value is off.
1400 .It Ic send Ar local-file Op Ar remote-file
1401 A synonym for
1402 .Ic put .
1403 .It Ic sendport
1404 Toggle the use of
1405 .Dv PORT
1406 commands.
1407 By default,
1408 .Nm
1409 will attempt to use a
1410 .Dv PORT
1411 command when establishing
1412 a connection for each data transfer.
1413 The use of
1414 .Dv PORT
1415 commands can prevent delays
1416 when performing multiple file transfers.
1417 If the
1418 .Dv PORT
1419 command fails,
1420 .Nm
1421 will use the default data port.
1422 When the use of
1423 .Dv PORT
1424 commands is disabled, no attempt will be made to use
1425 .Dv PORT
1426 commands for each data transfer.
1427 This is useful
1428 for certain
1429 .Tn FTP
1430 implementations which do ignore
1431 .Dv PORT
1432 commands but, incorrectly, indicate they've been accepted.
1433 .It Ic set Op Ar option Ar value
1434 Set
1435 .Ar option
1436 to
1437 .Ar value .
1438 If
1439 .Ar option
1440 and
1441 .Ar value
1442 are not given, display all of the options and their values.
1443 The supported
1444 .Ar option
1445 values are:
1446 .Bl -tag -width ".Cm sslnoverify" -offset indent
1447 .It Cm anonpass
1448 Defaults to
1449 .Ev $FTPANONPASS
1450 .It Cm ftp_proxy
1451 Defaults to
1452 .Ev $ftp_proxy .
1453 .It Cm http_proxy
1454 Defaults to
1455 .Ev $http_proxy .
1456 .It Cm https_proxy
1457 Defaults to
1458 .Ev $https_proxy .
1459 .It Cm no_proxy
1460 Defaults to
1461 .Ev $no_proxy .
1462 .It Cm pager
1463 Defaults to
1464 .Ev $PAGER .
1465 .It Cm prompt
1466 Defaults to
1467 .Ev $FTPPROMPT .
1468 .It Cm rprompt
1469 Defaults to
1470 .Ev $FTPRPROMPT .
1471 .It Cm sslnoverify
1472 Defaults to
1473 .Ev $FTPSSLNOVERIFY .
1474 .El
1475 .It Ic site Op Ar arg ...
1476 The arguments specified are sent, verbatim, to the remote
1477 .Tn FTP
1478 server as a
1479 .Dv SITE
1480 command.
1481 .It Ic size Ar remote-file
1482 Return size of
1483 .Ar remote-file
1484 on remote machine.
1485 .It Ic sndbuf Ar size
1486 Set the size of the socket send buffer to
1487 .Ar size .
1488 .It Ic status
1489 Show the current status of
1490 .Nm tnftp .
1491 .It Ic struct Ar struct-name
1492 Set the file transfer data structures to
1493 .Ar struct-name .
1494 The default (and only supported)
1495 .Ar struct-name
1496 is
1497 .Ql file .
1498 .It Ic sunique
1499 Toggle storing of files on remote machine under unique file names.
1500 The remote
1501 .Tn FTP
1502 server must support
1503 .Tn FTP
1504 protocol
1505 .Dv STOU
1506 command for
1507 successful completion.
1508 The remote server will report unique name.
1509 Default value is off.
1510 .It Ic system
1511 Show the type of operating system running on the remote machine.
1512 .It Ic tenex
1513 A synonym for
1514 .Ic type Cm tenex .
1515 .It Ic throttle
1516 A synonym for
1517 .Ic rate .
1518 .It Ic trace
1519 Toggle packet tracing.
1520 .It Ic type Op Ar type-name
1521 Set the file transfer data type to
1522 .Ar type-name .
1523 If no type is specified, the current type
1524 is printed.
1525 Supported
1526 .Ar type-name
1527 values are:
1528 .Bl -tag -width "binary" -offset indent
1529 .It Cm ascii
1530 Network ASCII.
1531 This is the default type.
1532 .It Cm binary
1533 8-bit byte binary transfer, without any transformations.
1534 .It Cm ebcdic
1535 EBCDIC transfer.
1536 Not implemented in
1537 .Nm .
1538 .It Cm image
1539 A synonym for
1540 .Ic type Cm binary .
1541 .It Cm tenex
1542 Set the file transfer type
1543 to that needed to binary transfer with
1544 .Tn TENEX
1545 machines, with local byte size 8.
1546 .El
1547 .It Ic umask Op Ar newmask
1548 Set the default umask on the remote server to
1549 .Ar newmask .
1550 If
1551 .Ar newmask
1552 is omitted, the current umask is printed.
1553 .It Ic unset Ar option
1554 Unset
1555 .Ar option .
1556 Refer to
1557 .Ic set
1558 for more information.
1559 .It Ic usage Ar command
1560 Print the usage message for
1561 .Ar command .
1562 .It Ic user Ar user-name Oo Ar password Oo Ar account Oc Oc
1563 Identify yourself to the remote
1564 .Tn FTP
1565 server.
1566 If the
1567 .Ar password
1568 is not specified and the server requires it,
1569 .Nm
1570 will prompt the user for it (after disabling local echo).
1571 If an
1572 .Ar account
1573 field is not specified, and the
1574 .Tn FTP
1575 server
1576 requires it, the user will be prompted for it.
1577 If an
1578 .Ar account
1579 field is specified, an account command will
1580 be relayed to the remote server after the login sequence
1581 is completed if the remote server did not require it
1582 for logging in.
1583 Unless
1584 .Nm
1585 is invoked with
1586 .Dq auto-login
1587 disabled, this process is done automatically on initial connection to the
1588 .Tn FTP
1589 server.
1590 .It Ic verbose
1591 Toggle verbose mode.
1592 In verbose mode, all responses from
1593 the
1594 .Tn FTP
1595 server are displayed to the user.
1596 In addition,
1597 if verbose is on, when a file transfer completes, statistics
1598 regarding the efficiency of the transfer are reported.
1599 By default,
1600 verbose is on.
1601 .It Ic xferbuf Ar size
1602 Set the size of the socket send and receive buffers to
1603 .Ar size .
1604 If
1605 .Ar size
1606 is 0, the default values for the operating system are used.
1607 .It Ic \&? Op Ar command
1608 A synonym for
1609 .Ic help .
1610 .El
1611 .Pp
1612 Command arguments which have embedded spaces may be quoted with
1613 quote
1614 .Ql \&\(dq
1615 marks.
1616 .Pp
1617 Commands which toggle settings can take an explicit
1618 .Ic on
1619 or
1620 .Ic off
1621 argument to force the setting appropriately.
1622 .Pp
1623 Commands which take a byte count as an argument
1624 .Po
1625 e.g.,
1626 .Ic hash ,
1627 .Ic rate ,
1628 and
1629 .Ic xferbuf
1630 .Pc
1631 support an optional suffix on the argument which changes the
1632 interpretation of the argument.
1633 Supported suffixes are:
1634 .Bl -tag -width 3n -offset indent -compact
1635 .It Li b
1636 Causes no modification.
1637 (Optional)
1638 .It Li k
1639 Kilo; multiply the argument by 1024
1640 .It Li m
1641 Mega; multiply the argument by 1048576
1642 .It Li g
1643 Giga; multiply the argument by 1073741824
1644 .El
1645 .Pp
1646 If
1647 .Nm
1648 receives a
1649 .Dv SIGINFO
1650 .Po
1651 see the
1652 .Cm status
1653 argument of
1654 .Xr stty 1
1655 .Pc
1656 or
1657 .Dv SIGQUIT
1658 signal whilst a transfer is in progress, the current transfer rate
1659 statistics will be written to the standard error output, in the
1660 same format as the standard completion message.
1661 .Sh AUTO-FETCHING FILES
1662 In addition to standard commands, this version of
1663 .Nm
1664 supports an auto-fetch feature.
1665 To enable auto-fetch, simply pass the list of hostnames/files
1666 on the command line.
1667 .Pp
1668 The following formats are valid syntax for an auto-fetch element:
1669 .Bl -tag -width "FOO "
1670 .\" [user@]host:[path][/]
1671 .It Oo Ar user Ns Li \&@ Oc Ns Ar host Ns Li \&: Ns Oo Ar path Oc \
1672 Ns Oo Li / Oc
1673 .Dq Classic
1674 .Tn FTP
1675 format.
1676 .Pp
1677 If
1678 .Ar path
1679 contains a glob character and globbing is enabled,
1680 (see
1681 .Ic glob ) ,
1682 then the equivalent of
1683 .Ic mget Ar path
1684 is performed.
1685 .Pp
1686 If the directory component of
1687 .Ar path
1688 contains no globbing characters,
1689 it is stored locally with the name basename (see
1690 .Xr basename 1 )
1691 of
1692 .Ic path ,
1693 in the current directory.
1694 Otherwise, the full remote name is used as the local name,
1695 relative to the local root directory.
1696 .\" ftp://[user[:password]@]host[:port]/path[/][;type=type]
1697 .It Li ftp:// Ns Oo Ar user Ns Oo Ns Li \&: Ns Ar password Oc Ns Li \&@ Oc \
1698 Ns Ar host Ns Oo Li \&: Ns Ar port Oc Ns Li / Ns Ar path Ns Oo Li / Oc \
1699 Ns Oo Li ;type= Ns Ar type Oc
1700 An
1701 .Tn FTP
1702 URL, retrieved using the
1703 .Tn FTP
1704 protocol if
1705 .Ic "set ftp_proxy"
1706 isn't defined.
1707 Otherwise, transfer the URL using
1708 .Tn HTTP
1709 via the proxy defined in
1710 .Ic "set ftp_proxy" .
1711 If
1712 .Ic "set ftp_proxy"
1713 isn't defined and
1714 .Ar user
1715 is given, login as
1716 .Ar user .
1717 In this case, use
1718 .Ar password
1719 if supplied, otherwise prompt the user for one.
1720 .Pp
1721 If a suffix of
1722 .Ql \&;type=A
1723 or
1724 .Ql \&;type=I
1725 is supplied, then the transfer type will take place as
1726 .Ic type Cm ascii
1727 or
1728 .Ic type Cm binary
1729 (respectively).
1730 The default transfer type is
1731 .Ic type Cm binary .
1732 .Pp
1733 In order to be compliant with
1734 .Li RFC 3986 ,
1735 .Nm
1736 interprets the
1737 .Ar path
1738 part of an
1739 .Ql ftp://
1740 auto-fetch URL as follows:
1741 .Bl -bullet
1742 .It
1743 The
1744 .Ql /
1745 immediately after the
1746 .Ar host Ns Oo Li \&: Ns Ar port Oc
1747 is interpreted as a separator before the
1748 .Ar path ,
1749 and not as part of the
1750 .Ar path
1751 itself.
1752 .It
1753 The
1754 .Ar path
1755 is interpreted as a
1756 .So Li / Sc Ns -separated
1757 list of name components.
1758 For all but the last such component,
1759 .Nm
1760 performs the equivalent of a
1761 .Ic cd
1762 command.
1763 For the last path component,
1764 .Nm
1765 performs the equivalent of a
1766 .Ic get
1767 command.
1768 .It
1769 Empty name components,
1770 which result from
1771 .Ql //
1772 within the
1773 .Ar path ,
1774 or from an extra
1775 .Ql /
1776 at the beginning of the
1777 .Ar path ,
1778 will cause the equivalent of a
1779 .Ic cd
1780 command without a directory name.
1781 This is unlikely to be useful.
1782 .It
1783 Any
1784 .Sq Cm \&% Ns Ar XX\^
1785 codes
1786 (per
1787 .Li RFC 3986 )
1788 within the path components are decoded, with
1789 .Ar XX
1790 representing a character code in hexadecimal.
1791 This decoding takes place after the
1792 .Ar path
1793 has been split into components,
1794 but before each component is used in the equivalent of a
1795 .Ic cd
1796 or
1797 .Ic get
1798 command.
1799 Some often-used codes are
1800 .Ql \&%2F
1801 (which represents
1802 .Ql / )
1803 and
1804 .Ql \&%7E
1805 .Po
1806 which represents
1807 .Ql ~
1808 .Pc .
1809 .El
1810 .Pp
1811 The above interpretation has the following consequences:
1812 .Bl -bullet
1813 .It
1814 The path is interpreted relative to the
1815 default login directory of the specified user or of the
1816 .Sq anonymous
1817 user.
1818 If the
1819 .Pa /
1820 directory is required, use a leading path of
1821 .Ql \&%2F .
1822 If a user's home directory is required
1823 .Pq and the remote server supports the syntax ,
1824 use a leading path of
1825 .Ql \&%7E Ns Ar user Ns Li / .
1826 For example, to retrieve
1827 .Pa /etc/motd
1828 from
1829 .Ql localhost
1830 as the user
1831 .Ql myname
1832 with the password
1833 .Ql mypass ,
1834 use
1835 .Ql ftp://myname:mypass@localhost/%2fetc/motd
1836 .It
1837 The exact
1838 .Ic cd
1839 and
1840 .Ic get
1841 commands can be controlled by careful choice of
1842 where to use
1843 .Ql /
1844 and where to use
1845 .Ql \&%2F
1846 (or
1847 .Ql %2f ) .
1848 For example, the following URLs correspond to the
1849 equivalents of the indicated commands:
1850 .Bl -tag -width "ftp://host/%2Fdir1%2Fdir2%2Ffile"
1851 .It Xo \" ftp://host/dir1/dir2/file
1852 .Sm off
1853 .Ic ftp:// Ar host
1854 .Ic / Ar dir1
1855 .Ic / Ar dir2
1856 .Ic / Ar file
1857 .Sm on
1858 .Xc
1859 .Ic cd Ar dir1 ,
1860 .Ic cd Ar dir2 ,
1861 .Ic get Ar file .
1862 .It Xo \" ftp://host/%2Fdir1/dir2/file
1863 .Sm off
1864 .Ic ftp:// Ar host
1865 .Ic /%2F Ar dir1
1866 .Ic / Ar dir2
1867 .Ic / Ar file
1868 .Sm on
1869 .Xc
1870 .Ic cd / Ns Ar dir1 ,
1871 .Ic cd Ar dir2 ,
1872 .Ic get Ar file .
1873 .It Xo \" ftp://host/dir1%2Fdir2/file
1874 .Sm off
1875 .Ic ftp:// Ar host
1876 .Ic / Ar dir1
1877 .Ic %2F Ar dir2
1878 .Ic / Ar file
1879 .Sm on
1880 .Xc
1881 .Ic cd Ar dir1 Ns Ic / Ns Ar dir2 ,
1882 .Ic get Ar file .
1883 .El
1884 .It
1885 You must have appropriate access permission for each of the
1886 intermediate directories that is used in the equivalent of a
1887 .Ic cd
1888 command.
1889 .El
1890 .\" http://[user[:password]@]host[:port]/path
1891 .It Li http:// Ns Oo Ar user Ns Oo Li \&: Ns Ar password Oc Ns Li \&@ Oc \
1892 Ns Ar host Ns Oo Li \&: Ns Ar port Oc Ns Li / Ns Ar path
1893 An
1894 .Tn HTTP
1895 URL, retrieved using the
1896 .Tn HTTP
1897 protocol.
1898 If
1899 .Ic "set http_proxy"
1900 is defined, it is used as a URL to an
1901 .Tn HTTP
1902 proxy server.
1903 If
1904 .Tn HTTP
1905 authorization is required to retrieve
1906 .Ar path ,
1907 and
1908 .Ar user
1909 (and optionally
1910 .Ar password\^ )
1911 is in the URL, use them for the first attempt to authenticate.
1912 .\" https://[user[:password]@]host[:port]/path
1913 .It Li https:// Ns Oo Ar user Ns Oo Li \&: Ns Ar password Oc Ns Li \&@ Oc \
1914 Ns Ar host Ns Oo Li \&: Ns Ar port Oc Ns Li / Ns Ar path
1915 An
1916 .Tn HTTPS
1917 URL, retrieved using the
1918 .Tn HTTPS
1919 protocol.
1920 If
1921 .Ic "set https_proxy"
1922 is defined, it is used as a URL to an
1923 .Tn HTTPS
1924 proxy server.
1925 If
1926 .Tn HTTPS
1927 authorization is required to retrieve
1928 .Ar path ,
1929 and
1930 .Ar user
1931 (and optionally
1932 .Ar password\^ )
1933 is in the URL, use them for the first attempt to authenticate.
1934 .\" file:///path
1935 .It Li file:/// Ns Ar path
1936 A local URL, copied from
1937 .Pa / Ns Ar path
1938 on the local host.
1939 .\" about:
1940 .It Li about\&: Ns Ar topic
1941 Display information regarding
1942 .Ar topic ;
1943 no file is retrieved for this auto-fetched element.
1944 Supported values include:
1945 .Bl -tag -width "about:version"
1946 .It Li about:ftp
1947 Information about
1948 .Nm tnftp .
1949 .It Li about:version
1950 The version of
1951 .Nm tnftp .
1952 Useful to provide when reporting problems.
1953 .El
1954 .El
1955 .Pp
1956 Unless noted otherwise above, and
1957 .Fl o Ar output
1958 is not given, the file is stored in the current directory as the
1959 .Xr basename 1
1960 of
1961 .Ar path .
1962 Note that if a
1963 .Tn HTTP
1964 redirect is received, the fetch is retried using the new target URL
1965 supplied by the server, with a corresponding new
1966 .Ar path .
1967 Using an explicit
1968 .Fl o Ar output
1969 is recommended, to avoid writing to unexpected file names.
1970 .Pp
1971 If a classic format or an
1972 .Tn FTP
1973 URL format has a trailing
1974 .Ql /
1975 or an empty
1976 .Ar path
1977 component, then
1978 .Nm
1979 will connect to the site and
1980 .Ic cd
1981 to the directory given as the path, and leave the user in interactive
1982 mode ready for further input.
1983 This will not work if
1984 .Ic "set ftp_proxy"
1985 is being used.
1986 .Pp
1987 Direct
1988 .Tn HTTP
1989 transfers use HTTP 1.1.
1990 Proxied
1991 .Tn FTP
1992 and
1993 .Tn HTTP
1994 transfers use HTTP 1.0.
1995 .Pp
1996 If
1997 .Fl R
1998 is given, all auto-fetches that don't go via the
1999 .Tn FTP
2000 or
2001 .Tn HTTP
2002 proxies will be restarted.
2003 For
2004 .Tn FTP ,
2005 this is implemented by using
2006 .Ic reget
2007 instead of
2008 .Ic get .
2009 For
2010 .Tn HTTP ,
2011 this is implemented by using the
2012 .Sq "Range: bytes="
2013 .Tn "HTTP/1.1"
2014 directive.
2015 .Pp
2016 If WWW or proxy WWW authentication is required, you will be prompted
2017 to enter a username and password to authenticate with.
2018 .Pp
2019 When specifying IPv6 numeric addresses in a URL, you need to
2020 surround the address in square brackets.
2021 E.g.:
2022 .Ql ftp://[::1]:21/ .
2023 This is because colons are used in IPv6 numeric address as well as
2024 being the separator for the port number.
2025 .Sh ABORTING A FILE TRANSFER
2026 To abort a file transfer, use the terminal interrupt key
2027 (usually Ctrl-C).
2028 Sending transfers will be immediately halted.
2029 Receiving transfers will be halted by sending an
2030 .Tn FTP
2031 protocol
2032 .Dv ABOR
2033 command to the remote server, and discarding any further data received.
2034 The speed at which this is accomplished depends upon the remote
2035 server's support for
2036 .Dv ABOR
2037 processing.
2038 If the remote server does not support the
2039 .Dv ABOR
2040 command, the prompt will not appear until the remote server has completed
2041 sending the requested file.
2042 .Pp
2043 If the terminal interrupt key sequence is used whilst
2044 .Nm
2045 is awaiting a reply from the remote server for the
2046 .Dv ABOR
2047 processing,
2048 then the connection will be closed.
2049 This is different from the traditional behaviour (which ignores the
2050 terminal interrupt during this phase), but is considered more useful.
2051 .Sh FILE NAMING CONVENTIONS
2052 Files specified as arguments to
2053 .Nm
2054 commands are processed according to the following rules.
2055 .Bl -enum
2056 .It
2057 If the file name
2058 .Sq Fl
2059 is specified, the
2060 .Va stdin
2061 (for reading) or
2062 .Va stdout
2063 (for writing) is used.
2064 .It
2065 If the first character of the file name is
2066 .Ql \&| ,
2067 the
2068 remainder of the argument is interpreted as a shell command.
2069 .Nm
2070 then forks a shell, using
2071 .Xr popen 3
2072 with the argument supplied, and reads (writes) from the stdout
2073 (stdin).
2074 If the shell command includes spaces, the argument
2075 must be quoted; e.g.
2076 .Ql \*q|\~ls\~\-lt\*q .
2077 A particularly
2078 useful example of this mechanism is:
2079 .Ql dir\~\*q\*q\~|more .
2080 .It
2081 Failing the above checks, if globbing
2082 is enabled, local file names are expanded according to the rules
2083 used in the
2084 .Xr csh 1 ;
2085 see the
2086 .Ic glob
2087 command.
2088 If the
2089 .Nm
2090 command expects a single local file (e.g.
2091 .Ic put ) ,
2092 only the first filename generated by the globbing operation is used.
2093 .It
2094 For
2095 .Ic mget
2096 commands and
2097 .Ic get
2098 commands with unspecified local file names, the local filename is
2099 the remote filename, which may be altered by a
2100 .Ic case ,
2101 .Ic ntrans ,
2102 or
2103 .Ic nmap
2104 setting.
2105 The resulting filename may then be altered if
2106 .Ic runique
2107 is on.
2108 .It
2109 For
2110 .Ic mput
2111 commands and
2112 .Ic put
2113 commands with unspecified remote file names, the remote filename is
2114 the local filename, which may be altered by a
2115 .Ic ntrans
2116 or
2117 .Ic nmap
2118 setting.
2119 The resulting filename may then be altered by the remote server if
2120 .Ic sunique
2121 is on.
2122 .El
2123 .Sh FILE TRANSFER PARAMETERS
2124 The
2125 .Tn FTP
2126 specification in RFC 959
2127 specifies many parameters which may affect a file transfer.
2128 .Pp
2129 The file transfer parameter data type is specified as one of
2130 .Dq ASCII type ,
2131 .Dq EBCDIC type ,
2132 .Dq image type
2133 (also known as binary),
2134 and
2135 .Dq local type
2136 (for
2137 .Tn PDP Ns -10's
2138 and
2139 .Tn PDP Ns -20's
2140 mostly).
2141 .Nm
2142 only implements
2143 .Ic type Cm ascii ,
2144 .Ic type Cm binary ,
2145 .Ic type Cm image ,
2146 and
2147 .Ic type Cm tenex
2148 with local byte size 8.
2149 .Pp
2150 .Nm
2151 supports only the default values for the remaining
2152 file transfer parameters via commands:
2153 .Ic mode ,
2154 .Ic form ,
2155 and
2156 .Ic struct .
2157 .Sh THE .netrc FILE
2158 The
2159 .Pa .netrc
2160 file contains login and initialization information
2161 used by the auto-login process.
2162 It resides in the user's home directory,
2163 unless overridden with the
2164 .Fl N Ar netrc
2165 option, or specified in the
2166 .Ev NETRC
2167 environment variable.
2168 The following tokens are recognized; they may be separated by spaces,
2169 tabs, or new-lines:
2170 .Bl -tag -width password
2171 .It Ic machine Ar name
2172 Identify a remote machine
2173 .Ar name .
2174 The auto-login process searches the
2175 .Pa .netrc
2176 file for a
2177 .Ic machine
2178 token that matches the remote machine specified on the
2179 .Nm
2180 command line or as an
2181 .Ic open
2182 command argument.
2183 Once a match is made, the subsequent
2184 .Pa .netrc
2185 tokens are processed,
2186 stopping when the end of file is reached or another
2187 .Ic machine
2188 or a
2189 .Ic default
2190 token is encountered.
2191 .It Ic default
2192 This is the same as
2193 .Ic machine
2194 .Ar name
2195 except that
2196 .Ic default
2197 matches any name.
2198 There can be only one
2199 .Ic default
2200 token, and it must be after all
2201 .Ic machine
2202 tokens.
2203 This is normally used as:
2204 .Pp
2205 .Dl default login anonymous password user@site
2206 .Pp
2207 thereby giving the user an automatic anonymous
2208 .Tn FTP
2209 login to
2210 machines not specified in
2211 .Pa .netrc .
2212 This can be overridden
2213 by using the
2214 .Fl n
2215 flag to disable auto-login.
2216 .It Ic login Ar name
2217 Identify a user on the remote machine.
2218 If this token is present, the auto-login process will initiate
2219 a login using the specified
2220 .Ar name .
2221 .It Ic password Ar string
2222 Supply a password.
2223 If this token is present, the auto-login process will supply the
2224 specified string if the remote server requires a password as part
2225 of the login process.
2226 Note that if this token is present in the
2227 .Pa .netrc
2228 file for any user other
2229 than
2230 .Ar anonymous ,
2231 .Nm
2232 will abort the auto-login process if the
2233 .Pa .netrc
2234 is readable by
2235 anyone besides the user.
2236 .It Ic account Ar string
2237 Supply an additional account password.
2238 If this token is present, the auto-login process will supply the
2239 specified string if the remote server requires an additional
2240 account password, or the auto-login process will initiate an
2241 .Dv ACCT
2242 command if it does not.
2243 .It Ic macdef Ar name
2244 Define a macro.
2245 This token functions like the
2246 .Nm
2247 .Ic macdef
2248 command functions.
2249 A macro is defined with the specified name; its contents begin with the
2250 next
2251 .Pa .netrc
2252 line and continue until a blank line (consecutive new-line
2253 characters) is encountered.
2254 Like the other tokens in the
2255 .Pa .netrc
2256 file, a
2257 .Ic macdef
2258 is applicable only to the
2259 .Ic machine
2260 definition preceding it.
2261 A
2262 .Ic macdef
2263 entry cannot be used by multiple
2264 .Ic machine
2265 definitions; rather, it must be defined following each
2266 .Ic machine
2267 it is intended to be used with.
2268 If a macro named
2269 .Ic init
2270 is defined, it is automatically executed as the last step in the
2271 auto-login process.
2272 For example,
2273 .Bd -literal -offset indent
2274 default
2275 macdef init
2276 epsv4 off
2277 .Ed
2278 .Pp
2279 followed by a blank line.
2280 .El
2281 .Sh COMMAND LINE EDITING
2282 .Nm
2283 supports interactive command line editing, via the
2284 .Xr editline 3
2285 library.
2286 It is enabled with the
2287 .Ic edit
2288 command, and is enabled by default if input is from a tty.
2289 Previous lines can be recalled and edited with the arrow keys,
2290 and other GNU Emacs-style editing keys may be used as well.
2291 .Pp
2292 The
2293 .Xr editline 3
2294 library is configured with a
2295 .Pa .editrc
2296 file \(em refer to
2297 .Xr editrc 5
2298 for more information.
2299 .Pp
2300 An extra key binding is available to
2301 .Nm
2302 to provide context sensitive command and filename completion
2303 (including remote file completion).
2304 To use this, bind a key to the
2305 .Xr editline 3
2306 command
2307 .Ic ftp-complete .
2308 By default, this is bound to the TAB key.
2309 .Sh COMMAND LINE PROMPT
2310 By default,
2311 .Nm
2312 displays a command line prompt of
2313 .Sq Li ftp>\~
2314 to the user.
2315 This can be changed with the
2316 .Ic "set prompt"
2317 command.
2318 .Pp
2319 A prompt can be displayed on the right side of the screen (after the
2320 command input) with the
2321 .Ic "set rprompt"
2322 command.
2323 .Pp
2324 The following formatting sequences are replaced by the given
2325 information:
2326 .Bl -tag -width "%% " -offset indent
2327 .It Li \&%/
2328 The current remote working directory.
2329 .\" %c[[0]n], %.[[0]n]
2330 .It Li \&%c Ns Oo Oo Li 0 Oc Ns Ar n Oc , Li \&%\&. Ns Oo Oo Li 0 Oc Ns Ar n Oc
2331 The trailing component of the current remote working directory, or
2332 .Ar n
2333 trailing components if a digit
2334 .Ar n
2335 is given.
2336 If
2337 .Ar n
2338 begins with
2339 .Ql 0 ,
2340 the number of skipped components precede the trailing component(s) in
2341 the format
2342 .\" ``/<number>trailing''
2343 .Do
2344 .Sm off
2345 .Li / Li < Ar number Li >
2346 .Ar trailing
2347 .Sm on
2348 .Dc
2349 (for
2350 .Ql \&%c )
2351 or
2352 .\" ``...trailing''
2353 .Dq Li \&... Ns Ar trailing
2354 (for
2355 .Ql \&%\&. ) .
2356 .It Li \&%M
2357 The remote host name.
2358 .It Li \&%m
2359 The remote host name, up to the first dot
2360 .Ql \&. .
2361 .It Li \&%n
2362 The remote user name.
2363 .It Li \&%%
2364 A single percent character
2365 .Ql % .
2366 .El
2367 .Sh ENVIRONMENT
2368 .Nm
2369 uses the following environment variables.
2370 .Bl -tag -width "FTPSERVERPORT"
2371 .It Ev FTPANONPASS
2372 Password to send in an anonymous
2373 .Tn FTP
2374 transfer.
2375 Defaults to
2376 .Dq Li \&\`whoami\`@ .
2377 .It Ev FTPMODE
2378 Overrides the default operation mode.
2379 Supported values are:
2380 .Bl -tag -width "passive"
2381 .It Cm active
2382 active mode
2383 .Tn FTP
2384 only
2385 .It Cm auto
2386 automatic determination of passive or active (this is the default)
2387 .It Cm gate
2388 gate-ftp mode
2389 .It Cm passive
2390 passive mode
2391 .Tn FTP
2392 only
2393 .El
2394 .It Ev FTPPROMPT
2395 Command-line prompt to use.
2396 Defaults to
2397 .Sq Li ftp>\~ .
2398 Refer to
2399 .Sx COMMAND LINE PROMPT
2400 for more information.
2401 .It Ev FTPRPROMPT
2402 Command-line right side prompt to use.
2403 Defaults to empty string.
2404 Refer to
2405 .Sx COMMAND LINE PROMPT
2406 for more information.
2407 .It Ev FTPSERVER
2408 Host to use as gate-ftp server when
2409 .Ic gate
2410 is enabled.
2411 .It Ev FTPSERVERPORT
2412 Port to use when connecting to gate-ftp server when
2413 .Ic gate
2414 is enabled.
2415 Default is port returned by a
2416 .Xr getservbyname 3
2417 lookup of
2418 .Dq Li ftpgate/tcp .
2419 .It Ev FTPUSERAGENT
2420 The value to send for the
2421 .Tn HTTP
2422 User-Agent
2423 header.
2424 .It Ev FTPSSLNOVERIFY
2425 Set to 1 to not verify SSL certificates.
2426 .It Ev HOME
2427 For default location of a
2428 .Pa .netrc
2429 file, if one exists.
2430 .It Ev NETRC
2431 An alternate location of the
2432 .Pa .netrc
2433 file.
2434 .It Ev PAGER
2435 Used by various commands to display files.
2436 Defaults to
2437 .Xr more 1
2438 if empty or not set.
2439 .It Ev SHELL
2440 For default shell.
2441 .It Ev ftp_proxy
2442 URL of
2443 .Tn FTP
2444 proxy to use when making
2445 .Tn FTP
2446 URL requests
2447 (if not defined, use the standard
2448 .Tn FTP
2449 protocol).
2450 .Pp
2451 See
2452 .Ev http_proxy
2453 for further notes about proxy use.
2454 .It Ev http_proxy
2455 URL of
2456 .Tn HTTP
2457 proxy to use when making
2458 .Tn HTTP
2459 URL requests.
2460 If proxy authentication is required and there is a username and
2461 password in this URL, they will automatically be used in the first
2462 attempt to authenticate to the proxy.
2463 .Pp
2464 If
2465 .Dq unsafe
2466 URL characters are required in the username or password
2467 (for example
2468 .Ql @
2469 or
2470 .Ql / ) ,
2471 encode them with
2472 .Li RFC 3986
2473 .Ql \&% Ns Ar XX\^
2474 encoding.
2475 .Pp
2476 Note that the use of a username and password in
2477 .Ev ftp_proxy
2478 and
2479 .Ev http_proxy
2480 may be incompatible with other programs that use it
2481 (such as
2482 .Xr lynx 1 ) .
2483 .Pp
2484 .Em NOTE :
2485 this is not used for interactive sessions, only for command-line
2486 fetches.
2487 .It Ev https_proxy
2488 URL of
2489 .Tn HTTPS
2490 proxy to use when making
2491 .Tn HTTPS
2492 URL requests.
2493 .Pp
2494 See
2495 .Ev http_proxy
2496 for further notes about proxy use.
2497 .It Ev no_proxy
2498 A space or comma separated list of hosts (or domains) for which
2499 proxying is not to be used.
2500 Each entry may have an optional trailing
2501 .Ql \&: Ns Ar port ,
2502 which restricts
2503 the matching to connections to that port.
2504 .El
2505 .Sh EXTENDED PASSIVE MODE AND FIREWALLS
2506 Some firewall configurations do not allow
2507 .Nm
2508 to use extended passive mode.
2509 If you find that even a simple
2510 .Ic ls
2511 appears to hang after printing a message such as this:
2512 .Pp
2513 .Dl 229 Entering Extended Passive Mode (|||58551|)
2514 .Pp
2515 then you will need to disable extended passive mode with
2516 .Ic epsv4 off .
2517 See the above section
2518 .Sx The .netrc File
2519 for an example of how to make this automatic.
2520 .Sh SEE ALSO
2521 .Xr getservbyname 3 ,
2522 .Xr editrc 5 ,
2523 .Xr services 5 ,
2524 .Xr ftpd 8
2525 .Sh STANDARDS
2526 .Nm
2527 attempts to be compliant with:
2528 .Bl -tag -offset indent -width 8n
2529 .It Li RFC 959
2530 .Em File Transfer Protocol
2531 .It Li RFC 1123
2532 .Em Requirements for Internet Hosts - Application and Support
2533 .It Li RFC 1635
2534 .Em How to Use Anonymous FTP
2535 .It Li RFC 2389
2536 .Em Feature negotiation mechanism for the File Transfer Protocol
2537 .It Li RFC 2428
2538 .Em FTP Extensions for IPv6 and NATs
2539 .It Li RFC 2616
2540 .Em Hypertext Transfer Protocol \&-- HTTP/1.1
2541 .It Li RFC 2822
2542 .Em Internet Message Format
2543 .It Li RFC 3659
2544 .Em Extensions to FTP
2545 .It Li RFC 3986
2546 .Em Uniform Resource Identifier (URI)
2547 .El
2548 .Sh HISTORY
2549 The
2550 .Nm
2551 command appeared in
2552 .Bx 4.2 .
2553 .Pp
2554 Various features such as command line editing, context sensitive
2555 command and file completion, dynamic progress bar, automatic
2556 fetching of files and URLs, modification time preservation,
2557 transfer rate throttling, configurable command line prompt,
2558 and other enhancements over the standard
2559 .Bx
2560 .Nm
2561 were implemented in
2562 .Nx 1.3
2563 and later releases
2564 by
2565 .An Luke Mewburn
2566 .Aq [email protected] .
2567 .Pp
2568 IPv6 support was added by the WIDE/KAME project
2569 (but may not be present in all non-NetBSD versions of this program, depending
2570 if the operating system supports IPv6 in a similar manner to KAME).
2571 .Sh BUGS
2572 Correct execution of many commands depends upon proper behavior
2573 by the remote server.
2574 .Pp
2575 An error in the treatment of carriage returns
2576 in the
2577 .Bx 4.2
2578 .Ic type Cm ascii
2579 transfer code
2580 has been corrected.
2581 This correction may result in incorrect transfers of binary files
2582 to and from
2583 .Bx 4.2
2584 servers using
2585 .Ic type Cm ascii .
2586 Avoid this problem by using
2587 .Ic type Cm binary .
2588 .Pp
2589 .Nm
2590 assumes that all IPv4 mapped addresses
2591 .Po
2592 IPv6 addresses with a form like
2593 .Li ::ffff:10.1.1.1
2594 .Pc
2595 indicate IPv4 destinations which can be handled by
2596 .Dv AF_INET
2597 sockets.
2598 However, in certain IPv6 network configurations, this assumption is not true.
2599 In such an environment, IPv4 mapped addresses must be passed to
2600 .Dv AF_INET6
2601 sockets directly.
2602 For example, if your site uses a SIIT translator for IPv6-to-IPv4 translation,
2603 .Nm
2604 is unable to support your configuration.