1 .\" $NetBSD: ftp.1,v 1.109 2005/02/20 20:54:01 wiz Exp $
3 .\" Copyright (c) 1996-2004 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
616 Toggle hash-sign (``#'') printing for each data block
618 The size of a data block defaults to 1024 bytes.
619 This can be changed by specifying
626 .It Ic help Op Ar command
627 Print an informative message about the meaning of
629 If no argument is given,
631 prints a list of the known commands.
632 .It Ic idle Op Ar seconds
633 Set the inactivity timer on the remote server to
638 is omitted, the current inactivity timer is printed.
642 .It Ic lcd Op Ar directory
643 Change the working directory on the local machine.
647 is specified, the user's home directory is used.
651 .It Ic lpage Ar local-file
654 with the program specified by the
658 Print the working directory on the local machine.
659 .It Ic \&ls Op Ar remote-path Op Ar local-file
662 .It Ic macdef Ar macro-name
664 Subsequent lines are stored as the macro
666 a null line (consecutive newline characters
668 carriage returns from the terminal) terminates macro input mode.
669 There is a limit of 16 macros and 4096 total characters in all
671 Macros remain defined until a
674 The macro processor interprets `$' and `\e' as special characters.
675 A `$' followed by a number (or numbers) is replaced by the
676 corresponding argument on the macro invocation command line.
677 A `$' followed by an `i' signals that macro processor that the
678 executing macro is to be looped.
679 On the first pass `$i' is
680 replaced by the first argument on the macro invocation command line,
681 on the second pass it is replaced by the second argument, and so on.
682 A `\e' followed by any character is replaced by that character.
683 Use the `\e' to prevent special treatment of the `$'.
684 .It Ic mdelete Op Ar remote-files
687 on the remote machine.
688 .It Ic mdir Ar remote-files local-file
691 except multiple remote files may be specified.
692 If interactive prompting is on,
694 will prompt the user to verify that the last argument is indeed the
695 target local file for receiving
698 .It Ic mget Ar remote-files
701 on the remote machine
704 for each file name thus produced.
707 for details on the filename expansion.
708 Resulting file names will then be processed according to
714 Files are transferred into the local working directory,
715 which can be changed with
717 new local directories can be created with
718 .Ql "\&! mkdir directory" .
719 .It Ic mkdir Ar directory-name
720 Make a directory on the remote machine.
721 .It Ic mls Ar remote-files local-file
724 except multiple remote files may be specified,
728 If interactive prompting is on,
730 will prompt the user to verify that the last argument is indeed the
731 target local file for receiving
734 .It Ic mlsd Op Ar remote-path
735 Display the contents of
737 (which should default to the current directory if not given)
738 in a machine-parsable form, using
740 The format of display can be changed with
741 .Sq "remopts mlst ..." .
742 .It Ic mlst Op Ar remote-path
743 Display the details about
745 (which should default to the current directory if not given)
746 in a machine-parsable form, using
748 The format of display can be changed with
749 .Sq "remopts mlst ..." .
750 .It Ic mode Ar mode-name
751 Set the file transfer
755 The default (and only supported)
758 .It Ic modtime Ar remote-file
759 Show the last modification time of the file on the remote machine.
763 .It Ic mput Ar local-files
764 Expand wild cards in the list of local files given as arguments
767 for each file in the resulting list.
770 for details of filename expansion.
771 Resulting file names will then be processed according to
776 .It Ic mreget Ar remote-files
783 .It Ic msend Ar local-files
786 .It Ic newer Ar remote-file Op Ar local-file
787 Get the file only if the modification time of the remote file is more
788 recent that the file on the current system.
790 exist on the current system, the remote file is considered
792 Otherwise, this command is identical to
794 .It Ic nlist Op Ar remote-path Op Ar local-file
797 .It Ic nmap Op Ar inpattern outpattern
798 Set or unset the filename mapping mechanism.
799 If no arguments are specified, the filename mapping mechanism is unset.
800 If arguments are specified, remote filenames are mapped during
804 commands issued without a specified remote target filename.
805 If arguments are specified, local filenames are mapped during
809 commands issued without a specified local target filename.
810 This command is useful when connecting to a
813 with different file naming conventions or practices.
814 The mapping follows the pattern set by
819 is a template for incoming filenames (which may have already been
820 processed according to the
825 Variable templating is accomplished by including the
826 sequences `$1', `$2', ..., `$9' in
828 Use `\\' to prevent this special treatment of the `$' character.
829 All other characters are treated literally, and are used to determine the
835 $1.$2 and the remote file name "mydata.data", $1 would have the value
836 "mydata", and $2 would have the value "data".
839 determines the resulting mapped filename.
840 The sequences `$1', `$2', ...., `$9' are replaced by any value resulting
844 The sequence `$0' is replace by the original filename.
845 Additionally, the sequence
846 .Ql Op Ar seq1 , Ar seq2
851 is not a null string; otherwise it is replaced by
853 For example, the command
855 .Bd -literal -offset indent -compact
856 nmap $1.$2.$3 [$1,$2].[$2,file]
860 the output filename "myfile.data" for input filenames "myfile.data" and
861 "myfile.data.old", "myfile.file" for the input filename "myfile", and
862 "myfile.myfile" for the input filename ".myfile".
863 Spaces may be included in
865 as in the example: `nmap $1 sed "s/ *$//" \*[Gt] $1' .
866 Use the `\e' character to prevent special treatment
867 of the `$','[',']', and `,' characters.
868 .It Ic ntrans Op Ar inchars Op Ar outchars
869 Set or unset the filename character translation mechanism.
870 If no arguments are specified, the filename character
871 translation mechanism is unset.
872 If arguments are specified, characters in
873 remote filenames are translated during
877 commands issued without a specified remote target filename.
878 If arguments are specified, characters in
879 local filenames are translated during
883 commands issued without a specified local target filename.
884 This command is useful when connecting to a
887 with different file naming conventions or practices.
888 Characters in a filename matching a character in
890 are replaced with the corresponding character in
892 If the character's position in
894 is longer than the length of
896 the character is deleted from the file name.
897 .It Ic open Ar host Op Ar port
898 Establish a connection to the specified
902 An optional port number may be supplied,
905 will attempt to contact an
910 option is on (default),
912 will also attempt to automatically log the user in to
919 and display with the program specified by the
922 .It Ic passive Op Cm auto
923 Toggle passive mode (if no arguments are given).
930 If passive mode is turned on (default),
934 command for all data connections instead of a
939 command requests that the remote server open a port for the data connection
940 and return the address of that port.
941 The remote server listens on that port and the client connects to it.
942 When using the more traditional
944 command, the client listens on a port and sends that address to the remote
945 server, who connects back to it.
946 Passive mode is useful when using
948 through a gateway router or host that controls the directionality of
952 servers are required to support the
957 .It Ic pdir Op Ar remote-path
961 and display the result with the program specified by the
964 .It Ic pls Op Ar remote-path
968 and display the result with the program specified by the
971 .It Ic pmlsd Op Ar remote-path
975 and display the result with the program specified by the
979 Toggle preservation of modification times on retrieved files.
981 Toggle display of transfer progress bar.
982 The progress bar will be disabled for a transfer that has
986 or a command that starts with
989 .Sx FILE NAMING CONVENTIONS
990 for more information.
996 Toggle interactive prompting.
997 Interactive prompting
998 occurs during multiple file transfers to allow the
999 user to selectively retrieve or store files.
1000 If prompting is turned off (default is on), any
1004 will transfer all files, and any
1006 will delete all files.
1008 When prompting is on, the following commands are available at a prompt:
1009 .Bl -tag -width 2n -offset indent
1013 to the current file, and automatically answer
1015 to any remaining files for the current command.
1019 and do not transfer the file.
1023 to the current file, and turn off prompt mode
1028 Terminate the current operation.
1032 and transfer the file.
1034 Display a help message.
1037 Any other response will answer
1039 to the current file.
1040 .It Ic proxy Ar ftp-command
1041 Execute an ftp command on a secondary control connection.
1042 This command allows simultaneous connection to two remote
1044 servers for transferring files between the two servers.
1047 command should be an
1049 to establish the secondary control connection.
1050 Enter the command "proxy ?" to see other
1052 commands executable on the secondary connection.
1053 The following commands behave differently when prefaced by
1056 will not define new macros during the auto-login process,
1058 will not erase existing macro definitions,
1062 transfer files from the host on the primary control connection
1063 to the host on the secondary control connection, and
1068 transfer files from the host on the secondary control connection
1069 to the host on the primary control connection.
1070 Third party file transfers depend upon support of the
1074 command by the server on the secondary control connection.
1075 .It Ic put Ar local-file Op Ar remote-file
1076 Store a local file on the remote machine.
1079 is left unspecified, the local file name is used
1080 after processing according to any
1085 in naming the remote file.
1086 File transfer uses the
1087 current settings for
1094 Print the name of the current working directory on the remote
1099 .It Ic quote Ar arg1 arg2 ...
1100 The arguments specified are sent, verbatim, to the remote
1104 .Ic rate Ar direction
1105 .Op Ar maximum Op Ar increment
1107 Throttle the maximum transfer rate to
1112 is 0, disable the throttle.
1116 .Bl -tag -width "all" -offset indent -compact
1126 can be modified on the fly by
1128 bytes (default: 1024) each time a given signal is received:
1130 .Bl -tag -width "SIGUSR1" -offset indent
1143 The result must be a positive number.
1148 is not supplied, the current throttle rates are displayed.
1152 is not yet implemented for ascii mode transfers.
1153 .It Ic rcvbuf Ar size
1154 Set the size of the socket receive buffer to
1156 .It Ic recv Ar remote-file Op Ar local-file
1159 .It Ic reget Ar remote-file Op Ar local-file
1170 a partially transferred copy of
1173 is continued from the apparent point of failure.
1175 is useful when transferring very large files over networks that
1176 are prone to dropping connections.
1177 .It Ic remopts Ar command Op Ar command-options
1178 Set options on the remote
1184 (whose absence is handled on a command-specific basis).
1187 commands known to support options include:
1193 .It Ic rename Op Ar from Op Ar to
1196 on the remote machine, to the file
1200 This command re-synchronizes command/reply sequencing with the remote
1203 Resynchronization may be necessary following a violation of the
1205 protocol by the remote server.
1206 .It Ic restart Ar marker
1207 Restart the immediately following
1216 systems, marker is usually a byte
1217 offset into the file.
1218 .It Ic rhelp Op Ar command-name
1219 Request help from the remote
1224 is specified it is supplied to the server as well.
1225 .It Ic rmdir Ar directory-name
1226 Delete a directory on the remote machine.
1227 .It Ic rstatus Op Ar remote-file
1228 With no arguments, show status of remote machine.
1231 is specified, show status of
1235 Toggle storing of files on the local system with unique filenames.
1236 If a file already exists with a name equal to the target
1237 local filename for a
1241 command, a ".1" is appended to the name.
1242 If the resulting name matches another existing file,
1243 a ".2" is appended to the original name.
1244 If this process continues up to ".99", an error
1245 message is printed, and the transfer does not take place.
1246 The generated unique filename will be reported.
1249 will not affect local files generated from a shell command
1251 The default value is off.
1252 .It Ic send Ar local-file Op Ar remote-file
1261 will attempt to use a
1263 command when establishing
1264 a connection for each data transfer.
1267 commands can prevent delays
1268 when performing multiple file transfers.
1273 will use the default data port.
1276 commands is disabled, no attempt will be made to use
1278 commands for each data transfer.
1282 implementations which do ignore
1284 commands but, incorrectly, indicate they've been accepted.
1285 .It Ic set Op Ar option Ar value
1294 are not given, display all of the options and their values.
1295 The currently supported options are:
1296 .Bl -tag -width "http_proxy" -offset indent
1319 .It Ic site Ar arg1 arg2 ...
1320 The arguments specified are sent, verbatim, to the remote
1325 .It Ic size Ar remote-file
1329 .It Ic sndbuf Ar size
1330 Set the size of the socket send buffer to
1333 Show the current status of
1335 .It Ic struct Ar struct-name
1336 Set the file transfer
1340 The default (and only supported)
1344 Toggle storing of files on remote machine under unique file names.
1352 successful completion.
1353 The remote server will report unique name.
1354 Default value is off.
1356 Show the type of operating system running on the remote machine.
1358 Set the file transfer type to that needed to
1366 Toggle packet tracing.
1367 .It Ic type Op Ar type-name
1368 Set the file transfer
1372 If no type is specified, the current type
1374 The default type is network
1376 .It Ic umask Op Ar newmask
1377 Set the default umask on the remote server to
1381 is omitted, the current umask is printed.
1382 .It Ic unset Ar option
1387 for more information.
1388 .It Ic usage Ar command
1389 Print the usage message for
1392 .Ic user Ar user-name
1393 .Op Ar password Op Ar account
1395 Identify yourself to the remote
1400 is not specified and the server requires it,
1402 will prompt the user for it (after disabling local echo).
1405 field is not specified, and the
1408 requires it, the user will be prompted for it.
1411 field is specified, an account command will
1412 be relayed to the remote server after the login sequence
1413 is completed if the remote server did not require it
1419 disabled, this process is done automatically on initial connection to the
1423 Toggle verbose mode.
1424 In verbose mode, all responses from
1427 server are displayed to the user.
1429 if verbose is on, when a file transfer completes, statistics
1430 regarding the efficiency of the transfer are reported.
1433 .It Ic xferbuf Ar size
1434 Set the size of the socket send and receive buffers to
1436 .It Ic \&? Op Ar command
1441 Command arguments which have embedded spaces may be quoted with
1444 Commands which toggle settings can take an explicit
1448 argument to force the setting appropriately.
1450 Commands which take a byte count as an argument
1456 support an optional suffix on the argument which changes the
1457 interpretation of the argument.
1458 Supported suffixes are:
1459 .Bl -tag -width 3n -offset indent -compact
1461 Causes no modification.
1464 Kilo; multiply the argument by 1024
1466 Mega; multiply the argument by 1048576
1468 Giga; multiply the argument by 1073741824
1481 signal whilst a transfer is in progress, the current transfer rate
1482 statistics will be written to the standard error output, in the
1483 same format as the standard completion message.
1484 .Sh AUTO-FETCHING FILES
1485 In addition to standard commands, this version of
1487 supports an auto-fetch feature.
1488 To enable auto-fetch, simply pass the list of hostnames/files
1489 on the command line.
1491 The following formats are valid syntax for an auto-fetch element:
1492 .Bl -tag -width "FOO "
1493 .\" [user@]host:[path][/]
1508 contains a glob character and globbing is enabled,
1511 then the equivalent of
1515 If the directory component of
1517 contains no globbing characters,
1518 it is stored locally with the name basename (see
1522 in the current directory.
1523 Otherwise, the full remote name is used as the local name,
1524 relative to the local root directory.
1525 .\" ftp://[user[:password]@]host[:port]/path[/][;type=X]
1530 .Op Li \&: Ar password
1532 .Ar host Oo Li \&: Ar port Oc
1540 URL, retrieved using the
1545 Otherwise, transfer the URL using
1547 via the proxy defined in
1548 .Ic "set ftp_proxy" .
1557 if supplied, otherwise prompt the user for one.
1563 is supplied, then the transfer type will take place as
1564 ascii or binary (respectively).
1565 The default transfer type is binary.
1567 In order to be compliant with
1574 auto-fetch URL as follows:
1579 immediately after the
1580 .Ar host Ns Oo Li \&: Ns Ar port Oc
1581 is interpreted as a separator before the
1583 and not as part of the
1590 .So Li / Sc Ns -separated
1591 list of name components.
1592 For all but the last such component,
1594 performs the equivalent of a
1597 For the last path component,
1599 performs the equivalent of a
1603 Empty name components,
1610 at the beginning of the
1612 will cause the equivalent of a
1614 command without a directory name.
1615 This is unlikely to be useful.
1622 within the path components are decoded, with
1624 representing a character code in hexadecimal.
1625 This decoding takes place after the
1627 has been split into components,
1628 but before each component is used in the equivalent of a
1633 Some often-used codes are
1643 The above interpretation has the following consequences:
1646 The path is interpreted relative to the
1647 default login directory of the specified user or of the
1652 directory is required, use a leading path of
1654 If a user's home directory is required (and the remote server supports
1655 the syntax), use a leading path of
1657 For example, to retrieve
1666 .Dq ftp://myname:mypass@localhost/%2fetc/motd
1672 commands can be controlled by careful choice of
1679 For example, the following URLs correspond to the
1680 equivalents of the indicated commands:
1681 .Bl -tag -width "ftp://host/%2Fdir1%2Fdir2%2Ffile"
1682 .It ftp://host/dir1/dir2/file
1686 .It ftp://host/%2Fdir1/dir2/file
1690 .It ftp://host/dir1%2Fdir2/file
1691 .Dq "cd dir1/dir2" ,
1693 .It ftp://host/%2Fdir1%2Fdir2/file
1694 .Dq "cd /dir1/dir2" ,
1696 .It ftp://host/dir1%2Fdir2%2Ffile
1697 .Dq "get dir1/dir2/file" .
1698 .It ftp://host/%2Fdir1%2Fdir2%2Ffile
1699 .Dq "get /dir1/dir2/file" .
1702 You must have appropriate access permission for each of the
1703 intermediate directories that is used in the equivalent of a
1707 .\" http://[user[:password]@]host[:port]/path
1712 .Op Li \&: Ar password
1714 .Ar host Oo Li \&: Ar port Oc
1720 URL, retrieved using the
1724 .Ic "set http_proxy"
1725 is defined, it is used as a URL to an
1730 authorization is required to retrieve
1736 is in the URL, use them for the first attempt to authenticate.
1740 .Li file:/// Ar path
1743 A local URL, copied from
1748 Unless noted otherwise above, and
1750 is not given, the file is stored in the current directory as the
1756 redirect is received, the fetch is retried using the new target URL
1757 supplied by the server, with a corresponding new
1761 is recommended, to avoid writing to unexpected file names.
1763 If a classic format or an
1765 URL format has a trailing
1771 will connect to the site and
1773 to the directory given as the path, and leave the user in interactive
1774 mode ready for further input.
1775 This will not work if
1781 transfers use HTTP 1.1.
1786 transfers use HTTP 1.0.
1790 is given, all auto-fetches that don't go via the
1794 proxies will be restarted.
1797 this is implemented by using
1803 this is implemented by using the
1808 If WWW or proxy WWW authentication is required, you will be prompted
1809 to enter a username and password to authenticate with.
1811 When specifying IPv6 numeric addresses in a URL, you need to
1812 surround the address in square brackets.
1814 .Dq ftp://[::1]:21/ .
1815 This is because colons are used in IPv6 numeric address as well as
1816 being the separator for the port number.
1817 .Sh ABORTING A FILE TRANSFER
1818 To abort a file transfer, use the terminal interrupt key
1820 Sending transfers will be immediately halted.
1821 Receiving transfers will be halted by sending an
1825 command to the remote server, and discarding any further data received.
1826 The speed at which this is accomplished depends upon the remote
1827 server's support for
1830 If the remote server does not support the
1832 command, the prompt will not appear until the remote server has completed
1833 sending the requested file.
1835 If the terminal interrupt key sequence is used whilst
1837 is awaiting a reply from the remote server for the ABOR processing,
1838 then the connection will be closed.
1839 This is different from the traditional behaviour (which ignores the
1840 terminal interrupt during this phase), but is considered more useful.
1841 .Sh FILE NAMING CONVENTIONS
1842 Files specified as arguments to
1844 commands are processed according to the following rules.
1853 (for writing) is used.
1855 If the first character of the file name is
1858 remainder of the argument is interpreted as a shell command.
1860 then forks a shell, using
1862 with the argument supplied, and reads (writes) from the stdout
1864 If the shell command includes spaces, the argument
1865 must be quoted; e.g.
1866 .Dq Qq Li \&| ls\ \-lt .
1868 useful example of this mechanism is:
1869 .Dq Li dir \&"\&" \&|more .
1871 Failing the above checks, if ``globbing'' is enabled,
1872 local file names are expanded
1873 according to the rules used in the
1880 command expects a single local file (e.g.
1882 only the first filename generated by the "globbing" operation is used.
1888 commands with unspecified local file names, the local filename is
1889 the remote filename, which may be altered by a
1895 The resulting filename may then be altered if
1903 commands with unspecified remote file names, the remote filename is
1904 the local filename, which may be altered by a
1909 The resulting filename may then be altered by the remote server if
1913 .Sh FILE TRANSFER PARAMETERS
1916 specification specifies many parameters which may affect a file transfer.
1932 supports the ascii and image types of file transfer,
1933 plus local byte size 8 for
1938 supports only the default values for the remaining
1939 file transfer parameters:
1947 file contains login and initialization information
1948 used by the auto-login process.
1949 It resides in the user's home directory,
1950 unless overridden with the
1952 option, or specified in the
1954 environment variable.
1955 The following tokens are recognized; they may be separated by spaces,
1957 .Bl -tag -width password
1958 .It Ic machine Ar name
1959 Identify a remote machine
1961 The auto-login process searches the
1965 token that matches the remote machine specified on the
1967 command line or as an
1970 Once a match is made, the subsequent
1972 tokens are processed,
1973 stopping when the end of file is reached or another
1977 token is encountered.
1985 There can be only one
1987 token, and it must be after all
1990 This is normally used as:
1992 .Dl default login anonymous password user@site
1994 thereby giving the user an automatic anonymous
1997 machines not specified in
1999 This can be overridden
2002 flag to disable auto-login.
2003 .It Ic login Ar name
2004 Identify a user on the remote machine.
2005 If this token is present, the auto-login process will initiate
2006 a login using the specified
2008 .It Ic password Ar string
2010 If this token is present, the auto-login process will supply the
2011 specified string if the remote server requires a password as part
2012 of the login process.
2013 Note that if this token is present in the
2015 file for any user other
2019 will abort the auto-login process if the
2022 anyone besides the user.
2023 .It Ic account Ar string
2024 Supply an additional account password.
2025 If this token is present, the auto-login process will supply the
2026 specified string if the remote server requires an additional
2027 account password, or the auto-login process will initiate an
2029 command if it does not.
2030 .It Ic macdef Ar name
2032 This token functions like the
2036 A macro is defined with the specified name; its contents begin with the
2039 line and continue until a blank line (consecutive new-line
2040 characters) is encountered.
2043 is defined, it is automatically executed as the last step in the
2046 .Bd -literal -offset indent
2052 followed by a blank line.
2054 .Sh COMMAND LINE EDITING
2056 supports interactive command line editing, via the
2059 It is enabled with the
2061 command, and is enabled by default if input is from a tty.
2062 Previous lines can be recalled and edited with the arrow keys,
2063 and other GNU Emacs-style editing keys may be used as well.
2067 library is configured with a
2071 for more information.
2073 An extra key binding is available to
2075 to provide context sensitive command and filename completion
2076 (including remote file completion).
2077 To use this, bind a key to the
2081 By default, this is bound to the TAB key.
2082 .Sh COMMAND LINE PROMPT
2085 displays a command line prompt of
2088 This can be changed with the
2092 A prompt can be displayed on the right side of the screen (after the
2093 command input) with the
2097 The following formatting sequences are replaced by the given
2099 .Bl -tag -width "%% " -offset indent
2101 The current remote working directory.
2102 .\" %c[[0]n], %.[[0]n]
2106 .Op Oo Li 0 Oc Ar n Ns ,
2111 The trailing component of the current remote working directory, or
2113 trailing components if a digit
2120 the number of skipped components precede the trailing component(s) in
2122 .\" ``/<number>trailing''
2125 .Li / Li \*[Lt] Va number Li \*[Gt]
2133 .Dq Li \&... Ns Va trailing
2137 The remote host name.
2139 The remote host name, up to the first
2142 The remote user name.
2149 uses the following environment variables.
2150 .Bl -tag -width "FTPSERVERPORT"
2152 Password to send in an anonymous
2158 Overrides the default operation mode.
2160 .Bl -tag -width "passive"
2166 automatic determination of passive or active (this is the default)
2175 Command-line prompt to use.
2179 .Sx COMMAND LINE PROMPT
2180 for more information.
2182 Command-line right side prompt to use.
2186 .Sx COMMAND LINE PROMPT
2187 for more information.
2189 Host to use as gate-ftp server when
2192 .It Ev FTPSERVERPORT
2193 Port to use when connecting to gate-ftp server when
2196 Default is port returned by a
2201 The value to send for the
2206 For default location of a
2208 file, if one exists.
2210 An alternate location of the
2214 Used by various commands to display files.
2217 if empty or not set.
2223 proxy to use when making
2226 (if not defined, use the standard
2232 for further notes about proxy use.
2236 proxy to use when making
2239 If proxy authentication is required and there is a username and
2240 password in this URL, they will automatically be used in the first
2241 attempt to authenticate to the proxy.
2245 URL characters are required in the username or password
2255 Note that the use of a username and password in
2259 may be incompatible with other programs that use it
2264 this is not used for interactive sessions, only for command-line
2267 A space or comma separated list of hosts (or domains) for which
2268 proxying is not to be used.
2269 Each entry may have an optional trailing ":port", which restricts
2270 the matching to connections to that port.
2272 .Sh EXTENDED PASSIVE MODE AND FIREWALLS
2273 Some firewall configurations do not allow
2275 to use extended passive mode.
2276 If you find that even a simple
2278 appears to hang after printing a message such as this:
2280 .Dl 229 Entering Extended Passive Mode (|||58551|)
2282 then you will need to disable extended passive mode with
2284 See the above section
2286 for an example of how to make this automatic.
2288 .Xr getservbyname 3 ,
2294 attempts to be compliant with
2303 .Cm draft-ietf-ftpext-mlst-11 .
2310 Various features such as command line editing, context sensitive
2311 command and file completion, dynamic progress bar, automatic
2312 fetching of files and URLs, modification time preservation,
2313 transfer rate throttling, configurable command line prompt,
2314 and other enhancements over the standard
2322 .Aq lukem@NetBSD.org .
2324 IPv6 support was added by the WIDE/KAME project
2325 (but may not be present in all non-NetBSD versions of this program, depending
2326 if the operating system supports IPv6 in a similar manner to KAME).
2328 Correct execution of many commands depends upon proper behavior
2329 by the remote server.
2331 An error in the treatment of carriage returns
2334 ascii-mode transfer code
2336 This correction may result in incorrect transfers of binary files
2339 servers using the ascii type.
2340 Avoid this problem by using the binary image type.
2343 assumes that all IPv4 mapped addresses
2345 IPv6 addresses with a form like
2348 indicate IPv4 destinations which can be handled by
2351 However, in certain IPv6 network configurations, this assumption is not true.
2352 In such an environment, IPv4 mapped addresses must be passed to
2355 For example, if your site uses a SIIT translator for IPv6-to-IPv4 translation,
2357 is unable to support your configuration.