1 .\" $NetBSD: ftp.1,v 1.112 2005/07/06 11:21:26 wiz Exp $
3 .\" Copyright (c) 1996-2005 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
93 .\" [-T dir,max[,inc]]
105 .\" [[user@]host [port]]
107 .Oo Ar user Ns Li \&@ Oc Ns Ar host
112 .\" [[user@]host:[path][/]]
131 .\" [ftp://[user[:password]@]host[:port]/path[/]]
136 .Op Li \&: Ar password
138 .Ar host Oo Li \&: Ar port Oc
146 .\" [http://[user[:password]@]host[:port]/path]
151 .Op Li \&: Ar password
153 .Ar host Oo Li \&: Ar port Oc
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
170 The last five arguments will fetch a file using the
174 protocols, or by direct copying, into the current directory.
175 This is ideal for scripts.
177 .Sx AUTO-FETCHING FILES
178 below for more information.
180 Options may be specified at the command line, or to the
182 .Bl -tag -width "port "
186 to only use IPv4 addresses.
190 to only use IPv6 addresses.
192 Force active mode ftp.
195 will try to use passive mode ftp and fall back to active mode
196 if passive is not supported by the server.
199 to always use an active connection.
200 It is only useful for connecting to very old servers that do not
201 implement passive mode properly.
205 to bypass normal login procedure, and use an anonymous login instead.
209 Disables command line editing.
210 This is useful for Emacs ange-ftp mode.
212 Forces a cache reload for transfers that go through the
218 Disables file name globbing.
220 Turns off interactive prompting during
221 multiple file transfers.
227 upon initial connection for non auto-fetch transfers.
228 If auto-login is enabled,
232 (see below) file in the user's home directory for an entry describing
233 an account on the remote machine.
236 will prompt for the remote machine login name (default is the user
237 identity on the local machine), and, if necessary, prompt for a password
238 and an account with which to login.
239 To override the auto-login for auto-fetch transfers, specify the
240 username (and optionally, password) as appropriate.
248 for more information.
250 When auto-fetching files, save the contents in
253 is parsed according to the
254 .Sx FILE NAMING CONVENTIONS
260 or doesn't start with
262 then only the first file specified will be retrieved into
264 all other files will be retrieved into the basename of their
267 Enable passive mode operation for use behind connection filtering firewalls.
268 This option has been deprecated as
270 now tries to use passive mode by default, falling back to active mode
271 if the server does not support passive connections.
273 Sets the port number to
276 Retry the connection attempt if it failed, pausing for
280 Quit if the connection has stalled for
284 Restart all non-proxied auto-fetches.
286 Enables packet tracing.
295 Set the maximum transfer rate for
300 and if specified, the increment to
305 for more information.
306 .It Fl u Ar URL file Op \&.\&.\&.
307 Upload files on the command line to
311 is one of the ftp URL types as supported by auto-fetch
312 (with an optional target filename for single file uploads), and
314 is one or more local files to be uploaded.
320 This is the default if output is to a terminal (and in the case of
323 is the foreground process).
326 to show all responses from the remote server, as well
327 as report on data transfer statistics.
333 overriding the default of enabled when output is to a terminal.
336 The client host with which
338 is to communicate may be specified on the command line.
341 will immediately attempt to establish a connection to an
343 server on that host; otherwise,
345 will enter its command interpreter and await instructions
349 is awaiting commands from the user the prompt
351 is provided to the user.
352 The following commands are recognized
356 .It Ic \&! Op Ar command Op Ar args
357 Invoke an interactive shell on the local machine.
358 If there are arguments, the first is taken to be a command to execute
359 directly, with the rest of the arguments as its arguments.
360 .It Ic \&$ Ar macro-name Op Ar args
363 that was defined with the
366 Arguments are passed to the macro unglobbed.
367 .It Ic account Op Ar passwd
368 Supply a supplemental password required by a remote system for access
369 to resources once a login has been successfully completed.
370 If no argument is included, the user will be prompted for an account
371 password in a non-echoing input mode.
372 .It Ic append Ar local-file Op Ar remote-file
373 Append a local file to a file on the remote machine.
376 is left unspecified, the local file name is used in naming the
377 remote file after being altered by any
382 File transfer uses the current settings for
389 Set the file transfer
393 This is the default type.
395 Arrange that a bell be sounded after each file transfer
396 command is completed.
398 Set the file transfer
400 to support binary image transfer.
404 session with the remote server
407 An end of file will also terminate the session and exit.
409 Toggle remote computer file name case mapping during
417 is on (default is off), remote computer file names with all letters in
418 upper case are written in the local directory with the letters mapped
420 .It Ic \&cd Ar remote-directory
421 Change the working directory on the remote machine
423 .Ar remote-directory .
425 Change the remote machine working directory to the parent of the
426 current remote machine working directory.
427 .It Ic chmod Ar mode remote-file
428 Change the permission modes of the file
436 session with the remote server, and
437 return to the command interpreter.
438 Any defined macros are erased.
440 Toggle carriage return stripping during
441 ascii type file retrieval.
442 Records are denoted by a carriage return/linefeed sequence
443 during ascii type file transfer.
446 is on (the default), carriage returns are stripped from this
447 sequence to conform with the
449 single linefeed record
453 remote systems may contain single linefeeds;
454 when an ascii type transfer is made, these linefeeds may be
455 distinguished from a record delimiter only when
458 .It Ic debug Op Ar debug-value
459 Toggle debugging mode.
462 is specified it is used to set the debugging level.
463 When debugging is on,
465 prints each command sent to the remote machine, preceded
468 .It Ic delete Ar remote-file
471 on the remote machine.
472 .It Ic dir Op Ar remote-path Op Ar local-file
473 Print a listing of the contents of a
474 directory on the remote machine.
475 The listing includes any system-dependent information that the server
476 chooses to include; for example, most
479 output from the command
483 is left unspecified, the current working directory is used.
484 If interactive prompting is on,
486 will prompt the user to verify that the last argument is indeed the
487 target local file for receiving
490 If no local file is specified, or if
494 the output is sent to the terminal.
499 Toggle command line editing, and context sensitive command and file
501 This is automatically enabled if input is from a terminal, and
504 Toggle the use of the extended
508 commands on IPv4 connections; first try
514 This is enabled by default.
515 If an extended command fails then this option will be temporarily
516 disabled for the duration of the current connection, or until
523 Display what features the remote server supports (using the
526 .It Ic fget Ar localfile
527 Retrieve the files listed in
529 which has one line per filename.
530 .It Ic form Ar format
531 Set the file transfer
535 The default (and only supported)
538 .It Ic ftp Ar host Op Ar port
541 .It Ic gate Op Ar host Op Ar port
542 Toggle gate-ftp mode, which used to connect through the
543 TIS FWTK and Gauntlet ftp proxies.
544 This will not be permitted if the gate-ftp server hasn't been set
545 (either explicitly by the user, or from the
547 environment variable).
551 then gate-ftp mode will be enabled, and the gate-ftp server will be set to
555 is also given, that will be used as the port to connect to on the
557 .It Ic get Ar remote-file Op Ar local-file
560 and store it on the local machine.
562 file name is not specified, it is given the same
563 name it has on the remote machine, subject to
564 alteration by the current
570 The current settings for
576 are used while transferring the file.
578 Toggle filename expansion for
584 If globbing is turned off with
586 the file name arguments
587 are taken literally and not expanded.
597 each remote file name is expanded
598 separately on the remote machine and the lists are not merged.
599 Expansion of a directory name is likely to be
600 different from expansion of the name of an ordinary file:
601 the exact result depends on the foreign operating system and ftp server,
602 and can be previewed by doing
603 .Ql mls remote-files \-
609 are not meant to transfer
610 entire directory subtrees of files.
614 archive of the subtree (in binary mode).
615 .It Ic hash Op Ar size
618 printing for each data block transferred.
619 The size of a data block defaults to 1024 bytes.
620 This can be changed by specifying
627 .It Ic help Op Ar command
628 Print an informative message about the meaning of
630 If no argument is given,
632 prints a list of the known commands.
633 .It Ic idle Op Ar seconds
634 Set the inactivity timer on the remote server to
639 is omitted, the current inactivity timer is printed.
643 .It Ic lcd Op Ar directory
644 Change the working directory on the local machine.
648 is specified, the user's home directory is used.
652 .It Ic lpage Ar local-file
655 with the program specified by the
659 Print the working directory on the local machine.
660 .It Ic \&ls Op Ar remote-path Op Ar local-file
663 .It Ic macdef Ar macro-name
665 Subsequent lines are stored as the macro
667 a null line (consecutive newline characters in a file or carriage
668 returns from the terminal) terminates macro input mode.
669 There is a limit of 16 macros and 4096 total characters in all
671 Macro names can be a maximum of 8 characters.
672 Macros are only applicable to the current session they are
673 defined within (or if defined outside a session, to the session
674 invoked with the next
676 command), and remain defined until a
679 To invoke a macro, use the
683 The macro processor interprets
687 as special characters.
690 followed by a number (or numbers) is replaced by the
691 corresponding argument on the macro invocation command line.
696 signals the macro processor that the executing macro is to be
700 is replaced by the first argument on the macro invocation command
701 line, on the second pass it is replaced by the second argument,
705 followed by any character is replaced by that character.
708 to prevent special treatment of the
710 .It Ic mdelete Op Ar remote-files
713 on the remote machine.
714 .It Ic mdir Ar remote-files local-file
717 except multiple remote files may be specified.
718 If interactive prompting is on,
720 will prompt the user to verify that the last argument is indeed the
721 target local file for receiving
724 .It Ic mget Ar remote-files
727 on the remote machine
730 for each file name thus produced.
733 for details on the filename expansion.
734 Resulting file names will then be processed according to
740 Files are transferred into the local working directory,
741 which can be changed with
743 new local directories can be created with
744 .Ql "\&! mkdir directory" .
745 .It Ic mkdir Ar directory-name
746 Make a directory on the remote machine.
747 .It Ic mls Ar remote-files local-file
750 except multiple remote files may be specified,
754 If interactive prompting is on,
756 will prompt the user to verify that the last argument is indeed the
757 target local file for receiving
760 .It Ic mlsd Op Ar remote-path
761 Display the contents of
763 (which should default to the current directory if not given)
764 in a machine-parsable form, using
766 The format of display can be changed with
767 .Sq "remopts mlst ..." .
768 .It Ic mlst Op Ar remote-path
769 Display the details about
771 (which should default to the current directory if not given)
772 in a machine-parsable form, using
774 The format of display can be changed with
775 .Sq "remopts mlst ..." .
776 .It Ic mode Ar mode-name
777 Set the file transfer
781 The default (and only supported)
784 .It Ic modtime Ar remote-file
785 Show the last modification time of the file on the remote machine.
789 .It Ic mput Ar local-files
790 Expand wild cards in the list of local files given as arguments
793 for each file in the resulting list.
796 for details of filename expansion.
797 Resulting file names will then be processed according to
802 .It Ic mreget Ar remote-files
809 .It Ic msend Ar local-files
812 .It Ic newer Ar remote-file Op Ar local-file
813 Get the file only if the modification time of the remote file is more
814 recent that the file on the current system.
816 exist on the current system, the remote file is considered
818 Otherwise, this command is identical to
820 .It Ic nlist Op Ar remote-path Op Ar local-file
823 .It Ic nmap Op Ar inpattern outpattern
824 Set or unset the filename mapping mechanism.
825 If no arguments are specified, the filename mapping mechanism is unset.
826 If arguments are specified, remote filenames are mapped during
830 commands issued without a specified remote target filename.
831 If arguments are specified, local filenames are mapped during
835 commands issued without a specified local target filename.
836 This command is useful when connecting to a
839 with different file naming conventions or practices.
840 The mapping follows the pattern set by
845 is a template for incoming filenames (which may have already been
846 processed according to the
851 Variable templating is accomplished by including the
861 to prevent this special treatment of the
864 All other characters are treated literally, and are used to determine the
870 $1.$2 and the remote file name "mydata.data", $1 would have the value
871 "mydata", and $2 would have the value "data".
874 determines the resulting mapped filename.
880 are replaced by any value resulting from the
885 is replaced by the original filename.
886 Additionally, the sequence
887 .Dq Op Ar seq1 , Ar seq2
892 is not a null string; otherwise it is replaced by
894 For example, the command
896 .Bd -literal -offset indent -compact
897 nmap $1.$2.$3 [$1,$2].[$2,file]
901 the output filename "myfile.data" for input filenames "myfile.data" and
902 "myfile.data.old", "myfile.file" for the input filename "myfile", and
903 "myfile.myfile" for the input filename ".myfile".
904 Spaces may be included in
907 .Dl nmap $1 sed "s/ *$//" \*[Gt] $1
910 character to prevent special treatment
918 .It Ic ntrans Op Ar inchars Op Ar outchars
919 Set or unset the filename character translation mechanism.
920 If no arguments are specified, the filename character
921 translation mechanism is unset.
922 If arguments are specified, characters in
923 remote filenames are translated during
927 commands issued without a specified remote target filename.
928 If arguments are specified, characters in
929 local filenames are translated during
933 commands issued without a specified local target filename.
934 This command is useful when connecting to a
937 with different file naming conventions or practices.
938 Characters in a filename matching a character in
940 are replaced with the corresponding character in
942 If the character's position in
944 is longer than the length of
946 the character is deleted from the file name.
947 .It Ic open Ar host Op Ar port
948 Establish a connection to the specified
952 An optional port number may be supplied,
955 will attempt to contact an
960 option is on (default),
962 will also attempt to automatically log the user in to
969 and display with the program specified by the
972 .It Ic passive Op Cm auto
973 Toggle passive mode (if no arguments are given).
980 If passive mode is turned on (default),
984 command for all data connections instead of a
989 command requests that the remote server open a port for the data connection
990 and return the address of that port.
991 The remote server listens on that port and the client connects to it.
992 When using the more traditional
994 command, the client listens on a port and sends that address to the remote
995 server, who connects back to it.
996 Passive mode is useful when using
998 through a gateway router or host that controls the directionality of
1002 servers are required to support the
1007 .It Ic pdir Op Ar remote-path
1010 .Op Ar remote-path ,
1011 and display the result with the program specified by the
1014 .It Ic pls Op Ar remote-path
1017 .Op Ar remote-path ,
1018 and display the result with the program specified by the
1021 .It Ic pmlsd Op Ar remote-path
1024 .Op Ar remote-path ,
1025 and display the result with the program specified by the
1029 Toggle preservation of modification times on retrieved files.
1031 Toggle display of transfer progress bar.
1032 The progress bar will be disabled for a transfer that has
1036 or a command that starts with
1039 .Sx FILE NAMING CONVENTIONS
1040 for more information.
1046 Toggle interactive prompting.
1047 Interactive prompting
1048 occurs during multiple file transfers to allow the
1049 user to selectively retrieve or store files.
1050 If prompting is turned off (default is on), any
1054 will transfer all files, and any
1056 will delete all files.
1058 When prompting is on, the following commands are available at a prompt:
1059 .Bl -tag -width 2n -offset indent
1063 to the current file, and automatically answer
1065 to any remaining files for the current command.
1069 and do not transfer the file.
1073 to the current file, and turn off prompt mode
1078 Terminate the current operation.
1082 and transfer the file.
1084 Display a help message.
1087 Any other response will answer
1089 to the current file.
1090 .It Ic proxy Ar ftp-command
1091 Execute an ftp command on a secondary control connection.
1092 This command allows simultaneous connection to two remote
1094 servers for transferring files between the two servers.
1097 command should be an
1099 to establish the secondary control connection.
1100 Enter the command "proxy ?" to see other
1102 commands executable on the secondary connection.
1103 The following commands behave differently when prefaced by
1106 will not define new macros during the auto-login process,
1108 will not erase existing macro definitions,
1112 transfer files from the host on the primary control connection
1113 to the host on the secondary control connection, and
1118 transfer files from the host on the secondary control connection
1119 to the host on the primary control connection.
1120 Third party file transfers depend upon support of the
1124 command by the server on the secondary control connection.
1125 .It Ic put Ar local-file Op Ar remote-file
1126 Store a local file on the remote machine.
1129 is left unspecified, the local file name is used
1130 after processing according to any
1135 in naming the remote file.
1136 File transfer uses the
1137 current settings for
1144 Print the name of the current working directory on the remote
1149 .It Ic quote Ar arg1 arg2 ...
1150 The arguments specified are sent, verbatim, to the remote
1154 .Ic rate Ar direction
1155 .Op Ar maximum Op Ar increment
1157 Throttle the maximum transfer rate to
1162 is 0, disable the throttle.
1166 .Bl -tag -width "all" -offset indent -compact
1176 can be modified on the fly by
1178 bytes (default: 1024) each time a given signal is received:
1180 .Bl -tag -width "SIGUSR1" -offset indent
1193 The result must be a positive number.
1198 is not supplied, the current throttle rates are displayed.
1202 is not yet implemented for ascii mode transfers.
1203 .It Ic rcvbuf Ar size
1204 Set the size of the socket receive buffer to
1206 .It Ic recv Ar remote-file Op Ar local-file
1209 .It Ic reget Ar remote-file Op Ar local-file
1220 a partially transferred copy of
1223 is continued from the apparent point of failure.
1225 is useful when transferring very large files over networks that
1226 are prone to dropping connections.
1227 .It Ic remopts Ar command Op Ar command-options
1228 Set options on the remote
1234 (whose absence is handled on a command-specific basis).
1237 commands known to support options include:
1243 .It Ic rename Op Ar from Op Ar to
1246 on the remote machine, to the file
1250 This command re-synchronizes command/reply sequencing with the remote
1253 Resynchronization may be necessary following a violation of the
1255 protocol by the remote server.
1256 .It Ic restart Ar marker
1257 Restart the immediately following
1266 systems, marker is usually a byte
1267 offset into the file.
1268 .It Ic rhelp Op Ar command-name
1269 Request help from the remote
1274 is specified it is supplied to the server as well.
1275 .It Ic rmdir Ar directory-name
1276 Delete a directory on the remote machine.
1277 .It Ic rstatus Op Ar remote-file
1278 With no arguments, show status of remote machine.
1281 is specified, show status of
1285 Toggle storing of files on the local system with unique filenames.
1286 If a file already exists with a name equal to the target
1287 local filename for a
1291 command, a ".1" is appended to the name.
1292 If the resulting name matches another existing file,
1293 a ".2" is appended to the original name.
1294 If this process continues up to ".99", an error
1295 message is printed, and the transfer does not take place.
1296 The generated unique filename will be reported.
1299 will not affect local files generated from a shell command
1301 The default value is off.
1302 .It Ic send Ar local-file Op Ar remote-file
1311 will attempt to use a
1313 command when establishing
1314 a connection for each data transfer.
1317 commands can prevent delays
1318 when performing multiple file transfers.
1323 will use the default data port.
1326 commands is disabled, no attempt will be made to use
1328 commands for each data transfer.
1332 implementations which do ignore
1334 commands but, incorrectly, indicate they've been accepted.
1335 .It Ic set Op Ar option Ar value
1344 are not given, display all of the options and their values.
1345 The currently supported options are:
1346 .Bl -tag -width "http_proxy" -offset indent
1369 .It Ic site Ar arg1 arg2 ...
1370 The arguments specified are sent, verbatim, to the remote
1375 .It Ic size Ar remote-file
1379 .It Ic sndbuf Ar size
1380 Set the size of the socket send buffer to
1383 Show the current status of
1385 .It Ic struct Ar struct-name
1386 Set the file transfer
1390 The default (and only supported)
1394 Toggle storing of files on remote machine under unique file names.
1402 successful completion.
1403 The remote server will report unique name.
1404 Default value is off.
1406 Show the type of operating system running on the remote machine.
1408 Set the file transfer type to that needed to
1416 Toggle packet tracing.
1417 .It Ic type Op Ar type-name
1418 Set the file transfer
1422 If no type is specified, the current type
1424 The default type is network
1426 .It Ic umask Op Ar newmask
1427 Set the default umask on the remote server to
1431 is omitted, the current umask is printed.
1432 .It Ic unset Ar option
1437 for more information.
1438 .It Ic usage Ar command
1439 Print the usage message for
1442 .Ic user Ar user-name
1443 .Op Ar password Op Ar account
1445 Identify yourself to the remote
1450 is not specified and the server requires it,
1452 will prompt the user for it (after disabling local echo).
1455 field is not specified, and the
1458 requires it, the user will be prompted for it.
1461 field is specified, an account command will
1462 be relayed to the remote server after the login sequence
1463 is completed if the remote server did not require it
1469 disabled, this process is done automatically on initial connection to the
1473 Toggle verbose mode.
1474 In verbose mode, all responses from
1477 server are displayed to the user.
1479 if verbose is on, when a file transfer completes, statistics
1480 regarding the efficiency of the transfer are reported.
1483 .It Ic xferbuf Ar size
1484 Set the size of the socket send and receive buffers to
1486 .It Ic \&? Op Ar command
1491 Command arguments which have embedded spaces may be quoted with
1496 Commands which toggle settings can take an explicit
1500 argument to force the setting appropriately.
1502 Commands which take a byte count as an argument
1508 support an optional suffix on the argument which changes the
1509 interpretation of the argument.
1510 Supported suffixes are:
1511 .Bl -tag -width 3n -offset indent -compact
1513 Causes no modification.
1516 Kilo; multiply the argument by 1024
1518 Mega; multiply the argument by 1048576
1520 Giga; multiply the argument by 1073741824
1533 signal whilst a transfer is in progress, the current transfer rate
1534 statistics will be written to the standard error output, in the
1535 same format as the standard completion message.
1536 .Sh AUTO-FETCHING FILES
1537 In addition to standard commands, this version of
1539 supports an auto-fetch feature.
1540 To enable auto-fetch, simply pass the list of hostnames/files
1541 on the command line.
1543 The following formats are valid syntax for an auto-fetch element:
1544 .Bl -tag -width "FOO "
1545 .\" [user@]host:[path][/]
1560 contains a glob character and globbing is enabled,
1563 then the equivalent of
1567 If the directory component of
1569 contains no globbing characters,
1570 it is stored locally with the name basename (see
1574 in the current directory.
1575 Otherwise, the full remote name is used as the local name,
1576 relative to the local root directory.
1577 .\" ftp://[user[:password]@]host[:port]/path[/][;type=X]
1582 .Op Li \&: Ar password
1584 .Ar host Oo Li \&: Ar port Oc
1592 URL, retrieved using the
1597 Otherwise, transfer the URL using
1599 via the proxy defined in
1600 .Ic "set ftp_proxy" .
1609 if supplied, otherwise prompt the user for one.
1615 is supplied, then the transfer type will take place as
1616 ascii or binary (respectively).
1617 The default transfer type is binary.
1619 In order to be compliant with
1626 auto-fetch URL as follows:
1631 immediately after the
1632 .Ar host Ns Oo Li \&: Ns Ar port Oc
1633 is interpreted as a separator before the
1635 and not as part of the
1642 .So Li / Sc Ns -separated
1643 list of name components.
1644 For all but the last such component,
1646 performs the equivalent of a
1649 For the last path component,
1651 performs the equivalent of a
1655 Empty name components,
1662 at the beginning of the
1664 will cause the equivalent of a
1666 command without a directory name.
1667 This is unlikely to be useful.
1674 within the path components are decoded, with
1676 representing a character code in hexadecimal.
1677 This decoding takes place after the
1679 has been split into components,
1680 but before each component is used in the equivalent of a
1685 Some often-used codes are
1695 The above interpretation has the following consequences:
1698 The path is interpreted relative to the
1699 default login directory of the specified user or of the
1704 directory is required, use a leading path of
1706 If a user's home directory is required (and the remote server supports
1707 the syntax), use a leading path of
1709 For example, to retrieve
1718 .Dq ftp://myname:mypass@localhost/%2fetc/motd
1724 commands can be controlled by careful choice of
1731 For example, the following URLs correspond to the
1732 equivalents of the indicated commands:
1733 .Bl -tag -width "ftp://host/%2Fdir1%2Fdir2%2Ffile"
1734 .It ftp://host/dir1/dir2/file
1738 .It ftp://host/%2Fdir1/dir2/file
1742 .It ftp://host/dir1%2Fdir2/file
1743 .Dq "cd dir1/dir2" ,
1745 .It ftp://host/%2Fdir1%2Fdir2/file
1746 .Dq "cd /dir1/dir2" ,
1748 .It ftp://host/dir1%2Fdir2%2Ffile
1749 .Dq "get dir1/dir2/file" .
1750 .It ftp://host/%2Fdir1%2Fdir2%2Ffile
1751 .Dq "get /dir1/dir2/file" .
1754 You must have appropriate access permission for each of the
1755 intermediate directories that is used in the equivalent of a
1759 .\" http://[user[:password]@]host[:port]/path
1764 .Op Li \&: Ar password
1766 .Ar host Oo Li \&: Ar port Oc
1772 URL, retrieved using the
1776 .Ic "set http_proxy"
1777 is defined, it is used as a URL to an
1782 authorization is required to retrieve
1788 is in the URL, use them for the first attempt to authenticate.
1792 .Li file:/// Ar path
1795 A local URL, copied from
1800 Unless noted otherwise above, and
1802 is not given, the file is stored in the current directory as the
1808 redirect is received, the fetch is retried using the new target URL
1809 supplied by the server, with a corresponding new
1813 is recommended, to avoid writing to unexpected file names.
1815 If a classic format or an
1817 URL format has a trailing
1823 will connect to the site and
1825 to the directory given as the path, and leave the user in interactive
1826 mode ready for further input.
1827 This will not work if
1833 transfers use HTTP 1.1.
1838 transfers use HTTP 1.0.
1842 is given, all auto-fetches that don't go via the
1846 proxies will be restarted.
1849 this is implemented by using
1855 this is implemented by using the
1860 If WWW or proxy WWW authentication is required, you will be prompted
1861 to enter a username and password to authenticate with.
1863 When specifying IPv6 numeric addresses in a URL, you need to
1864 surround the address in square brackets.
1866 .Dq ftp://[::1]:21/ .
1867 This is because colons are used in IPv6 numeric address as well as
1868 being the separator for the port number.
1869 .Sh ABORTING A FILE TRANSFER
1870 To abort a file transfer, use the terminal interrupt key
1872 Sending transfers will be immediately halted.
1873 Receiving transfers will be halted by sending an
1877 command to the remote server, and discarding any further data received.
1878 The speed at which this is accomplished depends upon the remote
1879 server's support for
1882 If the remote server does not support the
1884 command, the prompt will not appear until the remote server has completed
1885 sending the requested file.
1887 If the terminal interrupt key sequence is used whilst
1889 is awaiting a reply from the remote server for the ABOR processing,
1890 then the connection will be closed.
1891 This is different from the traditional behaviour (which ignores the
1892 terminal interrupt during this phase), but is considered more useful.
1893 .Sh FILE NAMING CONVENTIONS
1894 Files specified as arguments to
1896 commands are processed according to the following rules.
1905 (for writing) is used.
1907 If the first character of the file name is
1910 remainder of the argument is interpreted as a shell command.
1912 then forks a shell, using
1914 with the argument supplied, and reads (writes) from the stdout
1916 If the shell command includes spaces, the argument
1917 must be quoted; e.g.
1918 .Dq Qq Li \&| ls\ \-lt .
1920 useful example of this mechanism is:
1921 .Dq Li dir \&"\&" \&|more .
1923 Failing the above checks, if
1925 is enabled, local file names are expanded according to the rules
1933 command expects a single local file (e.g.
1935 only the first filename generated by the "globbing" operation is used.
1941 commands with unspecified local file names, the local filename is
1942 the remote filename, which may be altered by a
1948 The resulting filename may then be altered if
1956 commands with unspecified remote file names, the remote filename is
1957 the local filename, which may be altered by a
1962 The resulting filename may then be altered by the remote server if
1966 .Sh FILE TRANSFER PARAMETERS
1969 specification specifies many parameters which may affect a file transfer.
1985 supports the ascii and image types of file transfer,
1986 plus local byte size 8 for
1991 supports only the default values for the remaining
1992 file transfer parameters:
2000 file contains login and initialization information
2001 used by the auto-login process.
2002 It resides in the user's home directory,
2003 unless overridden with the
2005 option, or specified in the
2007 environment variable.
2008 The following tokens are recognized; they may be separated by spaces,
2010 .Bl -tag -width password
2011 .It Ic machine Ar name
2012 Identify a remote machine
2014 The auto-login process searches the
2018 token that matches the remote machine specified on the
2020 command line or as an
2023 Once a match is made, the subsequent
2025 tokens are processed,
2026 stopping when the end of file is reached or another
2030 token is encountered.
2038 There can be only one
2040 token, and it must be after all
2043 This is normally used as:
2045 .Dl default login anonymous password user@site
2047 thereby giving the user an automatic anonymous
2050 machines not specified in
2052 This can be overridden
2055 flag to disable auto-login.
2056 .It Ic login Ar name
2057 Identify a user on the remote machine.
2058 If this token is present, the auto-login process will initiate
2059 a login using the specified
2061 .It Ic password Ar string
2063 If this token is present, the auto-login process will supply the
2064 specified string if the remote server requires a password as part
2065 of the login process.
2066 Note that if this token is present in the
2068 file for any user other
2072 will abort the auto-login process if the
2075 anyone besides the user.
2076 .It Ic account Ar string
2077 Supply an additional account password.
2078 If this token is present, the auto-login process will supply the
2079 specified string if the remote server requires an additional
2080 account password, or the auto-login process will initiate an
2082 command if it does not.
2083 .It Ic macdef Ar name
2085 This token functions like the
2089 A macro is defined with the specified name; its contents begin with the
2092 line and continue until a blank line (consecutive new-line
2093 characters) is encountered.
2094 Like the other tokens in the
2098 is applicable only to the
2100 definition preceding it.
2103 entry cannot be utilized by multiple
2105 definitions; rather, it must be defined following each
2107 it is intended to be used with.
2110 is defined, it is automatically executed as the last step in the
2113 .Bd -literal -offset indent
2119 followed by a blank line.
2121 .Sh COMMAND LINE EDITING
2123 supports interactive command line editing, via the
2126 It is enabled with the
2128 command, and is enabled by default if input is from a tty.
2129 Previous lines can be recalled and edited with the arrow keys,
2130 and other GNU Emacs-style editing keys may be used as well.
2134 library is configured with a
2138 for more information.
2140 An extra key binding is available to
2142 to provide context sensitive command and filename completion
2143 (including remote file completion).
2144 To use this, bind a key to the
2148 By default, this is bound to the TAB key.
2149 .Sh COMMAND LINE PROMPT
2152 displays a command line prompt of
2155 This can be changed with the
2159 A prompt can be displayed on the right side of the screen (after the
2160 command input) with the
2164 The following formatting sequences are replaced by the given
2166 .Bl -tag -width "%% " -offset indent
2168 The current remote working directory.
2169 .\" %c[[0]n], %.[[0]n]
2173 .Op Oo Li 0 Oc Ar n Ns ,
2178 The trailing component of the current remote working directory, or
2180 trailing components if a digit
2187 the number of skipped components precede the trailing component(s) in
2189 .\" ``/<number>trailing''
2192 .Li / Li \*[Lt] Va number Li \*[Gt]
2200 .Dq Li \&... Ns Va trailing
2204 The remote host name.
2206 The remote host name, up to the first
2209 The remote user name.
2216 uses the following environment variables.
2217 .Bl -tag -width "FTPSERVERPORT"
2219 Password to send in an anonymous
2225 Overrides the default operation mode.
2227 .Bl -tag -width "passive"
2233 automatic determination of passive or active (this is the default)
2242 Command-line prompt to use.
2246 .Sx COMMAND LINE PROMPT
2247 for more information.
2249 Command-line right side prompt to use.
2253 .Sx COMMAND LINE PROMPT
2254 for more information.
2256 Host to use as gate-ftp server when
2259 .It Ev FTPSERVERPORT
2260 Port to use when connecting to gate-ftp server when
2263 Default is port returned by a
2268 The value to send for the
2273 For default location of a
2275 file, if one exists.
2277 An alternate location of the
2281 Used by various commands to display files.
2284 if empty or not set.
2290 proxy to use when making
2293 (if not defined, use the standard
2299 for further notes about proxy use.
2303 proxy to use when making
2306 If proxy authentication is required and there is a username and
2307 password in this URL, they will automatically be used in the first
2308 attempt to authenticate to the proxy.
2312 URL characters are required in the username or password
2322 Note that the use of a username and password in
2326 may be incompatible with other programs that use it
2331 this is not used for interactive sessions, only for command-line
2334 A space or comma separated list of hosts (or domains) for which
2335 proxying is not to be used.
2336 Each entry may have an optional trailing ":port", which restricts
2337 the matching to connections to that port.
2339 .Sh EXTENDED PASSIVE MODE AND FIREWALLS
2340 Some firewall configurations do not allow
2342 to use extended passive mode.
2343 If you find that even a simple
2345 appears to hang after printing a message such as this:
2347 .Dl 229 Entering Extended Passive Mode (|||58551|)
2349 then you will need to disable extended passive mode with
2351 See the above section
2353 for an example of how to make this automatic.
2355 .Xr getservbyname 3 ,
2361 attempts to be compliant with
2370 .Cm draft-ietf-ftpext-mlst-11 .
2377 Various features such as command line editing, context sensitive
2378 command and file completion, dynamic progress bar, automatic
2379 fetching of files and URLs, modification time preservation,
2380 transfer rate throttling, configurable command line prompt,
2381 and other enhancements over the standard
2389 .Aq lukem@NetBSD.org .
2391 IPv6 support was added by the WIDE/KAME project
2392 (but may not be present in all non-NetBSD versions of this program, depending
2393 if the operating system supports IPv6 in a similar manner to KAME).
2395 Correct execution of many commands depends upon proper behavior
2396 by the remote server.
2398 An error in the treatment of carriage returns
2401 ascii-mode transfer code
2403 This correction may result in incorrect transfers of binary files
2406 servers using the ascii type.
2407 Avoid this problem by using the binary image type.
2410 assumes that all IPv4 mapped addresses
2412 IPv6 addresses with a form like
2415 indicate IPv4 destinations which can be handled by
2418 However, in certain IPv6 network configurations, this assumption is not true.
2419 In such an environment, IPv4 mapped addresses must be passed to
2422 For example, if your site uses a SIIT translator for IPv6-to-IPv4 translation,
2424 is unable to support your configuration.