1 .\" $NetBSD: ftp.1,v 1.115 2007/04/17 05:52:03 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.
794 .It Ic mput Ar local-files
795 Expand wild cards in the list of local files given as arguments
798 for each file in the resulting list.
801 for details of filename expansion.
802 Resulting file names will then be processed according to
807 .It Ic mreget Ar remote-files
814 .It Ic msend Ar local-files
817 .It Ic newer Ar remote-file Op Ar local-file
818 Get the file only if the modification time of the remote file is more
819 recent that the file on the current system.
821 exist on the current system, the remote file is considered
823 Otherwise, this command is identical to
825 .It Ic nlist Op Ar remote-path Op Ar local-file
828 .It Ic nmap Op Ar inpattern outpattern
829 Set or unset the filename mapping mechanism.
830 If no arguments are specified, the filename mapping mechanism is unset.
831 If arguments are specified, remote filenames are mapped during
835 commands issued without a specified remote target filename.
836 If arguments are specified, local filenames are mapped during
840 commands issued without a specified local target filename.
841 This command is useful when connecting to a
844 with different file naming conventions or practices.
845 The mapping follows the pattern set by
850 is a template for incoming filenames (which may have already been
851 processed according to the
856 Variable templating is accomplished by including the
866 to prevent this special treatment of the
869 All other characters are treated literally, and are used to determine the
875 $1.$2 and the remote file name "mydata.data", $1 would have the value
876 "mydata", and $2 would have the value "data".
879 determines the resulting mapped filename.
885 are replaced by any value resulting from the
890 is replaced by the original filename.
891 Additionally, the sequence
892 .Dq Op Ar seq1 , Ar seq2
897 is not a null string; otherwise it is replaced by
899 For example, the command
901 .Bd -literal -offset indent -compact
902 nmap $1.$2.$3 [$1,$2].[$2,file]
906 the output filename "myfile.data" for input filenames "myfile.data" and
907 "myfile.data.old", "myfile.file" for the input filename "myfile", and
908 "myfile.myfile" for the input filename ".myfile".
909 Spaces may be included in
912 .Dl nmap $1 sed "s/ *$//" \*[Gt] $1
915 character to prevent special treatment
923 .It Ic ntrans Op Ar inchars Op Ar outchars
924 Set or unset the filename character translation mechanism.
925 If no arguments are specified, the filename character
926 translation mechanism is unset.
927 If arguments are specified, characters in
928 remote filenames are translated during
932 commands issued without a specified remote target filename.
933 If arguments are specified, characters in
934 local filenames are translated during
938 commands issued without a specified local target filename.
939 This command is useful when connecting to a
942 with different file naming conventions or practices.
943 Characters in a filename matching a character in
945 are replaced with the corresponding character in
947 If the character's position in
949 is longer than the length of
951 the character is deleted from the file name.
952 .It Ic open Ar host Op Ar port
953 Establish a connection to the specified
957 An optional port number may be supplied,
960 will attempt to contact an
965 option is on (default),
967 will also attempt to automatically log the user in to
974 and display with the program specified by the
977 .It Ic passive Op Cm auto
978 Toggle passive mode (if no arguments are given).
985 If passive mode is turned on (default),
989 command for all data connections instead of a
994 command requests that the remote server open a port for the data connection
995 and return the address of that port.
996 The remote server listens on that port and the client connects to it.
997 When using the more traditional
999 command, the client listens on a port and sends that address to the remote
1000 server, who connects back to it.
1001 Passive mode is useful when using
1003 through a gateway router or host that controls the directionality of
1007 servers are required to support the
1012 .It Ic pdir Op Ar remote-path
1015 .Op Ar remote-path ,
1016 and display the result with the program specified by the
1019 .It Ic pls Op Ar remote-path
1022 .Op Ar remote-path ,
1023 and display the result with the program specified by the
1026 .It Ic pmlsd Op Ar remote-path
1029 .Op Ar remote-path ,
1030 and display the result with the program specified by the
1034 Toggle preservation of modification times on retrieved files.
1036 Toggle display of transfer progress bar.
1037 The progress bar will be disabled for a transfer that has
1041 or a command that starts with
1044 .Sx FILE NAMING CONVENTIONS
1045 for more information.
1051 Toggle interactive prompting.
1052 Interactive prompting
1053 occurs during multiple file transfers to allow the
1054 user to selectively retrieve or store files.
1055 If prompting is turned off (default is on), any
1059 will transfer all files, and any
1061 will delete all files.
1063 When prompting is on, the following commands are available at a prompt:
1064 .Bl -tag -width 2n -offset indent
1068 to the current file, and automatically answer
1070 to any remaining files for the current command.
1074 and do not transfer the file.
1078 to the current file, and turn off prompt mode
1083 Terminate the current operation.
1087 and transfer the file.
1089 Display a help message.
1092 Any other response will answer
1094 to the current file.
1095 .It Ic proxy Ar ftp-command
1096 Execute an ftp command on a secondary control connection.
1097 This command allows simultaneous connection to two remote
1099 servers for transferring files between the two servers.
1102 command should be an
1104 to establish the secondary control connection.
1105 Enter the command "proxy ?" to see other
1107 commands executable on the secondary connection.
1108 The following commands behave differently when prefaced by
1111 will not define new macros during the auto-login process,
1113 will not erase existing macro definitions,
1117 transfer files from the host on the primary control connection
1118 to the host on the secondary control connection, and
1123 transfer files from the host on the secondary control connection
1124 to the host on the primary control connection.
1125 Third party file transfers depend upon support of the
1129 command by the server on the secondary control connection.
1130 .It Ic put Ar local-file Op Ar remote-file
1131 Store a local file on the remote machine.
1134 is left unspecified, the local file name is used
1135 after processing according to any
1140 in naming the remote file.
1141 File transfer uses the
1142 current settings for
1149 Print the name of the current working directory on the remote
1154 .It Ic quote Ar arg1 arg2 ...
1155 The arguments specified are sent, verbatim, to the remote
1159 .Ic rate Ar direction
1160 .Op Ar maximum Op Ar increment
1162 Throttle the maximum transfer rate to
1167 is 0, disable the throttle.
1171 .Bl -tag -width "all" -offset indent -compact
1181 can be modified on the fly by
1183 bytes (default: 1024) each time a given signal is received:
1185 .Bl -tag -width "SIGUSR1" -offset indent
1198 The result must be a positive number.
1203 is not supplied, the current throttle rates are displayed.
1207 is not yet implemented for ascii mode transfers.
1208 .It Ic rcvbuf Ar size
1209 Set the size of the socket receive buffer to
1211 .It Ic recv Ar remote-file Op Ar local-file
1214 .It Ic reget Ar remote-file Op Ar local-file
1225 a partially transferred copy of
1228 is continued from the apparent point of failure.
1230 is useful when transferring very large files over networks that
1231 are prone to dropping connections.
1232 .It Ic remopts Ar command Op Ar command-options
1233 Set options on the remote
1239 (whose absence is handled on a command-specific basis).
1242 commands known to support options include:
1248 .It Ic rename Op Ar from Op Ar to
1251 on the remote machine, to the file
1255 This command re-synchronizes command/reply sequencing with the remote
1258 Resynchronization may be necessary following a violation of the
1260 protocol by the remote server.
1261 .It Ic restart Ar marker
1262 Restart the immediately following
1271 systems, marker is usually a byte
1272 offset into the file.
1273 .It Ic rhelp Op Ar command-name
1274 Request help from the remote
1279 is specified it is supplied to the server as well.
1280 .It Ic rmdir Ar directory-name
1281 Delete a directory on the remote machine.
1282 .It Ic rstatus Op Ar remote-file
1283 With no arguments, show status of remote machine.
1286 is specified, show status of
1290 Toggle storing of files on the local system with unique filenames.
1291 If a file already exists with a name equal to the target
1292 local filename for a
1296 command, a ".1" is appended to the name.
1297 If the resulting name matches another existing file,
1298 a ".2" is appended to the original name.
1299 If this process continues up to ".99", an error
1300 message is printed, and the transfer does not take place.
1301 The generated unique filename will be reported.
1304 will not affect local files generated from a shell command
1306 The default value is off.
1307 .It Ic send Ar local-file Op Ar remote-file
1316 will attempt to use a
1318 command when establishing
1319 a connection for each data transfer.
1322 commands can prevent delays
1323 when performing multiple file transfers.
1328 will use the default data port.
1331 commands is disabled, no attempt will be made to use
1333 commands for each data transfer.
1337 implementations which do ignore
1339 commands but, incorrectly, indicate they've been accepted.
1340 .It Ic set Op Ar option Ar value
1349 are not given, display all of the options and their values.
1350 The currently supported options are:
1351 .Bl -tag -width "http_proxy" -offset indent
1374 .It Ic site Ar arg1 arg2 ...
1375 The arguments specified are sent, verbatim, to the remote
1380 .It Ic size Ar remote-file
1384 .It Ic sndbuf Ar size
1385 Set the size of the socket send buffer to
1388 Show the current status of
1390 .It Ic struct Ar struct-name
1391 Set the file transfer
1395 The default (and only supported)
1399 Toggle storing of files on remote machine under unique file names.
1407 successful completion.
1408 The remote server will report unique name.
1409 Default value is off.
1411 Show the type of operating system running on the remote machine.
1413 Set the file transfer type to that needed to
1421 Toggle packet tracing.
1422 .It Ic type Op Ar type-name
1423 Set the file transfer
1427 If no type is specified, the current type
1429 The default type is network
1431 .It Ic umask Op Ar newmask
1432 Set the default umask on the remote server to
1436 is omitted, the current umask is printed.
1437 .It Ic unset Ar option
1442 for more information.
1443 .It Ic usage Ar command
1444 Print the usage message for
1447 .Ic user Ar user-name
1448 .Op Ar password Op Ar account
1450 Identify yourself to the remote
1455 is not specified and the server requires it,
1457 will prompt the user for it (after disabling local echo).
1460 field is not specified, and the
1463 requires it, the user will be prompted for it.
1466 field is specified, an account command will
1467 be relayed to the remote server after the login sequence
1468 is completed if the remote server did not require it
1474 disabled, this process is done automatically on initial connection to the
1478 Toggle verbose mode.
1479 In verbose mode, all responses from
1482 server are displayed to the user.
1484 if verbose is on, when a file transfer completes, statistics
1485 regarding the efficiency of the transfer are reported.
1488 .It Ic xferbuf Ar size
1489 Set the size of the socket send and receive buffers to
1491 .It Ic \&? Op Ar command
1496 Command arguments which have embedded spaces may be quoted with
1501 Commands which toggle settings can take an explicit
1505 argument to force the setting appropriately.
1507 Commands which take a byte count as an argument
1513 support an optional suffix on the argument which changes the
1514 interpretation of the argument.
1515 Supported suffixes are:
1516 .Bl -tag -width 3n -offset indent -compact
1518 Causes no modification.
1521 Kilo; multiply the argument by 1024
1523 Mega; multiply the argument by 1048576
1525 Giga; multiply the argument by 1073741824
1538 signal whilst a transfer is in progress, the current transfer rate
1539 statistics will be written to the standard error output, in the
1540 same format as the standard completion message.
1541 .Sh AUTO-FETCHING FILES
1542 In addition to standard commands, this version of
1544 supports an auto-fetch feature.
1545 To enable auto-fetch, simply pass the list of hostnames/files
1546 on the command line.
1548 The following formats are valid syntax for an auto-fetch element:
1549 .Bl -tag -width "FOO "
1550 .\" [user@]host:[path][/]
1565 contains a glob character and globbing is enabled,
1568 then the equivalent of
1572 If the directory component of
1574 contains no globbing characters,
1575 it is stored locally with the name basename (see
1579 in the current directory.
1580 Otherwise, the full remote name is used as the local name,
1581 relative to the local root directory.
1582 .\" ftp://[user[:password]@]host[:port]/path[/][;type=X]
1587 .Op Li \&: Ar password
1589 .Ar host Oo Li \&: Ar port Oc
1597 URL, retrieved using the
1602 Otherwise, transfer the URL using
1604 via the proxy defined in
1605 .Ic "set ftp_proxy" .
1614 if supplied, otherwise prompt the user for one.
1620 is supplied, then the transfer type will take place as
1621 ascii or binary (respectively).
1622 The default transfer type is binary.
1624 In order to be compliant with
1631 auto-fetch URL as follows:
1636 immediately after the
1637 .Ar host Ns Oo Li \&: Ns Ar port Oc
1638 is interpreted as a separator before the
1640 and not as part of the
1647 .So Li / Sc Ns -separated
1648 list of name components.
1649 For all but the last such component,
1651 performs the equivalent of a
1654 For the last path component,
1656 performs the equivalent of a
1660 Empty name components,
1667 at the beginning of the
1669 will cause the equivalent of a
1671 command without a directory name.
1672 This is unlikely to be useful.
1679 within the path components are decoded, with
1681 representing a character code in hexadecimal.
1682 This decoding takes place after the
1684 has been split into components,
1685 but before each component is used in the equivalent of a
1690 Some often-used codes are
1700 The above interpretation has the following consequences:
1703 The path is interpreted relative to the
1704 default login directory of the specified user or of the
1709 directory is required, use a leading path of
1711 If a user's home directory is required (and the remote server supports
1712 the syntax), use a leading path of
1714 For example, to retrieve
1723 .Dq ftp://myname:mypass@localhost/%2fetc/motd
1729 commands can be controlled by careful choice of
1736 For example, the following URLs correspond to the
1737 equivalents of the indicated commands:
1738 .Bl -tag -width "ftp://host/%2Fdir1%2Fdir2%2Ffile"
1739 .It ftp://host/dir1/dir2/file
1743 .It ftp://host/%2Fdir1/dir2/file
1747 .It ftp://host/dir1%2Fdir2/file
1748 .Dq "cd dir1/dir2" ,
1750 .It ftp://host/%2Fdir1%2Fdir2/file
1751 .Dq "cd /dir1/dir2" ,
1753 .It ftp://host/dir1%2Fdir2%2Ffile
1754 .Dq "get dir1/dir2/file" .
1755 .It ftp://host/%2Fdir1%2Fdir2%2Ffile
1756 .Dq "get /dir1/dir2/file" .
1759 You must have appropriate access permission for each of the
1760 intermediate directories that is used in the equivalent of a
1764 .\" http://[user[:password]@]host[:port]/path
1769 .Op Li \&: Ar password
1771 .Ar host Oo Li \&: Ar port Oc
1777 URL, retrieved using the
1781 .Ic "set http_proxy"
1782 is defined, it is used as a URL to an
1787 authorization is required to retrieve
1793 is in the URL, use them for the first attempt to authenticate.
1797 .Li file:/// Ar path
1800 A local URL, copied from
1805 Unless noted otherwise above, and
1807 is not given, the file is stored in the current directory as the
1813 redirect is received, the fetch is retried using the new target URL
1814 supplied by the server, with a corresponding new
1818 is recommended, to avoid writing to unexpected file names.
1820 If a classic format or an
1822 URL format has a trailing
1828 will connect to the site and
1830 to the directory given as the path, and leave the user in interactive
1831 mode ready for further input.
1832 This will not work if
1838 transfers use HTTP 1.1.
1843 transfers use HTTP 1.0.
1847 is given, all auto-fetches that don't go via the
1851 proxies will be restarted.
1854 this is implemented by using
1860 this is implemented by using the
1865 If WWW or proxy WWW authentication is required, you will be prompted
1866 to enter a username and password to authenticate with.
1868 When specifying IPv6 numeric addresses in a URL, you need to
1869 surround the address in square brackets.
1871 .Dq ftp://[::1]:21/ .
1872 This is because colons are used in IPv6 numeric address as well as
1873 being the separator for the port number.
1874 .Sh ABORTING A FILE TRANSFER
1875 To abort a file transfer, use the terminal interrupt key
1877 Sending transfers will be immediately halted.
1878 Receiving transfers will be halted by sending an
1882 command to the remote server, and discarding any further data received.
1883 The speed at which this is accomplished depends upon the remote
1884 server's support for
1887 If the remote server does not support the
1889 command, the prompt will not appear until the remote server has completed
1890 sending the requested file.
1892 If the terminal interrupt key sequence is used whilst
1894 is awaiting a reply from the remote server for the ABOR processing,
1895 then the connection will be closed.
1896 This is different from the traditional behaviour (which ignores the
1897 terminal interrupt during this phase), but is considered more useful.
1898 .Sh FILE NAMING CONVENTIONS
1899 Files specified as arguments to
1901 commands are processed according to the following rules.
1910 (for writing) is used.
1912 If the first character of the file name is
1915 remainder of the argument is interpreted as a shell command.
1917 then forks a shell, using
1919 with the argument supplied, and reads (writes) from the stdout
1921 If the shell command includes spaces, the argument
1922 must be quoted; e.g.
1923 .Dq Qq Li \&| ls\ \-lt .
1925 useful example of this mechanism is:
1926 .Dq Li dir \&"\&" \&|more .
1928 Failing the above checks, if
1930 is enabled, local file names are expanded according to the rules
1938 command expects a single local file (e.g.
1940 only the first filename generated by the "globbing" operation is used.
1946 commands with unspecified local file names, the local filename is
1947 the remote filename, which may be altered by a
1953 The resulting filename may then be altered if
1961 commands with unspecified remote file names, the remote filename is
1962 the local filename, which may be altered by a
1967 The resulting filename may then be altered by the remote server if
1971 .Sh FILE TRANSFER PARAMETERS
1974 specification specifies many parameters which may affect a file transfer.
1990 supports the ascii and image types of file transfer,
1991 plus local byte size 8 for
1996 supports only the default values for the remaining
1997 file transfer parameters:
2005 file contains login and initialization information
2006 used by the auto-login process.
2007 It resides in the user's home directory,
2008 unless overridden with the
2010 option, or specified in the
2012 environment variable.
2013 The following tokens are recognized; they may be separated by spaces,
2015 .Bl -tag -width password
2016 .It Ic machine Ar name
2017 Identify a remote machine
2019 The auto-login process searches the
2023 token that matches the remote machine specified on the
2025 command line or as an
2028 Once a match is made, the subsequent
2030 tokens are processed,
2031 stopping when the end of file is reached or another
2035 token is encountered.
2043 There can be only one
2045 token, and it must be after all
2048 This is normally used as:
2050 .Dl default login anonymous password user@site
2052 thereby giving the user an automatic anonymous
2055 machines not specified in
2057 This can be overridden
2060 flag to disable auto-login.
2061 .It Ic login Ar name
2062 Identify a user on the remote machine.
2063 If this token is present, the auto-login process will initiate
2064 a login using the specified
2066 .It Ic password Ar string
2068 If this token is present, the auto-login process will supply the
2069 specified string if the remote server requires a password as part
2070 of the login process.
2071 Note that if this token is present in the
2073 file for any user other
2077 will abort the auto-login process if the
2080 anyone besides the user.
2081 .It Ic account Ar string
2082 Supply an additional account password.
2083 If this token is present, the auto-login process will supply the
2084 specified string if the remote server requires an additional
2085 account password, or the auto-login process will initiate an
2087 command if it does not.
2088 .It Ic macdef Ar name
2090 This token functions like the
2094 A macro is defined with the specified name; its contents begin with the
2097 line and continue until a blank line (consecutive new-line
2098 characters) is encountered.
2099 Like the other tokens in the
2103 is applicable only to the
2105 definition preceding it.
2108 entry cannot be utilized by multiple
2110 definitions; rather, it must be defined following each
2112 it is intended to be used with.
2115 is defined, it is automatically executed as the last step in the
2118 .Bd -literal -offset indent
2124 followed by a blank line.
2126 .Sh COMMAND LINE EDITING
2128 supports interactive command line editing, via the
2131 It is enabled with the
2133 command, and is enabled by default if input is from a tty.
2134 Previous lines can be recalled and edited with the arrow keys,
2135 and other GNU Emacs-style editing keys may be used as well.
2139 library is configured with a
2143 for more information.
2145 An extra key binding is available to
2147 to provide context sensitive command and filename completion
2148 (including remote file completion).
2149 To use this, bind a key to the
2153 By default, this is bound to the TAB key.
2154 .Sh COMMAND LINE PROMPT
2157 displays a command line prompt of
2160 This can be changed with the
2164 A prompt can be displayed on the right side of the screen (after the
2165 command input) with the
2169 The following formatting sequences are replaced by the given
2171 .Bl -tag -width "%% " -offset indent
2173 The current remote working directory.
2174 .\" %c[[0]n], %.[[0]n]
2178 .Op Oo Li 0 Oc Ar n Ns ,
2183 The trailing component of the current remote working directory, or
2185 trailing components if a digit
2192 the number of skipped components precede the trailing component(s) in
2194 .\" ``/<number>trailing''
2197 .Li / Li \*[Lt] Va number Li \*[Gt]
2205 .Dq Li \&... Ns Va trailing
2209 The remote host name.
2211 The remote host name, up to the first
2214 The remote user name.
2221 uses the following environment variables.
2222 .Bl -tag -width "FTPSERVERPORT"
2224 Password to send in an anonymous
2230 Overrides the default operation mode.
2232 .Bl -tag -width "passive"
2238 automatic determination of passive or active (this is the default)
2247 Command-line prompt to use.
2251 .Sx COMMAND LINE PROMPT
2252 for more information.
2254 Command-line right side prompt to use.
2258 .Sx COMMAND LINE PROMPT
2259 for more information.
2261 Host to use as gate-ftp server when
2264 .It Ev FTPSERVERPORT
2265 Port to use when connecting to gate-ftp server when
2268 Default is port returned by a
2273 The value to send for the
2278 For default location of a
2280 file, if one exists.
2282 An alternate location of the
2286 Used by various commands to display files.
2289 if empty or not set.
2295 proxy to use when making
2298 (if not defined, use the standard
2304 for further notes about proxy use.
2308 proxy to use when making
2311 If proxy authentication is required and there is a username and
2312 password in this URL, they will automatically be used in the first
2313 attempt to authenticate to the proxy.
2317 URL characters are required in the username or password
2327 Note that the use of a username and password in
2331 may be incompatible with other programs that use it
2336 this is not used for interactive sessions, only for command-line
2339 A space or comma separated list of hosts (or domains) for which
2340 proxying is not to be used.
2341 Each entry may have an optional trailing ":port", which restricts
2342 the matching to connections to that port.
2344 .Sh EXTENDED PASSIVE MODE AND FIREWALLS
2345 Some firewall configurations do not allow
2347 to use extended passive mode.
2348 If you find that even a simple
2350 appears to hang after printing a message such as this:
2352 .Dl 229 Entering Extended Passive Mode (|||58551|)
2354 then you will need to disable extended passive mode with
2356 See the above section
2358 for an example of how to make this automatic.
2360 .Xr getservbyname 3 ,
2366 attempts to be compliant with
2375 .Cm draft-ietf-ftpext-mlst-11 .
2382 Various features such as command line editing, context sensitive
2383 command and file completion, dynamic progress bar, automatic
2384 fetching of files and URLs, modification time preservation,
2385 transfer rate throttling, configurable command line prompt,
2386 and other enhancements over the standard
2394 .Aq lukem@NetBSD.org .
2396 IPv6 support was added by the WIDE/KAME project
2397 (but may not be present in all non-NetBSD versions of this program, depending
2398 if the operating system supports IPv6 in a similar manner to KAME).
2400 Correct execution of many commands depends upon proper behavior
2401 by the remote server.
2403 An error in the treatment of carriage returns
2406 ascii-mode transfer code
2408 This correction may result in incorrect transfers of binary files
2411 servers using the ascii type.
2412 Avoid this problem by using the binary image type.
2415 assumes that all IPv4 mapped addresses
2417 IPv6 addresses with a form like
2420 indicate IPv4 destinations which can be handled by
2423 However, in certain IPv6 network configurations, this assumption is not true.
2424 In such an environment, IPv4 mapped addresses must be passed to
2427 For example, if your site uses a SIIT translator for IPv6-to-IPv4 translation,
2429 is unable to support your configuration.