1 .\" $NetBSD: ftp.1,v 1.13 2009/11/15 10:12:37 lukem Exp $
2 .\" from NetBSD: ftp.1,v 1.130 2009/07/11 18:35:48 joerg Exp
4 .\" Copyright (c) 1996-2008 The NetBSD Foundation, Inc.
5 .\" All rights reserved.
7 .\" This code is derived from software contributed to The NetBSD Foundation
10 .\" Redistribution and use in source and binary forms, with or without
11 .\" modification, are permitted provided that the following conditions
13 .\" 1. Redistributions of source code must retain the above copyright
14 .\" notice, this list of conditions and the following disclaimer.
15 .\" 2. Redistributions in binary form must reproduce the above copyright
16 .\" notice, this list of conditions and the following disclaimer in the
17 .\" documentation and/or other materials provided with the distribution.
19 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 .\" POSSIBILITY OF SUCH DAMAGE.
32 .\" Copyright (c) 1985, 1989, 1990, 1993
33 .\" The Regents of the University of California. All rights reserved.
35 .\" Redistribution and use in source and binary forms, with or without
36 .\" modification, are permitted provided that the following conditions
38 .\" 1. Redistributions of source code must retain the above copyright
39 .\" notice, this list of conditions and the following disclaimer.
40 .\" 2. Redistributions in binary form must reproduce the above copyright
41 .\" notice, this list of conditions and the following disclaimer in the
42 .\" documentation and/or other materials provided with the distribution.
43 .\" 3. Neither the name of the University nor the names of its contributors
44 .\" may be used to endorse or promote products derived from this software
45 .\" without specific prior written permission.
47 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
48 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
49 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
50 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
51 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
52 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
53 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
54 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
55 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
56 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
59 .\" @(#)ftp.1 8.3 (Berkeley) 10/9/94
66 .Nd Internet file transfer program
69 .Op Fl 46AadefginpRtVv
87 .\" [-T dir,max[,inc]]
99 .\" [[user@]host [port]]
101 .Oo Ar user Ns Li \&@ Oc Ns Ar host
106 .\" [[user@]host:[path][/]]
125 .\" [ftp://[user[:password]@]host[:port]/path[/]]
130 .Op Li \&: Ar password
132 .Ar host Oo Li \&: Ar port Oc
140 .\" [http://[user[:password]@]host[:port]/path]
145 .Op Li \&: Ar password
147 .Ar host Oo Li \&: Ar port Oc
160 is the user interface to the Internet standard File Transfer Protocol.
161 The program allows a user to transfer files to and from a
164 The last five arguments will fetch a file using the
168 protocols, or by direct copying, into the current directory.
169 This is ideal for scripts.
171 .Sx AUTO-FETCHING FILES
172 below for more information.
174 Options may be specified at the command line, or to the
180 to only use IPv4 addresses.
184 to only use IPv6 addresses.
186 Force active mode ftp.
189 will try to use passive mode ftp and fall back to active mode
190 if passive is not supported by the server.
193 to always use an active connection.
194 It is only useful for connecting to very old servers that do not
195 implement passive mode properly.
199 to bypass normal login procedure, and use an anonymous login instead.
203 Disables command line editing.
204 This is useful for Emacs ange-ftp mode.
206 Forces a cache reload for transfers that go through the
212 Disables file name globbing.
214 Turns off interactive prompting during
215 multiple file transfers.
223 for more information.
229 upon initial connection for non auto-fetch transfers.
230 If auto-login is enabled,
234 (see below) file in the user's home directory for an entry describing
235 an account on the remote machine.
238 will prompt for the remote machine login name (default is the user
239 identity on the local machine), and, if necessary, prompt for a password
240 and an account with which to login.
241 To override the auto-login for auto-fetch transfers, specify the
242 username (and optionally, password) as appropriate.
244 When auto-fetching files, save the contents in
247 is parsed according to the
248 .Sx FILE NAMING CONVENTIONS
254 or doesn't start with
256 then only the first file specified will be retrieved into
258 all other files will be retrieved into the basename of their
261 Sets the port number to
264 Enable passive mode operation for use behind connection filtering firewalls.
265 This option has been deprecated as
267 now tries to use passive mode by default, falling back to active mode
268 if the server does not support passive connections.
270 Quit if the connection has stalled for
274 Restart all non-proxied auto-fetches.
276 Retry the connection attempt if it failed, pausing for
282 as the local IP address for all connections.
284 Enables packet tracing.
285 .It Fl T Ar direction Ns , Ns Ar maximum Ns Oo , Ns Ar increment Oc
286 Set the maximum transfer rate for
291 and if specified, the increment to
296 for more information.
297 .It Fl u Ar URL file Op \&.\&.\&.
298 Upload files on the command line to
302 is one of the ftp URL types as supported by auto-fetch
303 (with an optional target filename for single file uploads), and
305 is one or more local files to be uploaded.
311 overriding the default of enabled when output is to a terminal.
317 This is the default if output is to a terminal (and in the case of
320 is the foreground process).
323 to show all responses from the remote server, as well
324 as report on data transfer statistics.
327 The client host with which
329 is to communicate may be specified on the command line.
332 will immediately attempt to establish a connection to an
334 server on that host; otherwise,
336 will enter its command interpreter and await instructions
340 is awaiting commands from the user the prompt
342 is provided to the user.
343 The following commands are recognized
347 .It Ic \&! Op Ar command Op Ar args
348 Invoke an interactive shell on the local machine.
349 If there are arguments, the first is taken to be a command to execute
350 directly, with the rest of the arguments as its arguments.
351 .It Ic \&$ Ar macro-name Op Ar args
354 that was defined with the
357 Arguments are passed to the macro unglobbed.
358 .It Ic account Op Ar passwd
359 Supply a supplemental password required by a remote system for access
360 to resources once a login has been successfully completed.
361 If no argument is included, the user will be prompted for an account
362 password in a non-echoing input mode.
363 .It Ic append Ar local-file Op Ar remote-file
364 Append a local file to a file on the remote machine.
367 is left unspecified, the local file name is used in naming the
368 remote file after being altered by any
373 File transfer uses the current settings for
380 Set the file transfer
384 This is the default type.
386 Arrange that a bell be sounded after each file transfer
387 command is completed.
389 Set the file transfer
391 to support binary image transfer.
395 session with the remote server
398 An end of file will also terminate the session and exit.
400 Toggle remote computer file name case mapping during
408 is on (default is off), remote computer file names with all letters in
409 upper case are written in the local directory with the letters mapped
411 .It Ic \&cd Ar remote-directory
412 Change the working directory on the remote machine
414 .Ar remote-directory .
416 Change the remote machine working directory to the parent of the
417 current remote machine working directory.
418 .It Ic chmod Ar mode remote-file
419 Change the permission modes of the file
427 session with the remote server, and
428 return to the command interpreter.
429 Any defined macros are erased.
431 Toggle carriage return stripping during
432 ascii type file retrieval.
433 Records are denoted by a carriage return/linefeed sequence
434 during ascii type file transfer.
437 is on (the default), carriage returns are stripped from this
438 sequence to conform with the
440 single linefeed record
444 remote systems may contain single linefeeds;
445 when an ascii type transfer is made, these linefeeds may be
446 distinguished from a record delimiter only when
449 .It Ic delete Ar remote-file
452 on the remote machine.
453 .It Ic dir Op Ar remote-path Op Ar local-file
454 Print a listing of the contents of a
455 directory on the remote machine.
456 The listing includes any system-dependent information that the server
457 chooses to include; for example, most
460 output from the command
464 is left unspecified, the current working directory is used.
465 If interactive prompting is on,
467 will prompt the user to verify that the last argument is indeed the
468 target local file for receiving
471 If no local file is specified, or if
475 the output is sent to the terminal.
480 Toggle command line editing, and context sensitive command and file
482 This is automatically enabled if input is from a terminal, and
484 .It Ic epsv epsv4 epsv6
485 Toggle the use of the extended
489 commands on all IP, IPv4, and IPv6 connections respectively.
496 This is enabled by default.
497 If an extended command fails then this option will be temporarily
498 disabled for the duration of the current connection, or until
508 Display what features the remote server supports (using the
511 .It Ic fget Ar localfile
512 Retrieve the files listed in
514 which has one line per filename.
515 .It Ic form Ar format
516 Set the file transfer
520 The default (and only supported)
523 .It Ic ftp Ar host Op Ar port
526 .It Ic ftp_debug Op Ar ftp_debug-value
527 Toggle debugging mode.
530 is specified it is used to set the debugging level.
531 When debugging is on,
533 prints each command sent to the remote machine, preceded
536 .It Ic gate Op Ar host Op Ar port
537 Toggle gate-ftp mode, which used to connect through the
538 TIS FWTK and Gauntlet ftp proxies.
539 This will not be permitted if the gate-ftp server hasn't been set
540 (either explicitly by the user, or from the
542 environment variable).
546 then gate-ftp mode will be enabled, and the gate-ftp server will be set to
550 is also given, that will be used as the port to connect to on the
552 .It Ic get Ar remote-file Op Ar local-file
555 and store it on the local machine.
557 file name is not specified, it is given the same
558 name it has on the remote machine, subject to
559 alteration by the current
565 The current settings for
571 are used while transferring the file.
573 Toggle filename expansion for
579 If globbing is turned off with
581 the file name arguments
582 are taken literally and not expanded.
592 each remote file name is expanded
593 separately on the remote machine and the lists are not merged.
594 Expansion of a directory name is likely to be
595 different from expansion of the name of an ordinary file:
596 the exact result depends on the foreign operating system and ftp server,
597 and can be previewed by doing
598 .Ql mls remote-files \-
604 are not meant to transfer
605 entire directory subtrees of files.
609 archive of the subtree (in binary mode).
610 .It Ic hash Op Ar size
613 printing for each data block transferred.
614 The size of a data block defaults to 1024 bytes.
615 This can be changed by specifying
622 .It Ic help Op Ar command
623 Print an informative message about the meaning of
625 If no argument is given,
627 prints a list of the known commands.
628 .It Ic idle Op Ar seconds
629 Set the inactivity timer on the remote server to
634 is omitted, the current inactivity timer is printed.
638 .It Ic lcd Op Ar directory
639 Change the working directory on the local machine.
643 is specified, the user's home directory is used.
647 .It Ic lpage Ar local-file
650 with the program specified by the
654 Print the working directory on the local machine.
655 .It Ic \&ls Op Ar remote-path Op Ar local-file
658 .It Ic macdef Ar macro-name
660 Subsequent lines are stored as the macro
662 a null line (consecutive newline characters in a file or carriage
663 returns from the terminal) terminates macro input mode.
664 There is a limit of 16 macros and 4096 total characters in all
666 Macro names can be a maximum of 8 characters.
667 Macros are only applicable to the current session they are
668 defined within (or if defined outside a session, to the session
669 invoked with the next
671 command), and remain defined until a
674 To invoke a macro, use the
678 The macro processor interprets
682 as special characters.
685 followed by a number (or numbers) is replaced by the
686 corresponding argument on the macro invocation command line.
691 signals the macro processor that the executing macro is to be
695 is replaced by the first argument on the macro invocation command
696 line, on the second pass it is replaced by the second argument,
700 followed by any character is replaced by that character.
703 to prevent special treatment of the
705 .It Ic mdelete Op Ar remote-files
708 on the remote machine.
709 .It Ic mdir Ar remote-files local-file
712 except multiple remote files may be specified.
713 If interactive prompting is on,
715 will prompt the user to verify that the last argument is indeed the
716 target local file for receiving
719 .It Ic mget Ar remote-files
722 on the remote machine
725 for each file name thus produced.
728 for details on the filename expansion.
729 Resulting file names will then be processed according to
735 Files are transferred into the local working directory,
736 which can be changed with
738 new local directories can be created with
739 .Ql "\&! mkdir directory" .
740 .It Ic mkdir Ar directory-name
741 Make a directory on the remote machine.
742 .It Ic mls Ar remote-files local-file
745 except multiple remote files may be specified,
749 If interactive prompting is on,
751 will prompt the user to verify that the last argument is indeed the
752 target local file for receiving
755 .It Ic mlsd Op Ar remote-path
756 Display the contents of
758 (which should default to the current directory if not given)
759 in a machine-parsable form, using
761 The format of display can be changed with
762 .Sq "remopts mlst ..." .
763 .It Ic mlst Op Ar remote-path
764 Display the details about
766 (which should default to the current directory if not given)
767 in a machine-parsable form, using
769 The format of display can be changed with
770 .Sq "remopts mlst ..." .
771 .It Ic mode Ar mode-name
772 Set the file transfer
776 The default (and only supported)
779 .It Ic modtime Ar remote-file
780 Show the last modification time of the file on the remote machine, in
786 .It Ic mput Ar local-files
787 Expand wild cards in the list of local files given as arguments
790 for each file in the resulting list.
793 for details of filename expansion.
794 Resulting file names will then be processed according to
799 .It Ic mreget Ar remote-files
806 .It Ic msend Ar local-files
809 .It Ic newer Ar remote-file Op Ar local-file
810 Get the file only if the modification time of the remote file is more
811 recent that the file on the current system.
813 exist on the current system, the remote file is considered
815 Otherwise, this command is identical to
817 .It Ic nlist Op Ar remote-path Op Ar local-file
820 .It Ic nmap Op Ar inpattern outpattern
821 Set or unset the filename mapping mechanism.
822 If no arguments are specified, the filename mapping mechanism is unset.
823 If arguments are specified, remote filenames are mapped during
827 commands issued without a specified remote target filename.
828 If arguments are specified, local filenames are mapped during
832 commands issued without a specified local target filename.
833 This command is useful when connecting to a
836 with different file naming conventions or practices.
837 The mapping follows the pattern set by
842 is a template for incoming filenames (which may have already been
843 processed according to the
848 Variable templating is accomplished by including the
858 to prevent this special treatment of the
861 All other characters are treated literally, and are used to determine the
867 $1.$2 and the remote file name "mydata.data", $1 would have the value
868 "mydata", and $2 would have the value "data".
871 determines the resulting mapped filename.
877 are replaced by any value resulting from the
882 is replaced by the original filename.
883 Additionally, the sequence
884 .Dq Op Ar seq1 , Ar seq2
889 is not a null string; otherwise it is replaced by
891 For example, the command
893 .Bd -literal -offset indent -compact
894 nmap $1.$2.$3 [$1,$2].[$2,file]
898 the output filename "myfile.data" for input filenames "myfile.data" and
899 "myfile.data.old", "myfile.file" for the input filename "myfile", and
900 "myfile.myfile" for the input filename ".myfile".
901 Spaces may be included in
904 .Dl nmap $1 sed "s/ *$//" \*[Gt] $1
907 character to prevent special treatment
915 .It Ic ntrans Op Ar inchars Op Ar outchars
916 Set or unset the filename character translation mechanism.
917 If no arguments are specified, the filename character
918 translation mechanism is unset.
919 If arguments are specified, characters in
920 remote filenames are translated during
924 commands issued without a specified remote target filename.
925 If arguments are specified, characters in
926 local filenames are translated during
930 commands issued without a specified local target filename.
931 This command is useful when connecting to a
934 with different file naming conventions or practices.
935 Characters in a filename matching a character in
937 are replaced with the corresponding character in
939 If the character's position in
941 is longer than the length of
943 the character is deleted from the file name.
944 .It Ic open Ar host Op Ar port
945 Establish a connection to the specified
949 An optional port number may be supplied,
952 will attempt to contact an
957 option is on (default),
959 will also attempt to automatically log the user in to
966 and display with the program specified by the
969 .It Ic passive Op Cm auto
970 Toggle passive mode (if no arguments are given).
977 If passive mode is turned on (default),
981 command for all data connections instead of a
986 command requests that the remote server open a port for the data connection
987 and return the address of that port.
988 The remote server listens on that port and the client connects to it.
989 When using the more traditional
991 command, the client listens on a port and sends that address to the remote
992 server, who connects back to it.
993 Passive mode is useful when using
995 through a gateway router or host that controls the directionality of
999 servers are required to support the
1004 .It Ic pdir Op Ar remote-path
1007 .Op Ar remote-path ,
1008 and display the result with the program specified by the
1011 .It Ic pls Op Ar remote-path
1014 .Op Ar remote-path ,
1015 and display the result with the program specified by the
1018 .It Ic pmlsd Op Ar remote-path
1021 .Op Ar remote-path ,
1022 and display the result with the program specified by the
1026 Toggle preservation of modification times on retrieved files.
1028 Toggle display of transfer progress bar.
1029 The progress bar will be disabled for a transfer that has
1033 or a command that starts with
1036 .Sx FILE NAMING CONVENTIONS
1037 for more information.
1043 Toggle interactive prompting.
1044 Interactive prompting
1045 occurs during multiple file transfers to allow the
1046 user to selectively retrieve or store files.
1047 If prompting is turned off (default is on), any
1051 will transfer all files, and any
1053 will delete all files.
1055 When prompting is on, the following commands are available at a prompt:
1056 .Bl -tag -width 2n -offset indent
1060 to the current file, and automatically answer
1062 to any remaining files for the current command.
1066 and do not transfer the file.
1070 to the current file, and turn off prompt mode
1075 Terminate the current operation.
1079 and transfer the file.
1081 Display a help message.
1084 Any other response will answer
1086 to the current file.
1087 .It Ic proxy Ar ftp-command
1088 Execute an ftp command on a secondary control connection.
1089 This command allows simultaneous connection to two remote
1091 servers for transferring files between the two servers.
1094 command should be an
1096 to establish the secondary control connection.
1097 Enter the command "proxy ?" to see other
1099 commands executable on the secondary connection.
1100 The following commands behave differently when prefaced by
1103 will not define new macros during the auto-login process,
1105 will not erase existing macro definitions,
1109 transfer files from the host on the primary control connection
1110 to the host on the secondary control connection, and
1115 transfer files from the host on the secondary control connection
1116 to the host on the primary control connection.
1117 Third party file transfers depend upon support of the
1121 command by the server on the secondary control connection.
1122 .It Ic put Ar local-file Op Ar remote-file
1123 Store a local file on the remote machine.
1126 is left unspecified, the local file name is used
1127 after processing according to any
1132 in naming the remote file.
1133 File transfer uses the
1134 current settings for
1141 Print the name of the current working directory on the remote
1146 .It Ic quote Ar arg1 arg2 ...
1147 The arguments specified are sent, verbatim, to the remote
1150 .It Ic rate Ar direction Oo Ar maximum Oo Ar increment Oc Oc
1151 Throttle the maximum transfer rate to
1156 is 0, disable the throttle.
1160 .Bl -tag -width "all" -offset indent -compact
1170 can be modified on the fly by
1172 bytes (default: 1024) each time a given signal is received:
1173 .Bl -tag -width "SIGUSR1" -offset indent
1186 The result must be a positive number.
1191 is not supplied, the current throttle rates are displayed.
1195 is not yet implemented for ascii mode transfers.
1196 .It Ic rcvbuf Ar size
1197 Set the size of the socket receive buffer to
1199 .It Ic recv Ar remote-file Op Ar local-file
1202 .It Ic reget Ar remote-file Op Ar local-file
1213 a partially transferred copy of
1216 is continued from the apparent point of failure.
1218 is useful when transferring very large files over networks that
1219 are prone to dropping connections.
1220 .It Ic remopts Ar command Op Ar command-options
1221 Set options on the remote
1227 (whose absence is handled on a command-specific basis).
1230 commands known to support options include:
1236 .It Ic rename Op Ar from Op Ar to
1239 on the remote machine, to the file
1243 This command re-synchronizes command/reply sequencing with the remote
1246 Resynchronization may be necessary following a violation of the
1248 protocol by the remote server.
1249 .It Ic restart Ar marker
1250 Restart the immediately following
1259 systems, marker is usually a byte
1260 offset into the file.
1261 .It Ic rhelp Op Ar command-name
1262 Request help from the remote
1267 is specified it is supplied to the server as well.
1268 .It Ic rmdir Ar directory-name
1269 Delete a directory on the remote machine.
1270 .It Ic rstatus Op Ar remote-file
1271 With no arguments, show status of remote machine.
1274 is specified, show status of
1278 Toggle storing of files on the local system with unique filenames.
1279 If a file already exists with a name equal to the target
1280 local filename for a
1284 command, a ".1" is appended to the name.
1285 If the resulting name matches another existing file,
1286 a ".2" is appended to the original name.
1287 If this process continues up to ".99", an error
1288 message is printed, and the transfer does not take place.
1289 The generated unique filename will be reported.
1292 will not affect local files generated from a shell command
1294 The default value is off.
1295 .It Ic send Ar local-file Op Ar remote-file
1304 will attempt to use a
1306 command when establishing
1307 a connection for each data transfer.
1310 commands can prevent delays
1311 when performing multiple file transfers.
1316 will use the default data port.
1319 commands is disabled, no attempt will be made to use
1321 commands for each data transfer.
1325 implementations which do ignore
1327 commands but, incorrectly, indicate they've been accepted.
1328 .It Ic set Op Ar option Ar value
1337 are not given, display all of the options and their values.
1338 The currently supported options are:
1339 .Bl -tag -width "http_proxy" -offset indent
1362 .It Ic site Ar arg1 arg2 ...
1363 The arguments specified are sent, verbatim, to the remote
1368 .It Ic size Ar remote-file
1372 .It Ic sndbuf Ar size
1373 Set the size of the socket send buffer to
1376 Show the current status of
1378 .It Ic struct Ar struct-name
1379 Set the file transfer
1383 The default (and only supported)
1387 Toggle storing of files on remote machine under unique file names.
1395 successful completion.
1396 The remote server will report unique name.
1397 Default value is off.
1399 Show the type of operating system running on the remote machine.
1401 Set the file transfer type to that needed to
1409 Toggle packet tracing.
1410 .It Ic type Op Ar type-name
1411 Set the file transfer
1415 If no type is specified, the current type
1417 The default type is network
1419 .It Ic umask Op Ar newmask
1420 Set the default umask on the remote server to
1424 is omitted, the current umask is printed.
1425 .It Ic unset Ar option
1430 for more information.
1431 .It Ic usage Ar command
1432 Print the usage message for
1434 .It Ic user Ar user-name Oo Ar password Oo Ar account Oc Oc
1435 Identify yourself to the remote
1440 is not specified and the server requires it,
1442 will prompt the user for it (after disabling local echo).
1445 field is not specified, and the
1448 requires it, the user will be prompted for it.
1451 field is specified, an account command will
1452 be relayed to the remote server after the login sequence
1453 is completed if the remote server did not require it
1459 disabled, this process is done automatically on initial connection to the
1463 Toggle verbose mode.
1464 In verbose mode, all responses from
1467 server are displayed to the user.
1469 if verbose is on, when a file transfer completes, statistics
1470 regarding the efficiency of the transfer are reported.
1473 .It Ic xferbuf Ar size
1474 Set the size of the socket send and receive buffers to
1476 .It Ic \&? Op Ar command
1481 Command arguments which have embedded spaces may be quoted with
1486 Commands which toggle settings can take an explicit
1490 argument to force the setting appropriately.
1492 Commands which take a byte count as an argument
1498 support an optional suffix on the argument which changes the
1499 interpretation of the argument.
1500 Supported suffixes are:
1501 .Bl -tag -width 3n -offset indent -compact
1503 Causes no modification.
1506 Kilo; multiply the argument by 1024
1508 Mega; multiply the argument by 1048576
1510 Giga; multiply the argument by 1073741824
1523 signal whilst a transfer is in progress, the current transfer rate
1524 statistics will be written to the standard error output, in the
1525 same format as the standard completion message.
1526 .Sh AUTO-FETCHING FILES
1527 In addition to standard commands, this version of
1529 supports an auto-fetch feature.
1530 To enable auto-fetch, simply pass the list of hostnames/files
1531 on the command line.
1533 The following formats are valid syntax for an auto-fetch element:
1534 .Bl -tag -width "FOO "
1535 .\" [user@]host:[path][/]
1536 .It Oo Ar user Ns Li \&@ Oc Ns Ar host Ns Li \&: Ns Oo Ar path Oc \
1544 contains a glob character and globbing is enabled,
1547 then the equivalent of
1551 If the directory component of
1553 contains no globbing characters,
1554 it is stored locally with the name basename (see
1558 in the current directory.
1559 Otherwise, the full remote name is used as the local name,
1560 relative to the local root directory.
1561 .\" ftp://[user[:password]@]host[:port]/path[/][;type=X]
1562 .It Li ftp:// Ns Oo Ar user Ns Oo Ns Li \&: Ns Ar password Oc Ns Li \&@ Oc \
1563 Ns Ar host Ns Oo Li \&: Ns Ar port Oc Ns Li / Ns Ar path Ns Oo Li / Oc \
1564 Ns Oo Li ;type= Ns Ar X Oc
1567 URL, retrieved using the
1572 Otherwise, transfer the URL using
1574 via the proxy defined in
1575 .Ic "set ftp_proxy" .
1584 if supplied, otherwise prompt the user for one.
1590 is supplied, then the transfer type will take place as
1591 ascii or binary (respectively).
1592 The default transfer type is binary.
1594 In order to be compliant with
1601 auto-fetch URL as follows:
1606 immediately after the
1607 .Ar host Ns Oo Li \&: Ns Ar port Oc
1608 is interpreted as a separator before the
1610 and not as part of the
1617 .So Li / Sc Ns -separated
1618 list of name components.
1619 For all but the last such component,
1621 performs the equivalent of a
1624 For the last path component,
1626 performs the equivalent of a
1630 Empty name components,
1637 at the beginning of the
1639 will cause the equivalent of a
1641 command without a directory name.
1642 This is unlikely to be useful.
1649 within the path components are decoded, with
1651 representing a character code in hexadecimal.
1652 This decoding takes place after the
1654 has been split into components,
1655 but before each component is used in the equivalent of a
1660 Some often-used codes are
1670 The above interpretation has the following consequences:
1673 The path is interpreted relative to the
1674 default login directory of the specified user or of the
1679 directory is required, use a leading path of
1681 If a user's home directory is required (and the remote server supports
1682 the syntax), use a leading path of
1684 For example, to retrieve
1693 .Dq ftp://myname:mypass@localhost/%2fetc/motd
1699 commands can be controlled by careful choice of
1706 For example, the following URLs correspond to the
1707 equivalents of the indicated commands:
1708 .Bl -tag -width "ftp://host/%2Fdir1%2Fdir2%2Ffile"
1709 .It ftp://host/dir1/dir2/file
1713 .It ftp://host/%2Fdir1/dir2/file
1717 .It ftp://host/dir1%2Fdir2/file
1718 .Dq "cd dir1/dir2" ,
1720 .It ftp://host/%2Fdir1%2Fdir2/file
1721 .Dq "cd /dir1/dir2" ,
1723 .It ftp://host/dir1%2Fdir2%2Ffile
1724 .Dq "get dir1/dir2/file" .
1725 .It ftp://host/%2Fdir1%2Fdir2%2Ffile
1726 .Dq "get /dir1/dir2/file" .
1729 You must have appropriate access permission for each of the
1730 intermediate directories that is used in the equivalent of a
1734 .\" http://[user[:password]@]host[:port]/path
1735 .It Li http:// Ns Oo Ar user Ns Oo Li \&: Ns Ar password Oc Ns Li \&@ Oc \
1736 Ns Ar host Ns Oo Li \&: Ns Ar port Oc Ns Li / Ns Ar path
1739 URL, retrieved using the
1743 .Ic "set http_proxy"
1744 is defined, it is used as a URL to an
1749 authorization is required to retrieve
1755 is in the URL, use them for the first attempt to authenticate.
1757 .It Li file:/// Ns Ar path
1758 A local URL, copied from
1762 .It Li about: Ns Ar topic
1763 Display information regarding
1765 no file is retrieved for this auto-fetched element.
1766 Supported values include:
1767 .Bl -tag -width "about:version"
1771 .It Li about:version
1774 Useful to provide when reporting problems.
1778 Unless noted otherwise above, and
1780 is not given, the file is stored in the current directory as the
1786 redirect is received, the fetch is retried using the new target URL
1787 supplied by the server, with a corresponding new
1791 is recommended, to avoid writing to unexpected file names.
1793 If a classic format or an
1795 URL format has a trailing
1801 will connect to the site and
1803 to the directory given as the path, and leave the user in interactive
1804 mode ready for further input.
1805 This will not work if
1811 transfers use HTTP 1.1.
1816 transfers use HTTP 1.0.
1820 is given, all auto-fetches that don't go via the
1824 proxies will be restarted.
1827 this is implemented by using
1833 this is implemented by using the
1838 If WWW or proxy WWW authentication is required, you will be prompted
1839 to enter a username and password to authenticate with.
1841 When specifying IPv6 numeric addresses in a URL, you need to
1842 surround the address in square brackets.
1844 .Dq ftp://[::1]:21/ .
1845 This is because colons are used in IPv6 numeric address as well as
1846 being the separator for the port number.
1847 .Sh ABORTING A FILE TRANSFER
1848 To abort a file transfer, use the terminal interrupt key
1850 Sending transfers will be immediately halted.
1851 Receiving transfers will be halted by sending an
1855 command to the remote server, and discarding any further data received.
1856 The speed at which this is accomplished depends upon the remote
1857 server's support for
1860 If the remote server does not support the
1862 command, the prompt will not appear until the remote server has completed
1863 sending the requested file.
1865 If the terminal interrupt key sequence is used whilst
1867 is awaiting a reply from the remote server for the ABOR processing,
1868 then the connection will be closed.
1869 This is different from the traditional behaviour (which ignores the
1870 terminal interrupt during this phase), but is considered more useful.
1871 .Sh FILE NAMING CONVENTIONS
1872 Files specified as arguments to
1874 commands are processed according to the following rules.
1883 (for writing) is used.
1885 If the first character of the file name is
1888 remainder of the argument is interpreted as a shell command.
1890 then forks a shell, using
1892 with the argument supplied, and reads (writes) from the stdout
1894 If the shell command includes spaces, the argument
1895 must be quoted; e.g.
1896 .Dq Qq Li \&| ls\ \-lt .
1898 useful example of this mechanism is:
1899 .Dq Li dir \&"\&" \&|more .
1901 Failing the above checks, if
1903 is enabled, local file names are expanded according to the rules
1911 command expects a single local file (e.g.
1913 only the first filename generated by the "globbing" operation is used.
1919 commands with unspecified local file names, the local filename is
1920 the remote filename, which may be altered by a
1926 The resulting filename may then be altered if
1934 commands with unspecified remote file names, the remote filename is
1935 the local filename, which may be altered by a
1940 The resulting filename may then be altered by the remote server if
1944 .Sh FILE TRANSFER PARAMETERS
1947 specification specifies many parameters which may affect a file transfer.
1963 supports the ascii and image types of file transfer,
1964 plus local byte size 8 for
1969 supports only the default values for the remaining
1970 file transfer parameters:
1978 file contains login and initialization information
1979 used by the auto-login process.
1980 It resides in the user's home directory,
1981 unless overridden with the
1983 option, or specified in the
1985 environment variable.
1986 The following tokens are recognized; they may be separated by spaces,
1988 .Bl -tag -width password
1989 .It Ic machine Ar name
1990 Identify a remote machine
1992 The auto-login process searches the
1996 token that matches the remote machine specified on the
1998 command line or as an
2001 Once a match is made, the subsequent
2003 tokens are processed,
2004 stopping when the end of file is reached or another
2008 token is encountered.
2016 There can be only one
2018 token, and it must be after all
2021 This is normally used as:
2023 .Dl default login anonymous password user@site
2025 thereby giving the user an automatic anonymous
2028 machines not specified in
2030 This can be overridden
2033 flag to disable auto-login.
2034 .It Ic login Ar name
2035 Identify a user on the remote machine.
2036 If this token is present, the auto-login process will initiate
2037 a login using the specified
2039 .It Ic password Ar string
2041 If this token is present, the auto-login process will supply the
2042 specified string if the remote server requires a password as part
2043 of the login process.
2044 Note that if this token is present in the
2046 file for any user other
2050 will abort the auto-login process if the
2053 anyone besides the user.
2054 .It Ic account Ar string
2055 Supply an additional account password.
2056 If this token is present, the auto-login process will supply the
2057 specified string if the remote server requires an additional
2058 account password, or the auto-login process will initiate an
2060 command if it does not.
2061 .It Ic macdef Ar name
2063 This token functions like the
2067 A macro is defined with the specified name; its contents begin with the
2070 line and continue until a blank line (consecutive new-line
2071 characters) is encountered.
2072 Like the other tokens in the
2076 is applicable only to the
2078 definition preceding it.
2081 entry cannot be used by multiple
2083 definitions; rather, it must be defined following each
2085 it is intended to be used with.
2088 is defined, it is automatically executed as the last step in the
2091 .Bd -literal -offset indent
2097 followed by a blank line.
2099 .Sh COMMAND LINE EDITING
2101 supports interactive command line editing, via the
2104 It is enabled with the
2106 command, and is enabled by default if input is from a tty.
2107 Previous lines can be recalled and edited with the arrow keys,
2108 and other GNU Emacs-style editing keys may be used as well.
2112 library is configured with a
2116 for more information.
2118 An extra key binding is available to
2120 to provide context sensitive command and filename completion
2121 (including remote file completion).
2122 To use this, bind a key to the
2126 By default, this is bound to the TAB key.
2127 .Sh COMMAND LINE PROMPT
2130 displays a command line prompt of
2133 This can be changed with the
2137 A prompt can be displayed on the right side of the screen (after the
2138 command input) with the
2142 The following formatting sequences are replaced by the given
2144 .Bl -tag -width "%% " -offset indent
2146 The current remote working directory.
2147 .\" %c[[0]n], %.[[0]n]
2148 .It \&%c Ns Oo Oo Li 0 Oc Ns Ar n Oc , Ns Li \&%. Ns Oo Oo Li 0 Oc Ns Ar n Oc
2149 The trailing component of the current remote working directory, or
2151 trailing components if a digit
2158 the number of skipped components precede the trailing component(s) in
2160 .\" ``/<number>trailing''
2163 .Li / Li \*[Lt] Va number Li \*[Gt]
2171 .Dq Li \&... Ns Va trailing
2175 The remote host name.
2177 The remote host name, up to the first
2180 The remote user name.
2187 uses the following environment variables.
2188 .Bl -tag -width "FTPSERVERPORT"
2190 Password to send in an anonymous
2196 Overrides the default operation mode.
2198 .Bl -tag -width "passive"
2204 automatic determination of passive or active (this is the default)
2213 Command-line prompt to use.
2217 .Sx COMMAND LINE PROMPT
2218 for more information.
2220 Command-line right side prompt to use.
2224 .Sx COMMAND LINE PROMPT
2225 for more information.
2227 Host to use as gate-ftp server when
2230 .It Ev FTPSERVERPORT
2231 Port to use when connecting to gate-ftp server when
2234 Default is port returned by a
2239 The value to send for the
2244 For default location of a
2246 file, if one exists.
2248 An alternate location of the
2252 Used by various commands to display files.
2255 if empty or not set.
2261 proxy to use when making
2264 (if not defined, use the standard
2270 for further notes about proxy use.
2274 proxy to use when making
2277 If proxy authentication is required and there is a username and
2278 password in this URL, they will automatically be used in the first
2279 attempt to authenticate to the proxy.
2283 URL characters are required in the username or password
2293 Note that the use of a username and password in
2297 may be incompatible with other programs that use it
2302 this is not used for interactive sessions, only for command-line
2305 A space or comma separated list of hosts (or domains) for which
2306 proxying is not to be used.
2307 Each entry may have an optional trailing ":port", which restricts
2308 the matching to connections to that port.
2310 .Sh EXTENDED PASSIVE MODE AND FIREWALLS
2311 Some firewall configurations do not allow
2313 to use extended passive mode.
2314 If you find that even a simple
2316 appears to hang after printing a message such as this:
2318 .Dl 229 Entering Extended Passive Mode (|||58551|)
2320 then you will need to disable extended passive mode with
2322 See the above section
2324 for an example of how to make this automatic.
2326 .Xr getservbyname 3 ,
2332 attempts to be compliant with:
2333 .Bl -tag -offset indent -width 8n
2335 .Em File Transfer Protocol
2337 .Em Requirements for Internet Hosts - Application and Support
2339 .Em How to Use Anonymous FTP
2341 .Em Feature negotiation mechanism for the File Transfer Protocol
2343 .Em FTP Extensions for IPv6 and NATs
2345 .Em Hypertext Transfer Protocol -- HTTP/1.1
2347 .Em Internet Message Format
2349 .Em Extensions to FTP
2351 .Em Uniform Resource Identifier (URI)
2359 Various features such as command line editing, context sensitive
2360 command and file completion, dynamic progress bar, automatic
2361 fetching of files and URLs, modification time preservation,
2362 transfer rate throttling, configurable command line prompt,
2363 and other enhancements over the standard
2371 .Aq lukem@NetBSD.org .
2373 IPv6 support was added by the WIDE/KAME project
2374 (but may not be present in all non-NetBSD versions of this program, depending
2375 if the operating system supports IPv6 in a similar manner to KAME).
2377 Correct execution of many commands depends upon proper behavior
2378 by the remote server.
2380 An error in the treatment of carriage returns
2383 ascii-mode transfer code
2385 This correction may result in incorrect transfers of binary files
2388 servers using the ascii type.
2389 Avoid this problem by using the binary image type.
2392 assumes that all IPv4 mapped addresses
2394 IPv6 addresses with a form like
2397 indicate IPv4 destinations which can be handled by
2400 However, in certain IPv6 network configurations, this assumption is not true.
2401 In such an environment, IPv4 mapped addresses must be passed to
2404 For example, if your site uses a SIIT translator for IPv6-to-IPv4 translation,
2406 is unable to support your configuration.