1 .\" $NetBSD: ftp.1,v 1.126 2008/05/13 09:33:36 wiz Exp $
3 .\" Copyright (c) 1996-2007 The NetBSD Foundation, Inc.
4 .\" All rights reserved.
6 .\" This code is derived from software contributed to The NetBSD Foundation
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\" notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\" notice, this list of conditions and the following disclaimer in the
16 .\" documentation and/or other materials provided with the distribution.
18 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 .\" POSSIBILITY OF SUCH DAMAGE.
31 .\" Copyright (c) 1985, 1989, 1990, 1993
32 .\" The Regents of the University of California. All rights reserved.
34 .\" Redistribution and use in source and binary forms, with or without
35 .\" modification, are permitted provided that the following conditions
37 .\" 1. Redistributions of source code must retain the above copyright
38 .\" notice, this list of conditions and the following disclaimer.
39 .\" 2. Redistributions in binary form must reproduce the above copyright
40 .\" notice, this list of conditions and the following disclaimer in the
41 .\" documentation and/or other materials provided with the distribution.
42 .\" 3. Neither the name of the University nor the names of its contributors
43 .\" may be used to endorse or promote products derived from this software
44 .\" without specific prior written permission.
46 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
47 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
48 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
49 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
50 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
51 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
52 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
53 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
54 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
55 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
58 .\" @(#)ftp.1 8.3 (Berkeley) 10/9/94
66 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.
293 Set the maximum transfer rate for
298 and if specified, the increment to
303 for more information.
304 .It Fl u Ar URL file Op \&.\&.\&.
305 Upload files on the command line to
309 is one of the ftp URL types as supported by auto-fetch
310 (with an optional target filename for single file uploads), and
312 is one or more local files to be uploaded.
318 overriding the default of enabled when output is to a terminal.
324 This is the default if output is to a terminal (and in the case of
327 is the foreground process).
330 to show all responses from the remote server, as well
331 as report on data transfer statistics.
334 The client host with which
336 is to communicate may be specified on the command line.
339 will immediately attempt to establish a connection to an
341 server on that host; otherwise,
343 will enter its command interpreter and await instructions
347 is awaiting commands from the user the prompt
349 is provided to the user.
350 The following commands are recognized
354 .It Ic \&! Op Ar command Op Ar args
355 Invoke an interactive shell on the local machine.
356 If there are arguments, the first is taken to be a command to execute
357 directly, with the rest of the arguments as its arguments.
358 .It Ic \&$ Ar macro-name Op Ar args
361 that was defined with the
364 Arguments are passed to the macro unglobbed.
365 .It Ic account Op Ar passwd
366 Supply a supplemental password required by a remote system for access
367 to resources once a login has been successfully completed.
368 If no argument is included, the user will be prompted for an account
369 password in a non-echoing input mode.
370 .It Ic append Ar local-file Op Ar remote-file
371 Append a local file to a file on the remote machine.
374 is left unspecified, the local file name is used in naming the
375 remote file after being altered by any
380 File transfer uses the current settings for
387 Set the file transfer
391 This is the default type.
393 Arrange that a bell be sounded after each file transfer
394 command is completed.
396 Set the file transfer
398 to support binary image transfer.
402 session with the remote server
405 An end of file will also terminate the session and exit.
407 Toggle remote computer file name case mapping during
415 is on (default is off), remote computer file names with all letters in
416 upper case are written in the local directory with the letters mapped
418 .It Ic \&cd Ar remote-directory
419 Change the working directory on the remote machine
421 .Ar remote-directory .
423 Change the remote machine working directory to the parent of the
424 current remote machine working directory.
425 .It Ic chmod Ar mode remote-file
426 Change the permission modes of the file
434 session with the remote server, and
435 return to the command interpreter.
436 Any defined macros are erased.
438 Toggle carriage return stripping during
439 ascii type file retrieval.
440 Records are denoted by a carriage return/linefeed sequence
441 during ascii type file transfer.
444 is on (the default), carriage returns are stripped from this
445 sequence to conform with the
447 single linefeed record
451 remote systems may contain single linefeeds;
452 when an ascii type transfer is made, these linefeeds may be
453 distinguished from a record delimiter only when
456 .It Ic delete Ar remote-file
459 on the remote machine.
460 .It Ic dir Op Ar remote-path Op Ar local-file
461 Print a listing of the contents of a
462 directory on the remote machine.
463 The listing includes any system-dependent information that the server
464 chooses to include; for example, most
467 output from the command
471 is left unspecified, the current working directory is used.
472 If interactive prompting is on,
474 will prompt the user to verify that the last argument is indeed the
475 target local file for receiving
478 If no local file is specified, or if
482 the output is sent to the terminal.
487 Toggle command line editing, and context sensitive command and file
489 This is automatically enabled if input is from a terminal, and
491 .It Ic epsv epsv4 epsv6
492 Toggle the use of the extended
496 commands on all IP, IPv4, and IPv6 connections respectively. First try
502 This is enabled by default.
503 If an extended command fails then this option will be temporarily
504 disabled for the duration of the current connection, or until
514 Display what features the remote server supports (using the
517 .It Ic fget Ar localfile
518 Retrieve the files listed in
520 which has one line per filename.
521 .It Ic form Ar format
522 Set the file transfer
526 The default (and only supported)
529 .It Ic ftp Ar host Op Ar port
532 .It Ic ftp_debug Op Ar ftp_debug-value
533 Toggle debugging mode.
536 is specified it is used to set the debugging level.
537 When debugging is on,
539 prints each command sent to the remote machine, preceded
542 .It Ic gate Op Ar host Op Ar port
543 Toggle gate-ftp mode, which used to connect through the
544 TIS FWTK and Gauntlet ftp proxies.
545 This will not be permitted if the gate-ftp server hasn't been set
546 (either explicitly by the user, or from the
548 environment variable).
552 then gate-ftp mode will be enabled, and the gate-ftp server will be set to
556 is also given, that will be used as the port to connect to on the
558 .It Ic get Ar remote-file Op Ar local-file
561 and store it on the local machine.
563 file name is not specified, it is given the same
564 name it has on the remote machine, subject to
565 alteration by the current
571 The current settings for
577 are used while transferring the file.
579 Toggle filename expansion for
585 If globbing is turned off with
587 the file name arguments
588 are taken literally and not expanded.
598 each remote file name is expanded
599 separately on the remote machine and the lists are not merged.
600 Expansion of a directory name is likely to be
601 different from expansion of the name of an ordinary file:
602 the exact result depends on the foreign operating system and ftp server,
603 and can be previewed by doing
604 .Ql mls remote-files \-
610 are not meant to transfer
611 entire directory subtrees of files.
615 archive of the subtree (in binary mode).
616 .It Ic hash Op Ar size
619 printing for each data block transferred.
620 The size of a data block defaults to 1024 bytes.
621 This can be changed by specifying
628 .It Ic help Op Ar command
629 Print an informative message about the meaning of
631 If no argument is given,
633 prints a list of the known commands.
634 .It Ic idle Op Ar seconds
635 Set the inactivity timer on the remote server to
640 is omitted, the current inactivity timer is printed.
644 .It Ic lcd Op Ar directory
645 Change the working directory on the local machine.
649 is specified, the user's home directory is used.
653 .It Ic lpage Ar local-file
656 with the program specified by the
660 Print the working directory on the local machine.
661 .It Ic \&ls Op Ar remote-path Op Ar local-file
664 .It Ic macdef Ar macro-name
666 Subsequent lines are stored as the macro
668 a null line (consecutive newline characters in a file or carriage
669 returns from the terminal) terminates macro input mode.
670 There is a limit of 16 macros and 4096 total characters in all
672 Macro names can be a maximum of 8 characters.
673 Macros are only applicable to the current session they are
674 defined within (or if defined outside a session, to the session
675 invoked with the next
677 command), and remain defined until a
680 To invoke a macro, use the
684 The macro processor interprets
688 as special characters.
691 followed by a number (or numbers) is replaced by the
692 corresponding argument on the macro invocation command line.
697 signals the macro processor that the executing macro is to be
701 is replaced by the first argument on the macro invocation command
702 line, on the second pass it is replaced by the second argument,
706 followed by any character is replaced by that character.
709 to prevent special treatment of the
711 .It Ic mdelete Op Ar remote-files
714 on the remote machine.
715 .It Ic mdir Ar remote-files local-file
718 except multiple remote files may be specified.
719 If interactive prompting is on,
721 will prompt the user to verify that the last argument is indeed the
722 target local file for receiving
725 .It Ic mget Ar remote-files
728 on the remote machine
731 for each file name thus produced.
734 for details on the filename expansion.
735 Resulting file names will then be processed according to
741 Files are transferred into the local working directory,
742 which can be changed with
744 new local directories can be created with
745 .Ql "\&! mkdir directory" .
746 .It Ic mkdir Ar directory-name
747 Make a directory on the remote machine.
748 .It Ic mls Ar remote-files local-file
751 except multiple remote files may be specified,
755 If interactive prompting is on,
757 will prompt the user to verify that the last argument is indeed the
758 target local file for receiving
761 .It Ic mlsd Op Ar remote-path
762 Display the contents of
764 (which should default to the current directory if not given)
765 in a machine-parsable form, using
767 The format of display can be changed with
768 .Sq "remopts mlst ..." .
769 .It Ic mlst Op Ar remote-path
770 Display the details about
772 (which should default to the current directory if not given)
773 in a machine-parsable form, using
775 The format of display can be changed with
776 .Sq "remopts mlst ..." .
777 .It Ic mode Ar mode-name
778 Set the file transfer
782 The default (and only supported)
785 .It Ic modtime Ar remote-file
786 Show the last modification time of the file on the remote machine, in
792 .It Ic mput Ar local-files
793 Expand wild cards in the list of local files given as arguments
796 for each file in the resulting list.
799 for details of filename expansion.
800 Resulting file names will then be processed according to
805 .It Ic mreget Ar remote-files
812 .It Ic msend Ar local-files
815 .It Ic newer Ar remote-file Op Ar local-file
816 Get the file only if the modification time of the remote file is more
817 recent that the file on the current system.
819 exist on the current system, the remote file is considered
821 Otherwise, this command is identical to
823 .It Ic nlist Op Ar remote-path Op Ar local-file
826 .It Ic nmap Op Ar inpattern outpattern
827 Set or unset the filename mapping mechanism.
828 If no arguments are specified, the filename mapping mechanism is unset.
829 If arguments are specified, remote filenames are mapped during
833 commands issued without a specified remote target filename.
834 If arguments are specified, local filenames are mapped during
838 commands issued without a specified local target filename.
839 This command is useful when connecting to a
842 with different file naming conventions or practices.
843 The mapping follows the pattern set by
848 is a template for incoming filenames (which may have already been
849 processed according to the
854 Variable templating is accomplished by including the
864 to prevent this special treatment of the
867 All other characters are treated literally, and are used to determine the
873 $1.$2 and the remote file name "mydata.data", $1 would have the value
874 "mydata", and $2 would have the value "data".
877 determines the resulting mapped filename.
883 are replaced by any value resulting from the
888 is replaced by the original filename.
889 Additionally, the sequence
890 .Dq Op Ar seq1 , Ar seq2
895 is not a null string; otherwise it is replaced by
897 For example, the command
899 .Bd -literal -offset indent -compact
900 nmap $1.$2.$3 [$1,$2].[$2,file]
904 the output filename "myfile.data" for input filenames "myfile.data" and
905 "myfile.data.old", "myfile.file" for the input filename "myfile", and
906 "myfile.myfile" for the input filename ".myfile".
907 Spaces may be included in
910 .Dl nmap $1 sed "s/ *$//" \*[Gt] $1
913 character to prevent special treatment
921 .It Ic ntrans Op Ar inchars Op Ar outchars
922 Set or unset the filename character translation mechanism.
923 If no arguments are specified, the filename character
924 translation mechanism is unset.
925 If arguments are specified, characters in
926 remote filenames are translated during
930 commands issued without a specified remote target filename.
931 If arguments are specified, characters in
932 local filenames are translated during
936 commands issued without a specified local target filename.
937 This command is useful when connecting to a
940 with different file naming conventions or practices.
941 Characters in a filename matching a character in
943 are replaced with the corresponding character in
945 If the character's position in
947 is longer than the length of
949 the character is deleted from the file name.
950 .It Ic open Ar host Op Ar port
951 Establish a connection to the specified
955 An optional port number may be supplied,
958 will attempt to contact an
963 option is on (default),
965 will also attempt to automatically log the user in to
972 and display with the program specified by the
975 .It Ic passive Op Cm auto
976 Toggle passive mode (if no arguments are given).
983 If passive mode is turned on (default),
987 command for all data connections instead of a
992 command requests that the remote server open a port for the data connection
993 and return the address of that port.
994 The remote server listens on that port and the client connects to it.
995 When using the more traditional
997 command, the client listens on a port and sends that address to the remote
998 server, who connects back to it.
999 Passive mode is useful when using
1001 through a gateway router or host that controls the directionality of
1005 servers are required to support the
1010 .It Ic pdir Op Ar remote-path
1013 .Op Ar remote-path ,
1014 and display the result with the program specified by the
1017 .It Ic pls Op Ar remote-path
1020 .Op Ar remote-path ,
1021 and display the result with the program specified by the
1024 .It Ic pmlsd Op Ar remote-path
1027 .Op Ar remote-path ,
1028 and display the result with the program specified by the
1032 Toggle preservation of modification times on retrieved files.
1034 Toggle display of transfer progress bar.
1035 The progress bar will be disabled for a transfer that has
1039 or a command that starts with
1042 .Sx FILE NAMING CONVENTIONS
1043 for more information.
1049 Toggle interactive prompting.
1050 Interactive prompting
1051 occurs during multiple file transfers to allow the
1052 user to selectively retrieve or store files.
1053 If prompting is turned off (default is on), any
1057 will transfer all files, and any
1059 will delete all files.
1061 When prompting is on, the following commands are available at a prompt:
1062 .Bl -tag -width 2n -offset indent
1066 to the current file, and automatically answer
1068 to any remaining files for the current command.
1072 and do not transfer the file.
1076 to the current file, and turn off prompt mode
1081 Terminate the current operation.
1085 and transfer the file.
1087 Display a help message.
1090 Any other response will answer
1092 to the current file.
1093 .It Ic proxy Ar ftp-command
1094 Execute an ftp command on a secondary control connection.
1095 This command allows simultaneous connection to two remote
1097 servers for transferring files between the two servers.
1100 command should be an
1102 to establish the secondary control connection.
1103 Enter the command "proxy ?" to see other
1105 commands executable on the secondary connection.
1106 The following commands behave differently when prefaced by
1109 will not define new macros during the auto-login process,
1111 will not erase existing macro definitions,
1115 transfer files from the host on the primary control connection
1116 to the host on the secondary control connection, and
1121 transfer files from the host on the secondary control connection
1122 to the host on the primary control connection.
1123 Third party file transfers depend upon support of the
1127 command by the server on the secondary control connection.
1128 .It Ic put Ar local-file Op Ar remote-file
1129 Store a local file on the remote machine.
1132 is left unspecified, the local file name is used
1133 after processing according to any
1138 in naming the remote file.
1139 File transfer uses the
1140 current settings for
1147 Print the name of the current working directory on the remote
1152 .It Ic quote Ar arg1 arg2 ...
1153 The arguments specified are sent, verbatim, to the remote
1157 .Ic rate Ar direction
1158 .Op Ar maximum Op Ar increment
1160 Throttle the maximum transfer rate to
1165 is 0, disable the throttle.
1169 .Bl -tag -width "all" -offset indent -compact
1179 can be modified on the fly by
1181 bytes (default: 1024) each time a given signal is received:
1183 .Bl -tag -width "SIGUSR1" -offset indent
1196 The result must be a positive number.
1201 is not supplied, the current throttle rates are displayed.
1205 is not yet implemented for ascii mode transfers.
1206 .It Ic rcvbuf Ar size
1207 Set the size of the socket receive buffer to
1209 .It Ic recv Ar remote-file Op Ar local-file
1212 .It Ic reget Ar remote-file Op Ar local-file
1223 a partially transferred copy of
1226 is continued from the apparent point of failure.
1228 is useful when transferring very large files over networks that
1229 are prone to dropping connections.
1230 .It Ic remopts Ar command Op Ar command-options
1231 Set options on the remote
1237 (whose absence is handled on a command-specific basis).
1240 commands known to support options include:
1246 .It Ic rename Op Ar from Op Ar to
1249 on the remote machine, to the file
1253 This command re-synchronizes command/reply sequencing with the remote
1256 Resynchronization may be necessary following a violation of the
1258 protocol by the remote server.
1259 .It Ic restart Ar marker
1260 Restart the immediately following
1269 systems, marker is usually a byte
1270 offset into the file.
1271 .It Ic rhelp Op Ar command-name
1272 Request help from the remote
1277 is specified it is supplied to the server as well.
1278 .It Ic rmdir Ar directory-name
1279 Delete a directory on the remote machine.
1280 .It Ic rstatus Op Ar remote-file
1281 With no arguments, show status of remote machine.
1284 is specified, show status of
1288 Toggle storing of files on the local system with unique filenames.
1289 If a file already exists with a name equal to the target
1290 local filename for a
1294 command, a ".1" is appended to the name.
1295 If the resulting name matches another existing file,
1296 a ".2" is appended to the original name.
1297 If this process continues up to ".99", an error
1298 message is printed, and the transfer does not take place.
1299 The generated unique filename will be reported.
1302 will not affect local files generated from a shell command
1304 The default value is off.
1305 .It Ic send Ar local-file Op Ar remote-file
1314 will attempt to use a
1316 command when establishing
1317 a connection for each data transfer.
1320 commands can prevent delays
1321 when performing multiple file transfers.
1326 will use the default data port.
1329 commands is disabled, no attempt will be made to use
1331 commands for each data transfer.
1335 implementations which do ignore
1337 commands but, incorrectly, indicate they've been accepted.
1338 .It Ic set Op Ar option Ar value
1347 are not given, display all of the options and their values.
1348 The currently supported options are:
1349 .Bl -tag -width "http_proxy" -offset indent
1372 .It Ic site Ar arg1 arg2 ...
1373 The arguments specified are sent, verbatim, to the remote
1378 .It Ic size Ar remote-file
1382 .It Ic sndbuf Ar size
1383 Set the size of the socket send buffer to
1386 Show the current status of
1388 .It Ic struct Ar struct-name
1389 Set the file transfer
1393 The default (and only supported)
1397 Toggle storing of files on remote machine under unique file names.
1405 successful completion.
1406 The remote server will report unique name.
1407 Default value is off.
1409 Show the type of operating system running on the remote machine.
1411 Set the file transfer type to that needed to
1419 Toggle packet tracing.
1420 .It Ic type Op Ar type-name
1421 Set the file transfer
1425 If no type is specified, the current type
1427 The default type is network
1429 .It Ic umask Op Ar newmask
1430 Set the default umask on the remote server to
1434 is omitted, the current umask is printed.
1435 .It Ic unset Ar option
1440 for more information.
1441 .It Ic usage Ar command
1442 Print the usage message for
1445 .Ic user Ar user-name
1446 .Op Ar password Op Ar account
1448 Identify yourself to the remote
1453 is not specified and the server requires it,
1455 will prompt the user for it (after disabling local echo).
1458 field is not specified, and the
1461 requires it, the user will be prompted for it.
1464 field is specified, an account command will
1465 be relayed to the remote server after the login sequence
1466 is completed if the remote server did not require it
1472 disabled, this process is done automatically on initial connection to the
1476 Toggle verbose mode.
1477 In verbose mode, all responses from
1480 server are displayed to the user.
1482 if verbose is on, when a file transfer completes, statistics
1483 regarding the efficiency of the transfer are reported.
1486 .It Ic xferbuf Ar size
1487 Set the size of the socket send and receive buffers to
1489 .It Ic \&? Op Ar command
1494 Command arguments which have embedded spaces may be quoted with
1499 Commands which toggle settings can take an explicit
1503 argument to force the setting appropriately.
1505 Commands which take a byte count as an argument
1511 support an optional suffix on the argument which changes the
1512 interpretation of the argument.
1513 Supported suffixes are:
1514 .Bl -tag -width 3n -offset indent -compact
1516 Causes no modification.
1519 Kilo; multiply the argument by 1024
1521 Mega; multiply the argument by 1048576
1523 Giga; multiply the argument by 1073741824
1536 signal whilst a transfer is in progress, the current transfer rate
1537 statistics will be written to the standard error output, in the
1538 same format as the standard completion message.
1539 .Sh AUTO-FETCHING FILES
1540 In addition to standard commands, this version of
1542 supports an auto-fetch feature.
1543 To enable auto-fetch, simply pass the list of hostnames/files
1544 on the command line.
1546 The following formats are valid syntax for an auto-fetch element:
1547 .Bl -tag -width "FOO "
1548 .\" [user@]host:[path][/]
1563 contains a glob character and globbing is enabled,
1566 then the equivalent of
1570 If the directory component of
1572 contains no globbing characters,
1573 it is stored locally with the name basename (see
1577 in the current directory.
1578 Otherwise, the full remote name is used as the local name,
1579 relative to the local root directory.
1580 .\" ftp://[user[:password]@]host[:port]/path[/][;type=X]
1585 .Op Li \&: Ar password
1587 .Ar host Oo Li \&: Ar port Oc
1595 URL, retrieved using the
1600 Otherwise, transfer the URL using
1602 via the proxy defined in
1603 .Ic "set ftp_proxy" .
1612 if supplied, otherwise prompt the user for one.
1618 is supplied, then the transfer type will take place as
1619 ascii or binary (respectively).
1620 The default transfer type is binary.
1622 In order to be compliant with
1629 auto-fetch URL as follows:
1634 immediately after the
1635 .Ar host Ns Oo Li \&: Ns Ar port Oc
1636 is interpreted as a separator before the
1638 and not as part of the
1645 .So Li / Sc Ns -separated
1646 list of name components.
1647 For all but the last such component,
1649 performs the equivalent of a
1652 For the last path component,
1654 performs the equivalent of a
1658 Empty name components,
1665 at the beginning of the
1667 will cause the equivalent of a
1669 command without a directory name.
1670 This is unlikely to be useful.
1677 within the path components are decoded, with
1679 representing a character code in hexadecimal.
1680 This decoding takes place after the
1682 has been split into components,
1683 but before each component is used in the equivalent of a
1688 Some often-used codes are
1698 The above interpretation has the following consequences:
1701 The path is interpreted relative to the
1702 default login directory of the specified user or of the
1707 directory is required, use a leading path of
1709 If a user's home directory is required (and the remote server supports
1710 the syntax), use a leading path of
1712 For example, to retrieve
1721 .Dq ftp://myname:mypass@localhost/%2fetc/motd
1727 commands can be controlled by careful choice of
1734 For example, the following URLs correspond to the
1735 equivalents of the indicated commands:
1736 .Bl -tag -width "ftp://host/%2Fdir1%2Fdir2%2Ffile"
1737 .It ftp://host/dir1/dir2/file
1741 .It ftp://host/%2Fdir1/dir2/file
1745 .It ftp://host/dir1%2Fdir2/file
1746 .Dq "cd dir1/dir2" ,
1748 .It ftp://host/%2Fdir1%2Fdir2/file
1749 .Dq "cd /dir1/dir2" ,
1751 .It ftp://host/dir1%2Fdir2%2Ffile
1752 .Dq "get dir1/dir2/file" .
1753 .It ftp://host/%2Fdir1%2Fdir2%2Ffile
1754 .Dq "get /dir1/dir2/file" .
1757 You must have appropriate access permission for each of the
1758 intermediate directories that is used in the equivalent of a
1762 .\" http://[user[:password]@]host[:port]/path
1767 .Op Li \&: Ar password
1769 .Ar host Oo Li \&: Ar port Oc
1775 URL, retrieved using the
1779 .Ic "set http_proxy"
1780 is defined, it is used as a URL to an
1785 authorization is required to retrieve
1791 is in the URL, use them for the first attempt to authenticate.
1795 .Li file:/// Ar path
1798 A local URL, copied from
1808 Display information regarding
1810 no file is retrieved for this auto-fetched element.
1811 Supported values include:
1812 .Bl -tag -width "about:version"
1816 .It Li about:version
1819 Useful to provide when reporting problems.
1823 Unless noted otherwise above, and
1825 is not given, the file is stored in the current directory as the
1831 redirect is received, the fetch is retried using the new target URL
1832 supplied by the server, with a corresponding new
1836 is recommended, to avoid writing to unexpected file names.
1838 If a classic format or an
1840 URL format has a trailing
1846 will connect to the site and
1848 to the directory given as the path, and leave the user in interactive
1849 mode ready for further input.
1850 This will not work if
1856 transfers use HTTP 1.1.
1861 transfers use HTTP 1.0.
1865 is given, all auto-fetches that don't go via the
1869 proxies will be restarted.
1872 this is implemented by using
1878 this is implemented by using the
1883 If WWW or proxy WWW authentication is required, you will be prompted
1884 to enter a username and password to authenticate with.
1886 When specifying IPv6 numeric addresses in a URL, you need to
1887 surround the address in square brackets.
1889 .Dq ftp://[::1]:21/ .
1890 This is because colons are used in IPv6 numeric address as well as
1891 being the separator for the port number.
1892 .Sh ABORTING A FILE TRANSFER
1893 To abort a file transfer, use the terminal interrupt key
1895 Sending transfers will be immediately halted.
1896 Receiving transfers will be halted by sending an
1900 command to the remote server, and discarding any further data received.
1901 The speed at which this is accomplished depends upon the remote
1902 server's support for
1905 If the remote server does not support the
1907 command, the prompt will not appear until the remote server has completed
1908 sending the requested file.
1910 If the terminal interrupt key sequence is used whilst
1912 is awaiting a reply from the remote server for the ABOR processing,
1913 then the connection will be closed.
1914 This is different from the traditional behaviour (which ignores the
1915 terminal interrupt during this phase), but is considered more useful.
1916 .Sh FILE NAMING CONVENTIONS
1917 Files specified as arguments to
1919 commands are processed according to the following rules.
1928 (for writing) is used.
1930 If the first character of the file name is
1933 remainder of the argument is interpreted as a shell command.
1935 then forks a shell, using
1937 with the argument supplied, and reads (writes) from the stdout
1939 If the shell command includes spaces, the argument
1940 must be quoted; e.g.
1941 .Dq Qq Li \&| ls\ \-lt .
1943 useful example of this mechanism is:
1944 .Dq Li dir \&"\&" \&|more .
1946 Failing the above checks, if
1948 is enabled, local file names are expanded according to the rules
1956 command expects a single local file (e.g.
1958 only the first filename generated by the "globbing" operation is used.
1964 commands with unspecified local file names, the local filename is
1965 the remote filename, which may be altered by a
1971 The resulting filename may then be altered if
1979 commands with unspecified remote file names, the remote filename is
1980 the local filename, which may be altered by a
1985 The resulting filename may then be altered by the remote server if
1989 .Sh FILE TRANSFER PARAMETERS
1992 specification specifies many parameters which may affect a file transfer.
2008 supports the ascii and image types of file transfer,
2009 plus local byte size 8 for
2014 supports only the default values for the remaining
2015 file transfer parameters:
2023 file contains login and initialization information
2024 used by the auto-login process.
2025 It resides in the user's home directory,
2026 unless overridden with the
2028 option, or specified in the
2030 environment variable.
2031 The following tokens are recognized; they may be separated by spaces,
2033 .Bl -tag -width password
2034 .It Ic machine Ar name
2035 Identify a remote machine
2037 The auto-login process searches the
2041 token that matches the remote machine specified on the
2043 command line or as an
2046 Once a match is made, the subsequent
2048 tokens are processed,
2049 stopping when the end of file is reached or another
2053 token is encountered.
2061 There can be only one
2063 token, and it must be after all
2066 This is normally used as:
2068 .Dl default login anonymous password user@site
2070 thereby giving the user an automatic anonymous
2073 machines not specified in
2075 This can be overridden
2078 flag to disable auto-login.
2079 .It Ic login Ar name
2080 Identify a user on the remote machine.
2081 If this token is present, the auto-login process will initiate
2082 a login using the specified
2084 .It Ic password Ar string
2086 If this token is present, the auto-login process will supply the
2087 specified string if the remote server requires a password as part
2088 of the login process.
2089 Note that if this token is present in the
2091 file for any user other
2095 will abort the auto-login process if the
2098 anyone besides the user.
2099 .It Ic account Ar string
2100 Supply an additional account password.
2101 If this token is present, the auto-login process will supply the
2102 specified string if the remote server requires an additional
2103 account password, or the auto-login process will initiate an
2105 command if it does not.
2106 .It Ic macdef Ar name
2108 This token functions like the
2112 A macro is defined with the specified name; its contents begin with the
2115 line and continue until a blank line (consecutive new-line
2116 characters) is encountered.
2117 Like the other tokens in the
2121 is applicable only to the
2123 definition preceding it.
2126 entry cannot be used by multiple
2128 definitions; rather, it must be defined following each
2130 it is intended to be used with.
2133 is defined, it is automatically executed as the last step in the
2136 .Bd -literal -offset indent
2142 followed by a blank line.
2144 .Sh COMMAND LINE EDITING
2146 supports interactive command line editing, via the
2149 It is enabled with the
2151 command, and is enabled by default if input is from a tty.
2152 Previous lines can be recalled and edited with the arrow keys,
2153 and other GNU Emacs-style editing keys may be used as well.
2157 library is configured with a
2161 for more information.
2163 An extra key binding is available to
2165 to provide context sensitive command and filename completion
2166 (including remote file completion).
2167 To use this, bind a key to the
2171 By default, this is bound to the TAB key.
2172 .Sh COMMAND LINE PROMPT
2175 displays a command line prompt of
2178 This can be changed with the
2182 A prompt can be displayed on the right side of the screen (after the
2183 command input) with the
2187 The following formatting sequences are replaced by the given
2189 .Bl -tag -width "%% " -offset indent
2191 The current remote working directory.
2192 .\" %c[[0]n], %.[[0]n]
2196 .Op Oo Li 0 Oc Ar n Ns ,
2201 The trailing component of the current remote working directory, or
2203 trailing components if a digit
2210 the number of skipped components precede the trailing component(s) in
2212 .\" ``/<number>trailing''
2215 .Li / Li \*[Lt] Va number Li \*[Gt]
2223 .Dq Li \&... Ns Va trailing
2227 The remote host name.
2229 The remote host name, up to the first
2232 The remote user name.
2239 uses the following environment variables.
2240 .Bl -tag -width "FTPSERVERPORT"
2242 Password to send in an anonymous
2248 Overrides the default operation mode.
2250 .Bl -tag -width "passive"
2256 automatic determination of passive or active (this is the default)
2265 Command-line prompt to use.
2269 .Sx COMMAND LINE PROMPT
2270 for more information.
2272 Command-line right side prompt to use.
2276 .Sx COMMAND LINE PROMPT
2277 for more information.
2279 Host to use as gate-ftp server when
2282 .It Ev FTPSERVERPORT
2283 Port to use when connecting to gate-ftp server when
2286 Default is port returned by a
2291 The value to send for the
2296 For default location of a
2298 file, if one exists.
2300 An alternate location of the
2304 Used by various commands to display files.
2307 if empty or not set.
2313 proxy to use when making
2316 (if not defined, use the standard
2322 for further notes about proxy use.
2326 proxy to use when making
2329 If proxy authentication is required and there is a username and
2330 password in this URL, they will automatically be used in the first
2331 attempt to authenticate to the proxy.
2335 URL characters are required in the username or password
2345 Note that the use of a username and password in
2349 may be incompatible with other programs that use it
2354 this is not used for interactive sessions, only for command-line
2357 A space or comma separated list of hosts (or domains) for which
2358 proxying is not to be used.
2359 Each entry may have an optional trailing ":port", which restricts
2360 the matching to connections to that port.
2362 .Sh EXTENDED PASSIVE MODE AND FIREWALLS
2363 Some firewall configurations do not allow
2365 to use extended passive mode.
2366 If you find that even a simple
2368 appears to hang after printing a message such as this:
2370 .Dl 229 Entering Extended Passive Mode (|||58551|)
2372 then you will need to disable extended passive mode with
2374 See the above section
2376 for an example of how to make this automatic.
2378 .Xr getservbyname 3 ,
2384 attempts to be compliant with:
2385 .Bl -tag -offset indent -width 8n
2387 .Em File Transfer Protocol
2389 .Em Requirements for Internet Hosts - Application and Support
2391 .Em How to Use Anonymous FTP
2393 .Em Feature negotiation mechanism for the File Transfer Protocol
2395 .Em FTP Extensions for IPv6 and NATs
2397 .Em Hypertext Transfer Protocol -- HTTP/1.1
2399 .Em Internet Message Format
2401 .Em Extensions to FTP
2403 .Em Uniform Resource Identifier (URI)
2411 Various features such as command line editing, context sensitive
2412 command and file completion, dynamic progress bar, automatic
2413 fetching of files and URLs, modification time preservation,
2414 transfer rate throttling, configurable command line prompt,
2415 and other enhancements over the standard
2423 .Aq lukem@NetBSD.org .
2425 IPv6 support was added by the WIDE/KAME project
2426 (but may not be present in all non-NetBSD versions of this program, depending
2427 if the operating system supports IPv6 in a similar manner to KAME).
2429 Correct execution of many commands depends upon proper behavior
2430 by the remote server.
2432 An error in the treatment of carriage returns
2435 ascii-mode transfer code
2437 This correction may result in incorrect transfers of binary files
2440 servers using the ascii type.
2441 Avoid this problem by using the binary image type.
2444 assumes that all IPv4 mapped addresses
2446 IPv6 addresses with a form like
2449 indicate IPv4 destinations which can be handled by
2452 However, in certain IPv6 network configurations, this assumption is not true.
2453 In such an environment, IPv4 mapped addresses must be passed to
2456 For example, if your site uses a SIIT translator for IPv6-to-IPv4 translation,
2458 is unable to support your configuration.