1 .\" $NetBSD: ftp.1,v 1.119 2007/07/18 06:40:01 lukem Exp $
3 .\" Copyright (c) 1996-2007 The NetBSD Foundation, Inc.
4 .\" All rights reserved.
6 .\" This code is derived from software contributed to The NetBSD Foundation
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\" notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\" notice, this list of conditions and the following disclaimer in the
16 .\" documentation and/or other materials provided with the distribution.
17 .\" 3. All advertising materials mentioning features or use of this software
18 .\" must display the following acknowledgement:
19 .\" This product includes software developed by the NetBSD
20 .\" Foundation, Inc. and its contributors.
21 .\" 4. Neither the name of The NetBSD Foundation nor the names of its
22 .\" contributors may be used to endorse or promote products derived
23 .\" from this software without specific prior written permission.
25 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
26 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
27 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
29 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 .\" POSSIBILITY OF SUCH DAMAGE.
38 .\" Copyright (c) 1985, 1989, 1990, 1993
39 .\" The Regents of the University of California. All rights reserved.
41 .\" Redistribution and use in source and binary forms, with or without
42 .\" modification, are permitted provided that the following conditions
44 .\" 1. Redistributions of source code must retain the above copyright
45 .\" notice, this list of conditions and the following disclaimer.
46 .\" 2. Redistributions in binary form must reproduce the above copyright
47 .\" notice, this list of conditions and the following disclaimer in the
48 .\" documentation and/or other materials provided with the distribution.
49 .\" 3. Neither the name of the University nor the names of its contributors
50 .\" may be used to endorse or promote products derived from this software
51 .\" without specific prior written permission.
53 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
54 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
55 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
56 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
57 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
58 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
59 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
60 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
61 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
62 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
65 .\" @(#)ftp.1 8.3 (Berkeley) 10/9/94
73 Internet file transfer program
76 .Op Fl 46AadefginpRtvV
94 .\" [-T dir,max[,inc]]
106 .\" [[user@]host [port]]
108 .Oo Ar user Ns Li \&@ Oc Ns Ar host
113 .\" [[user@]host:[path][/]]
132 .\" [ftp://[user[:password]@]host[:port]/path[/]]
137 .Op Li \&: Ar password
139 .Ar host Oo Li \&: Ar port Oc
147 .\" [http://[user[:password]@]host[:port]/path]
152 .Op Li \&: Ar password
154 .Ar host Oo Li \&: Ar port Oc
167 is the user interface to the Internet standard File Transfer Protocol.
168 The program allows a user to transfer files to and from a
171 The last five arguments will fetch a file using the
175 protocols, or by direct copying, into the current directory.
176 This is ideal for scripts.
178 .Sx AUTO-FETCHING FILES
179 below for more information.
181 Options may be specified at the command line, or to the
187 to only use IPv4 addresses.
191 to only use IPv6 addresses.
193 Force active mode ftp.
196 will try to use passive mode ftp and fall back to active mode
197 if passive is not supported by the server.
200 to always use an active connection.
201 It is only useful for connecting to very old servers that do not
202 implement passive mode properly.
206 to bypass normal login procedure, and use an anonymous login instead.
210 Disables command line editing.
211 This is useful for Emacs ange-ftp mode.
213 Forces a cache reload for transfers that go through the
219 Disables file name globbing.
221 Turns off interactive prompting during
222 multiple file transfers.
228 upon initial connection for non auto-fetch transfers.
229 If auto-login is enabled,
233 (see below) file in the user's home directory for an entry describing
234 an account on the remote machine.
237 will prompt for the remote machine login name (default is the user
238 identity on the local machine), and, if necessary, prompt for a password
239 and an account with which to login.
240 To override the auto-login for auto-fetch transfers, specify the
241 username (and optionally, password) as appropriate.
249 for more information.
251 When auto-fetching files, save the contents in
254 is parsed according to the
255 .Sx FILE NAMING CONVENTIONS
261 or doesn't start with
263 then only the first file specified will be retrieved into
265 all other files will be retrieved into the basename of their
268 Enable passive mode operation for use behind connection filtering firewalls.
269 This option has been deprecated as
271 now tries to use passive mode by default, falling back to active mode
272 if the server does not support passive connections.
274 Sets the port number to
277 Quit if the connection has stalled for
281 Retry the connection attempt if it failed, pausing for
285 Restart all non-proxied auto-fetches.
289 as the local IP address for all connections.
291 Enables packet tracing.
300 Set the maximum transfer rate for
305 and if specified, the increment to
310 for more information.
311 .It Fl u Ar URL file Op \&.\&.\&.
312 Upload files on the command line to
316 is one of the ftp URL types as supported by auto-fetch
317 (with an optional target filename for single file uploads), and
319 is one or more local files to be uploaded.
325 This is the default if output is to a terminal (and in the case of
328 is the foreground process).
331 to show all responses from the remote server, as well
332 as report on data transfer statistics.
338 overriding the default of enabled when output is to a terminal.
341 The client host with which
343 is to communicate may be specified on the command line.
346 will immediately attempt to establish a connection to an
348 server on that host; otherwise,
350 will enter its command interpreter and await instructions
354 is awaiting commands from the user the prompt
356 is provided to the user.
357 The following commands are recognized
361 .It Ic \&! Op Ar command Op Ar args
362 Invoke an interactive shell on the local machine.
363 If there are arguments, the first is taken to be a command to execute
364 directly, with the rest of the arguments as its arguments.
365 .It Ic \&$ Ar macro-name Op Ar args
368 that was defined with the
371 Arguments are passed to the macro unglobbed.
372 .It Ic account Op Ar passwd
373 Supply a supplemental password required by a remote system for access
374 to resources once a login has been successfully completed.
375 If no argument is included, the user will be prompted for an account
376 password in a non-echoing input mode.
377 .It Ic append Ar local-file Op Ar remote-file
378 Append a local file to a file on the remote machine.
381 is left unspecified, the local file name is used in naming the
382 remote file after being altered by any
387 File transfer uses the current settings for
394 Set the file transfer
398 This is the default type.
400 Arrange that a bell be sounded after each file transfer
401 command is completed.
403 Set the file transfer
405 to support binary image transfer.
409 session with the remote server
412 An end of file will also terminate the session and exit.
414 Toggle remote computer file name case mapping during
422 is on (default is off), remote computer file names with all letters in
423 upper case are written in the local directory with the letters mapped
425 .It Ic \&cd Ar remote-directory
426 Change the working directory on the remote machine
428 .Ar remote-directory .
430 Change the remote machine working directory to the parent of the
431 current remote machine working directory.
432 .It Ic chmod Ar mode remote-file
433 Change the permission modes of the file
441 session with the remote server, and
442 return to the command interpreter.
443 Any defined macros are erased.
445 Toggle carriage return stripping during
446 ascii type file retrieval.
447 Records are denoted by a carriage return/linefeed sequence
448 during ascii type file transfer.
451 is on (the default), carriage returns are stripped from this
452 sequence to conform with the
454 single linefeed record
458 remote systems may contain single linefeeds;
459 when an ascii type transfer is made, these linefeeds may be
460 distinguished from a record delimiter only when
463 .It Ic ftp_debug Op Ar ftp_debug-value
464 Toggle debugging mode.
467 is specified it is used to set the debugging level.
468 When debugging is on,
470 prints each command sent to the remote machine, preceded
473 .It Ic delete Ar remote-file
476 on the remote machine.
477 .It Ic dir Op Ar remote-path Op Ar local-file
478 Print a listing of the contents of a
479 directory on the remote machine.
480 The listing includes any system-dependent information that the server
481 chooses to include; for example, most
484 output from the command
488 is left unspecified, the current working directory is used.
489 If interactive prompting is on,
491 will prompt the user to verify that the last argument is indeed the
492 target local file for receiving
495 If no local file is specified, or if
499 the output is sent to the terminal.
504 Toggle command line editing, and context sensitive command and file
506 This is automatically enabled if input is from a terminal, and
509 Toggle the use of the extended
513 commands on IPv4 connections; first try
519 This is enabled by default.
520 If an extended command fails then this option will be temporarily
521 disabled for the duration of the current connection, or until
528 Display what features the remote server supports (using the
531 .It Ic fget Ar localfile
532 Retrieve the files listed in
534 which has one line per filename.
535 .It Ic form Ar format
536 Set the file transfer
540 The default (and only supported)
543 .It Ic ftp Ar host Op Ar port
546 .It Ic gate Op Ar host Op Ar port
547 Toggle gate-ftp mode, which used to connect through the
548 TIS FWTK and Gauntlet ftp proxies.
549 This will not be permitted if the gate-ftp server hasn't been set
550 (either explicitly by the user, or from the
552 environment variable).
556 then gate-ftp mode will be enabled, and the gate-ftp server will be set to
560 is also given, that will be used as the port to connect to on the
562 .It Ic get Ar remote-file Op Ar local-file
565 and store it on the local machine.
567 file name is not specified, it is given the same
568 name it has on the remote machine, subject to
569 alteration by the current
575 The current settings for
581 are used while transferring the file.
583 Toggle filename expansion for
589 If globbing is turned off with
591 the file name arguments
592 are taken literally and not expanded.
602 each remote file name is expanded
603 separately on the remote machine and the lists are not merged.
604 Expansion of a directory name is likely to be
605 different from expansion of the name of an ordinary file:
606 the exact result depends on the foreign operating system and ftp server,
607 and can be previewed by doing
608 .Ql mls remote-files \-
614 are not meant to transfer
615 entire directory subtrees of files.
619 archive of the subtree (in binary mode).
620 .It Ic hash Op Ar size
623 printing for each data block transferred.
624 The size of a data block defaults to 1024 bytes.
625 This can be changed by specifying
632 .It Ic help Op Ar command
633 Print an informative message about the meaning of
635 If no argument is given,
637 prints a list of the known commands.
638 .It Ic idle Op Ar seconds
639 Set the inactivity timer on the remote server to
644 is omitted, the current inactivity timer is printed.
648 .It Ic lcd Op Ar directory
649 Change the working directory on the local machine.
653 is specified, the user's home directory is used.
657 .It Ic lpage Ar local-file
660 with the program specified by the
664 Print the working directory on the local machine.
665 .It Ic \&ls Op Ar remote-path Op Ar local-file
668 .It Ic macdef Ar macro-name
670 Subsequent lines are stored as the macro
672 a null line (consecutive newline characters in a file or carriage
673 returns from the terminal) terminates macro input mode.
674 There is a limit of 16 macros and 4096 total characters in all
676 Macro names can be a maximum of 8 characters.
677 Macros are only applicable to the current session they are
678 defined within (or if defined outside a session, to the session
679 invoked with the next
681 command), and remain defined until a
684 To invoke a macro, use the
688 The macro processor interprets
692 as special characters.
695 followed by a number (or numbers) is replaced by the
696 corresponding argument on the macro invocation command line.
701 signals the macro processor that the executing macro is to be
705 is replaced by the first argument on the macro invocation command
706 line, on the second pass it is replaced by the second argument,
710 followed by any character is replaced by that character.
713 to prevent special treatment of the
715 .It Ic mdelete Op Ar remote-files
718 on the remote machine.
719 .It Ic mdir Ar remote-files local-file
722 except multiple remote files may be specified.
723 If interactive prompting is on,
725 will prompt the user to verify that the last argument is indeed the
726 target local file for receiving
729 .It Ic mget Ar remote-files
732 on the remote machine
735 for each file name thus produced.
738 for details on the filename expansion.
739 Resulting file names will then be processed according to
745 Files are transferred into the local working directory,
746 which can be changed with
748 new local directories can be created with
749 .Ql "\&! mkdir directory" .
750 .It Ic mkdir Ar directory-name
751 Make a directory on the remote machine.
752 .It Ic mls Ar remote-files local-file
755 except multiple remote files may be specified,
759 If interactive prompting is on,
761 will prompt the user to verify that the last argument is indeed the
762 target local file for receiving
765 .It Ic mlsd Op Ar remote-path
766 Display the contents of
768 (which should default to the current directory if not given)
769 in a machine-parsable form, using
771 The format of display can be changed with
772 .Sq "remopts mlst ..." .
773 .It Ic mlst Op Ar remote-path
774 Display the details about
776 (which should default to the current directory if not given)
777 in a machine-parsable form, using
779 The format of display can be changed with
780 .Sq "remopts mlst ..." .
781 .It Ic mode Ar mode-name
782 Set the file transfer
786 The default (and only supported)
789 .It Ic modtime Ar remote-file
790 Show the last modification time of the file on the remote machine, in
796 .It Ic mput Ar local-files
797 Expand wild cards in the list of local files given as arguments
800 for each file in the resulting list.
803 for details of filename expansion.
804 Resulting file names will then be processed according to
809 .It Ic mreget Ar remote-files
816 .It Ic msend Ar local-files
819 .It Ic newer Ar remote-file Op Ar local-file
820 Get the file only if the modification time of the remote file is more
821 recent that the file on the current system.
823 exist on the current system, the remote file is considered
825 Otherwise, this command is identical to
827 .It Ic nlist Op Ar remote-path Op Ar local-file
830 .It Ic nmap Op Ar inpattern outpattern
831 Set or unset the filename mapping mechanism.
832 If no arguments are specified, the filename mapping mechanism is unset.
833 If arguments are specified, remote filenames are mapped during
837 commands issued without a specified remote target filename.
838 If arguments are specified, local filenames are mapped during
842 commands issued without a specified local target filename.
843 This command is useful when connecting to a
846 with different file naming conventions or practices.
847 The mapping follows the pattern set by
852 is a template for incoming filenames (which may have already been
853 processed according to the
858 Variable templating is accomplished by including the
868 to prevent this special treatment of the
871 All other characters are treated literally, and are used to determine the
877 $1.$2 and the remote file name "mydata.data", $1 would have the value
878 "mydata", and $2 would have the value "data".
881 determines the resulting mapped filename.
887 are replaced by any value resulting from the
892 is replaced by the original filename.
893 Additionally, the sequence
894 .Dq Op Ar seq1 , Ar seq2
899 is not a null string; otherwise it is replaced by
901 For example, the command
903 .Bd -literal -offset indent -compact
904 nmap $1.$2.$3 [$1,$2].[$2,file]
908 the output filename "myfile.data" for input filenames "myfile.data" and
909 "myfile.data.old", "myfile.file" for the input filename "myfile", and
910 "myfile.myfile" for the input filename ".myfile".
911 Spaces may be included in
914 .Dl nmap $1 sed "s/ *$//" \*[Gt] $1
917 character to prevent special treatment
925 .It Ic ntrans Op Ar inchars Op Ar outchars
926 Set or unset the filename character translation mechanism.
927 If no arguments are specified, the filename character
928 translation mechanism is unset.
929 If arguments are specified, characters in
930 remote filenames are translated during
934 commands issued without a specified remote target filename.
935 If arguments are specified, characters in
936 local filenames are translated during
940 commands issued without a specified local target filename.
941 This command is useful when connecting to a
944 with different file naming conventions or practices.
945 Characters in a filename matching a character in
947 are replaced with the corresponding character in
949 If the character's position in
951 is longer than the length of
953 the character is deleted from the file name.
954 .It Ic open Ar host Op Ar port
955 Establish a connection to the specified
959 An optional port number may be supplied,
962 will attempt to contact an
967 option is on (default),
969 will also attempt to automatically log the user in to
976 and display with the program specified by the
979 .It Ic passive Op Cm auto
980 Toggle passive mode (if no arguments are given).
987 If passive mode is turned on (default),
991 command for all data connections instead of a
996 command requests that the remote server open a port for the data connection
997 and return the address of that port.
998 The remote server listens on that port and the client connects to it.
999 When using the more traditional
1001 command, the client listens on a port and sends that address to the remote
1002 server, who connects back to it.
1003 Passive mode is useful when using
1005 through a gateway router or host that controls the directionality of
1009 servers are required to support the
1014 .It Ic pdir Op Ar remote-path
1017 .Op Ar remote-path ,
1018 and display the result with the program specified by the
1021 .It Ic pls Op Ar remote-path
1024 .Op Ar remote-path ,
1025 and display the result with the program specified by the
1028 .It Ic pmlsd Op Ar remote-path
1031 .Op Ar remote-path ,
1032 and display the result with the program specified by the
1036 Toggle preservation of modification times on retrieved files.
1038 Toggle display of transfer progress bar.
1039 The progress bar will be disabled for a transfer that has
1043 or a command that starts with
1046 .Sx FILE NAMING CONVENTIONS
1047 for more information.
1053 Toggle interactive prompting.
1054 Interactive prompting
1055 occurs during multiple file transfers to allow the
1056 user to selectively retrieve or store files.
1057 If prompting is turned off (default is on), any
1061 will transfer all files, and any
1063 will delete all files.
1065 When prompting is on, the following commands are available at a prompt:
1066 .Bl -tag -width 2n -offset indent
1070 to the current file, and automatically answer
1072 to any remaining files for the current command.
1076 and do not transfer the file.
1080 to the current file, and turn off prompt mode
1085 Terminate the current operation.
1089 and transfer the file.
1091 Display a help message.
1094 Any other response will answer
1096 to the current file.
1097 .It Ic proxy Ar ftp-command
1098 Execute an ftp command on a secondary control connection.
1099 This command allows simultaneous connection to two remote
1101 servers for transferring files between the two servers.
1104 command should be an
1106 to establish the secondary control connection.
1107 Enter the command "proxy ?" to see other
1109 commands executable on the secondary connection.
1110 The following commands behave differently when prefaced by
1113 will not define new macros during the auto-login process,
1115 will not erase existing macro definitions,
1119 transfer files from the host on the primary control connection
1120 to the host on the secondary control connection, and
1125 transfer files from the host on the secondary control connection
1126 to the host on the primary control connection.
1127 Third party file transfers depend upon support of the
1131 command by the server on the secondary control connection.
1132 .It Ic put Ar local-file Op Ar remote-file
1133 Store a local file on the remote machine.
1136 is left unspecified, the local file name is used
1137 after processing according to any
1142 in naming the remote file.
1143 File transfer uses the
1144 current settings for
1151 Print the name of the current working directory on the remote
1156 .It Ic quote Ar arg1 arg2 ...
1157 The arguments specified are sent, verbatim, to the remote
1161 .Ic rate Ar direction
1162 .Op Ar maximum Op Ar increment
1164 Throttle the maximum transfer rate to
1169 is 0, disable the throttle.
1173 .Bl -tag -width "all" -offset indent -compact
1183 can be modified on the fly by
1185 bytes (default: 1024) each time a given signal is received:
1187 .Bl -tag -width "SIGUSR1" -offset indent
1200 The result must be a positive number.
1205 is not supplied, the current throttle rates are displayed.
1209 is not yet implemented for ascii mode transfers.
1210 .It Ic rcvbuf Ar size
1211 Set the size of the socket receive buffer to
1213 .It Ic recv Ar remote-file Op Ar local-file
1216 .It Ic reget Ar remote-file Op Ar local-file
1227 a partially transferred copy of
1230 is continued from the apparent point of failure.
1232 is useful when transferring very large files over networks that
1233 are prone to dropping connections.
1234 .It Ic remopts Ar command Op Ar command-options
1235 Set options on the remote
1241 (whose absence is handled on a command-specific basis).
1244 commands known to support options include:
1250 .It Ic rename Op Ar from Op Ar to
1253 on the remote machine, to the file
1257 This command re-synchronizes command/reply sequencing with the remote
1260 Resynchronization may be necessary following a violation of the
1262 protocol by the remote server.
1263 .It Ic restart Ar marker
1264 Restart the immediately following
1273 systems, marker is usually a byte
1274 offset into the file.
1275 .It Ic rhelp Op Ar command-name
1276 Request help from the remote
1281 is specified it is supplied to the server as well.
1282 .It Ic rmdir Ar directory-name
1283 Delete a directory on the remote machine.
1284 .It Ic rstatus Op Ar remote-file
1285 With no arguments, show status of remote machine.
1288 is specified, show status of
1292 Toggle storing of files on the local system with unique filenames.
1293 If a file already exists with a name equal to the target
1294 local filename for a
1298 command, a ".1" is appended to the name.
1299 If the resulting name matches another existing file,
1300 a ".2" is appended to the original name.
1301 If this process continues up to ".99", an error
1302 message is printed, and the transfer does not take place.
1303 The generated unique filename will be reported.
1306 will not affect local files generated from a shell command
1308 The default value is off.
1309 .It Ic send Ar local-file Op Ar remote-file
1318 will attempt to use a
1320 command when establishing
1321 a connection for each data transfer.
1324 commands can prevent delays
1325 when performing multiple file transfers.
1330 will use the default data port.
1333 commands is disabled, no attempt will be made to use
1335 commands for each data transfer.
1339 implementations which do ignore
1341 commands but, incorrectly, indicate they've been accepted.
1342 .It Ic set Op Ar option Ar value
1351 are not given, display all of the options and their values.
1352 The currently supported options are:
1353 .Bl -tag -width "http_proxy" -offset indent
1376 .It Ic site Ar arg1 arg2 ...
1377 The arguments specified are sent, verbatim, to the remote
1382 .It Ic size Ar remote-file
1386 .It Ic sndbuf Ar size
1387 Set the size of the socket send buffer to
1390 Show the current status of
1392 .It Ic struct Ar struct-name
1393 Set the file transfer
1397 The default (and only supported)
1401 Toggle storing of files on remote machine under unique file names.
1409 successful completion.
1410 The remote server will report unique name.
1411 Default value is off.
1413 Show the type of operating system running on the remote machine.
1415 Set the file transfer type to that needed to
1423 Toggle packet tracing.
1424 .It Ic type Op Ar type-name
1425 Set the file transfer
1429 If no type is specified, the current type
1431 The default type is network
1433 .It Ic umask Op Ar newmask
1434 Set the default umask on the remote server to
1438 is omitted, the current umask is printed.
1439 .It Ic unset Ar option
1444 for more information.
1445 .It Ic usage Ar command
1446 Print the usage message for
1449 .Ic user Ar user-name
1450 .Op Ar password Op Ar account
1452 Identify yourself to the remote
1457 is not specified and the server requires it,
1459 will prompt the user for it (after disabling local echo).
1462 field is not specified, and the
1465 requires it, the user will be prompted for it.
1468 field is specified, an account command will
1469 be relayed to the remote server after the login sequence
1470 is completed if the remote server did not require it
1476 disabled, this process is done automatically on initial connection to the
1480 Toggle verbose mode.
1481 In verbose mode, all responses from
1484 server are displayed to the user.
1486 if verbose is on, when a file transfer completes, statistics
1487 regarding the efficiency of the transfer are reported.
1490 .It Ic xferbuf Ar size
1491 Set the size of the socket send and receive buffers to
1493 .It Ic \&? Op Ar command
1498 Command arguments which have embedded spaces may be quoted with
1503 Commands which toggle settings can take an explicit
1507 argument to force the setting appropriately.
1509 Commands which take a byte count as an argument
1515 support an optional suffix on the argument which changes the
1516 interpretation of the argument.
1517 Supported suffixes are:
1518 .Bl -tag -width 3n -offset indent -compact
1520 Causes no modification.
1523 Kilo; multiply the argument by 1024
1525 Mega; multiply the argument by 1048576
1527 Giga; multiply the argument by 1073741824
1540 signal whilst a transfer is in progress, the current transfer rate
1541 statistics will be written to the standard error output, in the
1542 same format as the standard completion message.
1543 .Sh AUTO-FETCHING FILES
1544 In addition to standard commands, this version of
1546 supports an auto-fetch feature.
1547 To enable auto-fetch, simply pass the list of hostnames/files
1548 on the command line.
1550 The following formats are valid syntax for an auto-fetch element:
1551 .Bl -tag -width "FOO "
1552 .\" [user@]host:[path][/]
1567 contains a glob character and globbing is enabled,
1570 then the equivalent of
1574 If the directory component of
1576 contains no globbing characters,
1577 it is stored locally with the name basename (see
1581 in the current directory.
1582 Otherwise, the full remote name is used as the local name,
1583 relative to the local root directory.
1584 .\" ftp://[user[:password]@]host[:port]/path[/][;type=X]
1589 .Op Li \&: Ar password
1591 .Ar host Oo Li \&: Ar port Oc
1599 URL, retrieved using the
1604 Otherwise, transfer the URL using
1606 via the proxy defined in
1607 .Ic "set ftp_proxy" .
1616 if supplied, otherwise prompt the user for one.
1622 is supplied, then the transfer type will take place as
1623 ascii or binary (respectively).
1624 The default transfer type is binary.
1626 In order to be compliant with
1633 auto-fetch URL as follows:
1638 immediately after the
1639 .Ar host Ns Oo Li \&: Ns Ar port Oc
1640 is interpreted as a separator before the
1642 and not as part of the
1649 .So Li / Sc Ns -separated
1650 list of name components.
1651 For all but the last such component,
1653 performs the equivalent of a
1656 For the last path component,
1658 performs the equivalent of a
1662 Empty name components,
1669 at the beginning of the
1671 will cause the equivalent of a
1673 command without a directory name.
1674 This is unlikely to be useful.
1681 within the path components are decoded, with
1683 representing a character code in hexadecimal.
1684 This decoding takes place after the
1686 has been split into components,
1687 but before each component is used in the equivalent of a
1692 Some often-used codes are
1702 The above interpretation has the following consequences:
1705 The path is interpreted relative to the
1706 default login directory of the specified user or of the
1711 directory is required, use a leading path of
1713 If a user's home directory is required (and the remote server supports
1714 the syntax), use a leading path of
1716 For example, to retrieve
1725 .Dq ftp://myname:mypass@localhost/%2fetc/motd
1731 commands can be controlled by careful choice of
1738 For example, the following URLs correspond to the
1739 equivalents of the indicated commands:
1740 .Bl -tag -width "ftp://host/%2Fdir1%2Fdir2%2Ffile"
1741 .It ftp://host/dir1/dir2/file
1745 .It ftp://host/%2Fdir1/dir2/file
1749 .It ftp://host/dir1%2Fdir2/file
1750 .Dq "cd dir1/dir2" ,
1752 .It ftp://host/%2Fdir1%2Fdir2/file
1753 .Dq "cd /dir1/dir2" ,
1755 .It ftp://host/dir1%2Fdir2%2Ffile
1756 .Dq "get dir1/dir2/file" .
1757 .It ftp://host/%2Fdir1%2Fdir2%2Ffile
1758 .Dq "get /dir1/dir2/file" .
1761 You must have appropriate access permission for each of the
1762 intermediate directories that is used in the equivalent of a
1766 .\" http://[user[:password]@]host[:port]/path
1771 .Op Li \&: Ar password
1773 .Ar host Oo Li \&: Ar port Oc
1779 URL, retrieved using the
1783 .Ic "set http_proxy"
1784 is defined, it is used as a URL to an
1789 authorization is required to retrieve
1795 is in the URL, use them for the first attempt to authenticate.
1799 .Li file:/// Ar path
1802 A local URL, copied from
1812 Display information regarding
1814 no file is retrieved for this auto-fetched element.
1815 Supported values include:
1816 .Bl -tag -width "about:version"
1820 .It Li about:version
1823 Useful to provide when reporting problems.
1827 Unless noted otherwise above, and
1829 is not given, the file is stored in the current directory as the
1835 redirect is received, the fetch is retried using the new target URL
1836 supplied by the server, with a corresponding new
1840 is recommended, to avoid writing to unexpected file names.
1842 If a classic format or an
1844 URL format has a trailing
1850 will connect to the site and
1852 to the directory given as the path, and leave the user in interactive
1853 mode ready for further input.
1854 This will not work if
1860 transfers use HTTP 1.1.
1865 transfers use HTTP 1.0.
1869 is given, all auto-fetches that don't go via the
1873 proxies will be restarted.
1876 this is implemented by using
1882 this is implemented by using the
1887 If WWW or proxy WWW authentication is required, you will be prompted
1888 to enter a username and password to authenticate with.
1890 When specifying IPv6 numeric addresses in a URL, you need to
1891 surround the address in square brackets.
1893 .Dq ftp://[::1]:21/ .
1894 This is because colons are used in IPv6 numeric address as well as
1895 being the separator for the port number.
1896 .Sh ABORTING A FILE TRANSFER
1897 To abort a file transfer, use the terminal interrupt key
1899 Sending transfers will be immediately halted.
1900 Receiving transfers will be halted by sending an
1904 command to the remote server, and discarding any further data received.
1905 The speed at which this is accomplished depends upon the remote
1906 server's support for
1909 If the remote server does not support the
1911 command, the prompt will not appear until the remote server has completed
1912 sending the requested file.
1914 If the terminal interrupt key sequence is used whilst
1916 is awaiting a reply from the remote server for the ABOR processing,
1917 then the connection will be closed.
1918 This is different from the traditional behaviour (which ignores the
1919 terminal interrupt during this phase), but is considered more useful.
1920 .Sh FILE NAMING CONVENTIONS
1921 Files specified as arguments to
1923 commands are processed according to the following rules.
1932 (for writing) is used.
1934 If the first character of the file name is
1937 remainder of the argument is interpreted as a shell command.
1939 then forks a shell, using
1941 with the argument supplied, and reads (writes) from the stdout
1943 If the shell command includes spaces, the argument
1944 must be quoted; e.g.
1945 .Dq Qq Li \&| ls\ \-lt .
1947 useful example of this mechanism is:
1948 .Dq Li dir \&"\&" \&|more .
1950 Failing the above checks, if
1952 is enabled, local file names are expanded according to the rules
1960 command expects a single local file (e.g.
1962 only the first filename generated by the "globbing" operation is used.
1968 commands with unspecified local file names, the local filename is
1969 the remote filename, which may be altered by a
1975 The resulting filename may then be altered if
1983 commands with unspecified remote file names, the remote filename is
1984 the local filename, which may be altered by a
1989 The resulting filename may then be altered by the remote server if
1993 .Sh FILE TRANSFER PARAMETERS
1996 specification specifies many parameters which may affect a file transfer.
2012 supports the ascii and image types of file transfer,
2013 plus local byte size 8 for
2018 supports only the default values for the remaining
2019 file transfer parameters:
2027 file contains login and initialization information
2028 used by the auto-login process.
2029 It resides in the user's home directory,
2030 unless overridden with the
2032 option, or specified in the
2034 environment variable.
2035 The following tokens are recognized; they may be separated by spaces,
2037 .Bl -tag -width password
2038 .It Ic machine Ar name
2039 Identify a remote machine
2041 The auto-login process searches the
2045 token that matches the remote machine specified on the
2047 command line or as an
2050 Once a match is made, the subsequent
2052 tokens are processed,
2053 stopping when the end of file is reached or another
2057 token is encountered.
2065 There can be only one
2067 token, and it must be after all
2070 This is normally used as:
2072 .Dl default login anonymous password user@site
2074 thereby giving the user an automatic anonymous
2077 machines not specified in
2079 This can be overridden
2082 flag to disable auto-login.
2083 .It Ic login Ar name
2084 Identify a user on the remote machine.
2085 If this token is present, the auto-login process will initiate
2086 a login using the specified
2088 .It Ic password Ar string
2090 If this token is present, the auto-login process will supply the
2091 specified string if the remote server requires a password as part
2092 of the login process.
2093 Note that if this token is present in the
2095 file for any user other
2099 will abort the auto-login process if the
2102 anyone besides the user.
2103 .It Ic account Ar string
2104 Supply an additional account password.
2105 If this token is present, the auto-login process will supply the
2106 specified string if the remote server requires an additional
2107 account password, or the auto-login process will initiate an
2109 command if it does not.
2110 .It Ic macdef Ar name
2112 This token functions like the
2116 A macro is defined with the specified name; its contents begin with the
2119 line and continue until a blank line (consecutive new-line
2120 characters) is encountered.
2121 Like the other tokens in the
2125 is applicable only to the
2127 definition preceding it.
2130 entry cannot be utilized by multiple
2132 definitions; rather, it must be defined following each
2134 it is intended to be used with.
2137 is defined, it is automatically executed as the last step in the
2140 .Bd -literal -offset indent
2146 followed by a blank line.
2148 .Sh COMMAND LINE EDITING
2150 supports interactive command line editing, via the
2153 It is enabled with the
2155 command, and is enabled by default if input is from a tty.
2156 Previous lines can be recalled and edited with the arrow keys,
2157 and other GNU Emacs-style editing keys may be used as well.
2161 library is configured with a
2165 for more information.
2167 An extra key binding is available to
2169 to provide context sensitive command and filename completion
2170 (including remote file completion).
2171 To use this, bind a key to the
2175 By default, this is bound to the TAB key.
2176 .Sh COMMAND LINE PROMPT
2179 displays a command line prompt of
2182 This can be changed with the
2186 A prompt can be displayed on the right side of the screen (after the
2187 command input) with the
2191 The following formatting sequences are replaced by the given
2193 .Bl -tag -width "%% " -offset indent
2195 The current remote working directory.
2196 .\" %c[[0]n], %.[[0]n]
2200 .Op Oo Li 0 Oc Ar n Ns ,
2205 The trailing component of the current remote working directory, or
2207 trailing components if a digit
2214 the number of skipped components precede the trailing component(s) in
2216 .\" ``/<number>trailing''
2219 .Li / Li \*[Lt] Va number Li \*[Gt]
2227 .Dq Li \&... Ns Va trailing
2231 The remote host name.
2233 The remote host name, up to the first
2236 The remote user name.
2243 uses the following environment variables.
2244 .Bl -tag -width "FTPSERVERPORT"
2246 Password to send in an anonymous
2252 Overrides the default operation mode.
2254 .Bl -tag -width "passive"
2260 automatic determination of passive or active (this is the default)
2269 Command-line prompt to use.
2273 .Sx COMMAND LINE PROMPT
2274 for more information.
2276 Command-line right side prompt to use.
2280 .Sx COMMAND LINE PROMPT
2281 for more information.
2283 Host to use as gate-ftp server when
2286 .It Ev FTPSERVERPORT
2287 Port to use when connecting to gate-ftp server when
2290 Default is port returned by a
2295 The value to send for the
2300 For default location of a
2302 file, if one exists.
2304 An alternate location of the
2308 Used by various commands to display files.
2311 if empty or not set.
2317 proxy to use when making
2320 (if not defined, use the standard
2326 for further notes about proxy use.
2330 proxy to use when making
2333 If proxy authentication is required and there is a username and
2334 password in this URL, they will automatically be used in the first
2335 attempt to authenticate to the proxy.
2339 URL characters are required in the username or password
2349 Note that the use of a username and password in
2353 may be incompatible with other programs that use it
2358 this is not used for interactive sessions, only for command-line
2361 A space or comma separated list of hosts (or domains) for which
2362 proxying is not to be used.
2363 Each entry may have an optional trailing ":port", which restricts
2364 the matching to connections to that port.
2366 .Sh EXTENDED PASSIVE MODE AND FIREWALLS
2367 Some firewall configurations do not allow
2369 to use extended passive mode.
2370 If you find that even a simple
2372 appears to hang after printing a message such as this:
2374 .Dl 229 Entering Extended Passive Mode (|||58551|)
2376 then you will need to disable extended passive mode with
2378 See the above section
2380 for an example of how to make this automatic.
2382 .Xr getservbyname 3 ,
2388 attempts to be compliant with:
2389 .Bl -tag -offset indent -width 8n
2391 .Em File Transfer Protocol
2393 .Em Requirements for Internet Hosts - Application and Support
2395 .Em How to Use Anonymous FTP
2397 .Em Feature negotiation mechanism for the File Transfer Protocol
2399 .Em FTP Extensions for IPv6 and NATs
2401 .Em Hypertext Transfer Protocol -- HTTP/1.1
2403 .Em Internet Message Format
2405 .Em Extensions to FTP
2407 .Em Uniform Resource Identifier (URI)
2415 Various features such as command line editing, context sensitive
2416 command and file completion, dynamic progress bar, automatic
2417 fetching of files and URLs, modification time preservation,
2418 transfer rate throttling, configurable command line prompt,
2419 and other enhancements over the standard
2427 .Aq lukem@NetBSD.org .
2429 IPv6 support was added by the WIDE/KAME project
2430 (but may not be present in all non-NetBSD versions of this program, depending
2431 if the operating system supports IPv6 in a similar manner to KAME).
2433 Correct execution of many commands depends upon proper behavior
2434 by the remote server.
2436 An error in the treatment of carriage returns
2439 ascii-mode transfer code
2441 This correction may result in incorrect transfers of binary files
2444 servers using the ascii type.
2445 Avoid this problem by using the binary image type.
2448 assumes that all IPv4 mapped addresses
2450 IPv6 addresses with a form like
2453 indicate IPv4 destinations which can be handled by
2456 However, in certain IPv6 network configurations, this assumption is not true.
2457 In such an environment, IPv4 mapped addresses must be passed to
2460 For example, if your site uses a SIIT translator for IPv6-to-IPv4 translation,
2462 is unable to support your configuration.