1 .\" $NetBSD: ftp.1,v 1.129 2009/05/04 19:47:09 wiz Exp $
3 .\" Copyright (c) 1996-2008 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
65 .Nd Internet file transfer program
68 .Op Fl 46AadefginpRtVv
86 .\" [-T dir,max[,inc]]
98 .\" [[user@]host [port]]
100 .Oo Ar user Ns Li \&@ Oc Ns Ar host
105 .\" [[user@]host:[path][/]]
124 .\" [ftp://[user[:password]@]host[:port]/path[/]]
129 .Op Li \&: Ar password
131 .Ar host Oo Li \&: Ar port Oc
139 .\" [http://[user[:password]@]host[:port]/path]
144 .Op Li \&: Ar password
146 .Ar host Oo Li \&: Ar port Oc
159 is the user interface to the Internet standard File Transfer Protocol.
160 The program allows a user to transfer files to and from a
163 The last five arguments will fetch a file using the
167 protocols, or by direct copying, into the current directory.
168 This is ideal for scripts.
170 .Sx AUTO-FETCHING FILES
171 below for more information.
173 Options may be specified at the command line, or to the
179 to only use IPv4 addresses.
183 to only use IPv6 addresses.
185 Force active mode ftp.
188 will try to use passive mode ftp and fall back to active mode
189 if passive is not supported by the server.
192 to always use an active connection.
193 It is only useful for connecting to very old servers that do not
194 implement passive mode properly.
198 to bypass normal login procedure, and use an anonymous login instead.
202 Disables command line editing.
203 This is useful for Emacs ange-ftp mode.
205 Forces a cache reload for transfers that go through the
211 Disables file name globbing.
213 Turns off interactive prompting during
214 multiple file transfers.
222 for more information.
228 upon initial connection for non auto-fetch transfers.
229 If auto-login is enabled,
233 (see below) file in the user's home directory for an entry describing
234 an account on the remote machine.
237 will prompt for the remote machine login name (default is the user
238 identity on the local machine), and, if necessary, prompt for a password
239 and an account with which to login.
240 To override the auto-login for auto-fetch transfers, specify the
241 username (and optionally, password) as appropriate.
243 When auto-fetching files, save the contents in
246 is parsed according to the
247 .Sx FILE NAMING CONVENTIONS
253 or doesn't start with
255 then only the first file specified will be retrieved into
257 all other files will be retrieved into the basename of their
260 Sets the port number to
263 Enable passive mode operation for use behind connection filtering firewalls.
264 This option has been deprecated as
266 now tries to use passive mode by default, falling back to active mode
267 if the server does not support passive connections.
269 Quit if the connection has stalled for
273 Restart all non-proxied auto-fetches.
275 Retry the connection attempt if it failed, pausing for
281 as the local IP address for all connections.
283 Enables packet tracing.
284 .It Fl T Ar direction Ns , Ns Ar maximum Ns Oo , Ns Ar increment Oc
285 Set the maximum transfer rate for
290 and if specified, the increment to
295 for more information.
296 .It Fl u Ar URL file Op \&.\&.\&.
297 Upload files on the command line to
301 is one of the ftp URL types as supported by auto-fetch
302 (with an optional target filename for single file uploads), and
304 is one or more local files to be uploaded.
310 overriding the default of enabled when output is to a terminal.
316 This is the default if output is to a terminal (and in the case of
319 is the foreground process).
322 to show all responses from the remote server, as well
323 as report on data transfer statistics.
326 The client host with which
328 is to communicate may be specified on the command line.
331 will immediately attempt to establish a connection to an
333 server on that host; otherwise,
335 will enter its command interpreter and await instructions
339 is awaiting commands from the user the prompt
341 is provided to the user.
342 The following commands are recognized
346 .It Ic \&! Op Ar command Op Ar args
347 Invoke an interactive shell on the local machine.
348 If there are arguments, the first is taken to be a command to execute
349 directly, with the rest of the arguments as its arguments.
350 .It Ic \&$ Ar macro-name Op Ar args
353 that was defined with the
356 Arguments are passed to the macro unglobbed.
357 .It Ic account Op Ar passwd
358 Supply a supplemental password required by a remote system for access
359 to resources once a login has been successfully completed.
360 If no argument is included, the user will be prompted for an account
361 password in a non-echoing input mode.
362 .It Ic append Ar local-file Op Ar remote-file
363 Append a local file to a file on the remote machine.
366 is left unspecified, the local file name is used in naming the
367 remote file after being altered by any
372 File transfer uses the current settings for
379 Set the file transfer
383 This is the default type.
385 Arrange that a bell be sounded after each file transfer
386 command is completed.
388 Set the file transfer
390 to support binary image transfer.
394 session with the remote server
397 An end of file will also terminate the session and exit.
399 Toggle remote computer file name case mapping during
407 is on (default is off), remote computer file names with all letters in
408 upper case are written in the local directory with the letters mapped
410 .It Ic \&cd Ar remote-directory
411 Change the working directory on the remote machine
413 .Ar remote-directory .
415 Change the remote machine working directory to the parent of the
416 current remote machine working directory.
417 .It Ic chmod Ar mode remote-file
418 Change the permission modes of the file
426 session with the remote server, and
427 return to the command interpreter.
428 Any defined macros are erased.
430 Toggle carriage return stripping during
431 ascii type file retrieval.
432 Records are denoted by a carriage return/linefeed sequence
433 during ascii type file transfer.
436 is on (the default), carriage returns are stripped from this
437 sequence to conform with the
439 single linefeed record
443 remote systems may contain single linefeeds;
444 when an ascii type transfer is made, these linefeeds may be
445 distinguished from a record delimiter only when
448 .It Ic delete Ar remote-file
451 on the remote machine.
452 .It Ic dir Op Ar remote-path Op Ar local-file
453 Print a listing of the contents of a
454 directory on the remote machine.
455 The listing includes any system-dependent information that the server
456 chooses to include; for example, most
459 output from the command
463 is left unspecified, the current working directory is used.
464 If interactive prompting is on,
466 will prompt the user to verify that the last argument is indeed the
467 target local file for receiving
470 If no local file is specified, or if
474 the output is sent to the terminal.
479 Toggle command line editing, and context sensitive command and file
481 This is automatically enabled if input is from a terminal, and
483 .It Ic epsv epsv4 epsv6
484 Toggle the use of the extended
488 commands on all IP, IPv4, and IPv6 connections respectively.
495 This is enabled by default.
496 If an extended command fails then this option will be temporarily
497 disabled for the duration of the current connection, or until
507 Display what features the remote server supports (using the
510 .It Ic fget Ar localfile
511 Retrieve the files listed in
513 which has one line per filename.
514 .It Ic form Ar format
515 Set the file transfer
519 The default (and only supported)
522 .It Ic ftp Ar host Op Ar port
525 .It Ic ftp_debug Op Ar ftp_debug-value
526 Toggle debugging mode.
529 is specified it is used to set the debugging level.
530 When debugging is on,
532 prints each command sent to the remote machine, preceded
535 .It Ic gate Op Ar host Op Ar port
536 Toggle gate-ftp mode, which used to connect through the
537 TIS FWTK and Gauntlet ftp proxies.
538 This will not be permitted if the gate-ftp server hasn't been set
539 (either explicitly by the user, or from the
541 environment variable).
545 then gate-ftp mode will be enabled, and the gate-ftp server will be set to
549 is also given, that will be used as the port to connect to on the
551 .It Ic get Ar remote-file Op Ar local-file
554 and store it on the local machine.
556 file name is not specified, it is given the same
557 name it has on the remote machine, subject to
558 alteration by the current
564 The current settings for
570 are used while transferring the file.
572 Toggle filename expansion for
578 If globbing is turned off with
580 the file name arguments
581 are taken literally and not expanded.
591 each remote file name is expanded
592 separately on the remote machine and the lists are not merged.
593 Expansion of a directory name is likely to be
594 different from expansion of the name of an ordinary file:
595 the exact result depends on the foreign operating system and ftp server,
596 and can be previewed by doing
597 .Ql mls remote-files \-
603 are not meant to transfer
604 entire directory subtrees of files.
608 archive of the subtree (in binary mode).
609 .It Ic hash Op Ar size
612 printing for each data block transferred.
613 The size of a data block defaults to 1024 bytes.
614 This can be changed by specifying
621 .It Ic help Op Ar command
622 Print an informative message about the meaning of
624 If no argument is given,
626 prints a list of the known commands.
627 .It Ic idle Op Ar seconds
628 Set the inactivity timer on the remote server to
633 is omitted, the current inactivity timer is printed.
637 .It Ic lcd Op Ar directory
638 Change the working directory on the local machine.
642 is specified, the user's home directory is used.
646 .It Ic lpage Ar local-file
649 with the program specified by the
653 Print the working directory on the local machine.
654 .It Ic \&ls Op Ar remote-path Op Ar local-file
657 .It Ic macdef Ar macro-name
659 Subsequent lines are stored as the macro
661 a null line (consecutive newline characters in a file or carriage
662 returns from the terminal) terminates macro input mode.
663 There is a limit of 16 macros and 4096 total characters in all
665 Macro names can be a maximum of 8 characters.
666 Macros are only applicable to the current session they are
667 defined within (or if defined outside a session, to the session
668 invoked with the next
670 command), and remain defined until a
673 To invoke a macro, use the
677 The macro processor interprets
681 as special characters.
684 followed by a number (or numbers) is replaced by the
685 corresponding argument on the macro invocation command line.
690 signals the macro processor that the executing macro is to be
694 is replaced by the first argument on the macro invocation command
695 line, on the second pass it is replaced by the second argument,
699 followed by any character is replaced by that character.
702 to prevent special treatment of the
704 .It Ic mdelete Op Ar remote-files
707 on the remote machine.
708 .It Ic mdir Ar remote-files local-file
711 except multiple remote files may be specified.
712 If interactive prompting is on,
714 will prompt the user to verify that the last argument is indeed the
715 target local file for receiving
718 .It Ic mget Ar remote-files
721 on the remote machine
724 for each file name thus produced.
727 for details on the filename expansion.
728 Resulting file names will then be processed according to
734 Files are transferred into the local working directory,
735 which can be changed with
737 new local directories can be created with
738 .Ql "\&! mkdir directory" .
739 .It Ic mkdir Ar directory-name
740 Make a directory on the remote machine.
741 .It Ic mls Ar remote-files local-file
744 except multiple remote files may be specified,
748 If interactive prompting is on,
750 will prompt the user to verify that the last argument is indeed the
751 target local file for receiving
754 .It Ic mlsd Op Ar remote-path
755 Display the contents of
757 (which should default to the current directory if not given)
758 in a machine-parsable form, using
760 The format of display can be changed with
761 .Sq "remopts mlst ..." .
762 .It Ic mlst Op Ar remote-path
763 Display the details about
765 (which should default to the current directory if not given)
766 in a machine-parsable form, using
768 The format of display can be changed with
769 .Sq "remopts mlst ..." .
770 .It Ic mode Ar mode-name
771 Set the file transfer
775 The default (and only supported)
778 .It Ic modtime Ar remote-file
779 Show the last modification time of the file on the remote machine, in
785 .It Ic mput Ar local-files
786 Expand wild cards in the list of local files given as arguments
789 for each file in the resulting list.
792 for details of filename expansion.
793 Resulting file names will then be processed according to
798 .It Ic mreget Ar remote-files
805 .It Ic msend Ar local-files
808 .It Ic newer Ar remote-file Op Ar local-file
809 Get the file only if the modification time of the remote file is more
810 recent that the file on the current system.
812 exist on the current system, the remote file is considered
814 Otherwise, this command is identical to
816 .It Ic nlist Op Ar remote-path Op Ar local-file
819 .It Ic nmap Op Ar inpattern outpattern
820 Set or unset the filename mapping mechanism.
821 If no arguments are specified, the filename mapping mechanism is unset.
822 If arguments are specified, remote filenames are mapped during
826 commands issued without a specified remote target filename.
827 If arguments are specified, local filenames are mapped during
831 commands issued without a specified local target filename.
832 This command is useful when connecting to a
835 with different file naming conventions or practices.
836 The mapping follows the pattern set by
841 is a template for incoming filenames (which may have already been
842 processed according to the
847 Variable templating is accomplished by including the
857 to prevent this special treatment of the
860 All other characters are treated literally, and are used to determine the
866 $1.$2 and the remote file name "mydata.data", $1 would have the value
867 "mydata", and $2 would have the value "data".
870 determines the resulting mapped filename.
876 are replaced by any value resulting from the
881 is replaced by the original filename.
882 Additionally, the sequence
883 .Dq Op Ar seq1 , Ar seq2
888 is not a null string; otherwise it is replaced by
890 For example, the command
892 .Bd -literal -offset indent -compact
893 nmap $1.$2.$3 [$1,$2].[$2,file]
897 the output filename "myfile.data" for input filenames "myfile.data" and
898 "myfile.data.old", "myfile.file" for the input filename "myfile", and
899 "myfile.myfile" for the input filename ".myfile".
900 Spaces may be included in
903 .Dl nmap $1 sed "s/ *$//" \*[Gt] $1
906 character to prevent special treatment
914 .It Ic ntrans Op Ar inchars Op Ar outchars
915 Set or unset the filename character translation mechanism.
916 If no arguments are specified, the filename character
917 translation mechanism is unset.
918 If arguments are specified, characters in
919 remote filenames are translated during
923 commands issued without a specified remote target filename.
924 If arguments are specified, characters in
925 local filenames are translated during
929 commands issued without a specified local target filename.
930 This command is useful when connecting to a
933 with different file naming conventions or practices.
934 Characters in a filename matching a character in
936 are replaced with the corresponding character in
938 If the character's position in
940 is longer than the length of
942 the character is deleted from the file name.
943 .It Ic open Ar host Op Ar port
944 Establish a connection to the specified
948 An optional port number may be supplied,
951 will attempt to contact an
956 option is on (default),
958 will also attempt to automatically log the user in to
965 and display with the program specified by the
968 .It Ic passive Op Cm auto
969 Toggle passive mode (if no arguments are given).
976 If passive mode is turned on (default),
980 command for all data connections instead of a
985 command requests that the remote server open a port for the data connection
986 and return the address of that port.
987 The remote server listens on that port and the client connects to it.
988 When using the more traditional
990 command, the client listens on a port and sends that address to the remote
991 server, who connects back to it.
992 Passive mode is useful when using
994 through a gateway router or host that controls the directionality of
998 servers are required to support the
1003 .It Ic pdir Op Ar remote-path
1006 .Op Ar remote-path ,
1007 and display the result with the program specified by the
1010 .It Ic pls Op Ar remote-path
1013 .Op Ar remote-path ,
1014 and display the result with the program specified by the
1017 .It Ic pmlsd Op Ar remote-path
1020 .Op Ar remote-path ,
1021 and display the result with the program specified by the
1025 Toggle preservation of modification times on retrieved files.
1027 Toggle display of transfer progress bar.
1028 The progress bar will be disabled for a transfer that has
1032 or a command that starts with
1035 .Sx FILE NAMING CONVENTIONS
1036 for more information.
1042 Toggle interactive prompting.
1043 Interactive prompting
1044 occurs during multiple file transfers to allow the
1045 user to selectively retrieve or store files.
1046 If prompting is turned off (default is on), any
1050 will transfer all files, and any
1052 will delete all files.
1054 When prompting is on, the following commands are available at a prompt:
1055 .Bl -tag -width 2n -offset indent
1059 to the current file, and automatically answer
1061 to any remaining files for the current command.
1065 and do not transfer the file.
1069 to the current file, and turn off prompt mode
1074 Terminate the current operation.
1078 and transfer the file.
1080 Display a help message.
1083 Any other response will answer
1085 to the current file.
1086 .It Ic proxy Ar ftp-command
1087 Execute an ftp command on a secondary control connection.
1088 This command allows simultaneous connection to two remote
1090 servers for transferring files between the two servers.
1093 command should be an
1095 to establish the secondary control connection.
1096 Enter the command "proxy ?" to see other
1098 commands executable on the secondary connection.
1099 The following commands behave differently when prefaced by
1102 will not define new macros during the auto-login process,
1104 will not erase existing macro definitions,
1108 transfer files from the host on the primary control connection
1109 to the host on the secondary control connection, and
1114 transfer files from the host on the secondary control connection
1115 to the host on the primary control connection.
1116 Third party file transfers depend upon support of the
1120 command by the server on the secondary control connection.
1121 .It Ic put Ar local-file Op Ar remote-file
1122 Store a local file on the remote machine.
1125 is left unspecified, the local file name is used
1126 after processing according to any
1131 in naming the remote file.
1132 File transfer uses the
1133 current settings for
1140 Print the name of the current working directory on the remote
1145 .It Ic quote Ar arg1 arg2 ...
1146 The arguments specified are sent, verbatim, to the remote
1149 .It Ic rate Ar direction Oo Ar maximum Oo Ar increment Oc Oc
1150 Throttle the maximum transfer rate to
1155 is 0, disable the throttle.
1159 .Bl -tag -width "all" -offset indent -compact
1169 can be modified on the fly by
1171 bytes (default: 1024) each time a given signal is received:
1172 .Bl -tag -width "SIGUSR1" -offset indent
1185 The result must be a positive number.
1190 is not supplied, the current throttle rates are displayed.
1194 is not yet implemented for ascii mode transfers.
1195 .It Ic rcvbuf Ar size
1196 Set the size of the socket receive buffer to
1198 .It Ic recv Ar remote-file Op Ar local-file
1201 .It Ic reget Ar remote-file Op Ar local-file
1212 a partially transferred copy of
1215 is continued from the apparent point of failure.
1217 is useful when transferring very large files over networks that
1218 are prone to dropping connections.
1219 .It Ic remopts Ar command Op Ar command-options
1220 Set options on the remote
1226 (whose absence is handled on a command-specific basis).
1229 commands known to support options include:
1235 .It Ic rename Op Ar from Op Ar to
1238 on the remote machine, to the file
1242 This command re-synchronizes command/reply sequencing with the remote
1245 Resynchronization may be necessary following a violation of the
1247 protocol by the remote server.
1248 .It Ic restart Ar marker
1249 Restart the immediately following
1258 systems, marker is usually a byte
1259 offset into the file.
1260 .It Ic rhelp Op Ar command-name
1261 Request help from the remote
1266 is specified it is supplied to the server as well.
1267 .It Ic rmdir Ar directory-name
1268 Delete a directory on the remote machine.
1269 .It Ic rstatus Op Ar remote-file
1270 With no arguments, show status of remote machine.
1273 is specified, show status of
1277 Toggle storing of files on the local system with unique filenames.
1278 If a file already exists with a name equal to the target
1279 local filename for a
1283 command, a ".1" is appended to the name.
1284 If the resulting name matches another existing file,
1285 a ".2" is appended to the original name.
1286 If this process continues up to ".99", an error
1287 message is printed, and the transfer does not take place.
1288 The generated unique filename will be reported.
1291 will not affect local files generated from a shell command
1293 The default value is off.
1294 .It Ic send Ar local-file Op Ar remote-file
1303 will attempt to use a
1305 command when establishing
1306 a connection for each data transfer.
1309 commands can prevent delays
1310 when performing multiple file transfers.
1315 will use the default data port.
1318 commands is disabled, no attempt will be made to use
1320 commands for each data transfer.
1324 implementations which do ignore
1326 commands but, incorrectly, indicate they've been accepted.
1327 .It Ic set Op Ar option Ar value
1336 are not given, display all of the options and their values.
1337 The currently supported options are:
1338 .Bl -tag -width "http_proxy" -offset indent
1361 .It Ic site Ar arg1 arg2 ...
1362 The arguments specified are sent, verbatim, to the remote
1367 .It Ic size Ar remote-file
1371 .It Ic sndbuf Ar size
1372 Set the size of the socket send buffer to
1375 Show the current status of
1377 .It Ic struct Ar struct-name
1378 Set the file transfer
1382 The default (and only supported)
1386 Toggle storing of files on remote machine under unique file names.
1394 successful completion.
1395 The remote server will report unique name.
1396 Default value is off.
1398 Show the type of operating system running on the remote machine.
1400 Set the file transfer type to that needed to
1408 Toggle packet tracing.
1409 .It Ic type Op Ar type-name
1410 Set the file transfer
1414 If no type is specified, the current type
1416 The default type is network
1418 .It Ic umask Op Ar newmask
1419 Set the default umask on the remote server to
1423 is omitted, the current umask is printed.
1424 .It Ic unset Ar option
1429 for more information.
1430 .It Ic usage Ar command
1431 Print the usage message for
1433 .It Ic user Ar user-name Oo Ar password Oo Ar account Oc Oc
1434 Identify yourself to the remote
1439 is not specified and the server requires it,
1441 will prompt the user for it (after disabling local echo).
1444 field is not specified, and the
1447 requires it, the user will be prompted for it.
1450 field is specified, an account command will
1451 be relayed to the remote server after the login sequence
1452 is completed if the remote server did not require it
1458 disabled, this process is done automatically on initial connection to the
1462 Toggle verbose mode.
1463 In verbose mode, all responses from
1466 server are displayed to the user.
1468 if verbose is on, when a file transfer completes, statistics
1469 regarding the efficiency of the transfer are reported.
1472 .It Ic xferbuf Ar size
1473 Set the size of the socket send and receive buffers to
1475 .It Ic \&? Op Ar command
1480 Command arguments which have embedded spaces may be quoted with
1485 Commands which toggle settings can take an explicit
1489 argument to force the setting appropriately.
1491 Commands which take a byte count as an argument
1497 support an optional suffix on the argument which changes the
1498 interpretation of the argument.
1499 Supported suffixes are:
1500 .Bl -tag -width 3n -offset indent -compact
1502 Causes no modification.
1505 Kilo; multiply the argument by 1024
1507 Mega; multiply the argument by 1048576
1509 Giga; multiply the argument by 1073741824
1522 signal whilst a transfer is in progress, the current transfer rate
1523 statistics will be written to the standard error output, in the
1524 same format as the standard completion message.
1525 .Sh AUTO-FETCHING FILES
1526 In addition to standard commands, this version of
1528 supports an auto-fetch feature.
1529 To enable auto-fetch, simply pass the list of hostnames/files
1530 on the command line.
1532 The following formats are valid syntax for an auto-fetch element:
1533 .Bl -tag -width "FOO "
1534 .\" [user@]host:[path][/]
1535 .It Oo Ar user Ns Li \&@ Oc Ns Ar host Ns Li \&: Ns Oo Ar path Oc \
1543 contains a glob character and globbing is enabled,
1546 then the equivalent of
1550 If the directory component of
1552 contains no globbing characters,
1553 it is stored locally with the name basename (see
1557 in the current directory.
1558 Otherwise, the full remote name is used as the local name,
1559 relative to the local root directory.
1560 .\" ftp://[user[:password]@]host[:port]/path[/][;type=X]
1561 .It Li ftp:// Ns Oo Ar user Ns Oo Ns Li \&: Ns Ar password Oc Ns Li \&@ Oc \
1562 Ns Ar host Ns Oo Li \&: Ns Ar port Oc Ns Li / Ns Ar path Ns Oo Li / Oc \
1563 Ns Oo Li ;type= Ns Ar X Oc
1566 URL, retrieved using the
1571 Otherwise, transfer the URL using
1573 via the proxy defined in
1574 .Ic "set ftp_proxy" .
1583 if supplied, otherwise prompt the user for one.
1589 is supplied, then the transfer type will take place as
1590 ascii or binary (respectively).
1591 The default transfer type is binary.
1593 In order to be compliant with
1600 auto-fetch URL as follows:
1605 immediately after the
1606 .Ar host Ns Oo Li \&: Ns Ar port Oc
1607 is interpreted as a separator before the
1609 and not as part of the
1616 .So Li / Sc Ns -separated
1617 list of name components.
1618 For all but the last such component,
1620 performs the equivalent of a
1623 For the last path component,
1625 performs the equivalent of a
1629 Empty name components,
1636 at the beginning of the
1638 will cause the equivalent of a
1640 command without a directory name.
1641 This is unlikely to be useful.
1648 within the path components are decoded, with
1650 representing a character code in hexadecimal.
1651 This decoding takes place after the
1653 has been split into components,
1654 but before each component is used in the equivalent of a
1659 Some often-used codes are
1669 The above interpretation has the following consequences:
1672 The path is interpreted relative to the
1673 default login directory of the specified user or of the
1678 directory is required, use a leading path of
1680 If a user's home directory is required (and the remote server supports
1681 the syntax), use a leading path of
1683 For example, to retrieve
1692 .Dq ftp://myname:mypass@localhost/%2fetc/motd
1698 commands can be controlled by careful choice of
1705 For example, the following URLs correspond to the
1706 equivalents of the indicated commands:
1707 .Bl -tag -width "ftp://host/%2Fdir1%2Fdir2%2Ffile"
1708 .It ftp://host/dir1/dir2/file
1712 .It ftp://host/%2Fdir1/dir2/file
1716 .It ftp://host/dir1%2Fdir2/file
1717 .Dq "cd dir1/dir2" ,
1719 .It ftp://host/%2Fdir1%2Fdir2/file
1720 .Dq "cd /dir1/dir2" ,
1722 .It ftp://host/dir1%2Fdir2%2Ffile
1723 .Dq "get dir1/dir2/file" .
1724 .It ftp://host/%2Fdir1%2Fdir2%2Ffile
1725 .Dq "get /dir1/dir2/file" .
1728 You must have appropriate access permission for each of the
1729 intermediate directories that is used in the equivalent of a
1733 .\" http://[user[:password]@]host[:port]/path
1734 .It Li http:// Ns Oo Ar user Ns Oo Li \&: Ns Ar password Oc Ns Li \&@ Oc \
1735 Ns Ar host Ns Oo Li \&: Ns Ar port Oc Ns Li / Ns Ar path
1738 URL, retrieved using the
1742 .Ic "set http_proxy"
1743 is defined, it is used as a URL to an
1748 authorization is required to retrieve
1754 is in the URL, use them for the first attempt to authenticate.
1756 .It Li file:/// Ns Ar path
1757 A local URL, copied from
1761 .It Li about: Ns Ar topic
1762 Display information regarding
1764 no file is retrieved for this auto-fetched element.
1765 Supported values include:
1766 .Bl -tag -width "about:version"
1770 .It Li about:version
1773 Useful to provide when reporting problems.
1777 Unless noted otherwise above, and
1779 is not given, the file is stored in the current directory as the
1785 redirect is received, the fetch is retried using the new target URL
1786 supplied by the server, with a corresponding new
1790 is recommended, to avoid writing to unexpected file names.
1792 If a classic format or an
1794 URL format has a trailing
1800 will connect to the site and
1802 to the directory given as the path, and leave the user in interactive
1803 mode ready for further input.
1804 This will not work if
1810 transfers use HTTP 1.1.
1815 transfers use HTTP 1.0.
1819 is given, all auto-fetches that don't go via the
1823 proxies will be restarted.
1826 this is implemented by using
1832 this is implemented by using the
1837 If WWW or proxy WWW authentication is required, you will be prompted
1838 to enter a username and password to authenticate with.
1840 When specifying IPv6 numeric addresses in a URL, you need to
1841 surround the address in square brackets.
1843 .Dq ftp://[::1]:21/ .
1844 This is because colons are used in IPv6 numeric address as well as
1845 being the separator for the port number.
1846 .Sh ABORTING A FILE TRANSFER
1847 To abort a file transfer, use the terminal interrupt key
1849 Sending transfers will be immediately halted.
1850 Receiving transfers will be halted by sending an
1854 command to the remote server, and discarding any further data received.
1855 The speed at which this is accomplished depends upon the remote
1856 server's support for
1859 If the remote server does not support the
1861 command, the prompt will not appear until the remote server has completed
1862 sending the requested file.
1864 If the terminal interrupt key sequence is used whilst
1866 is awaiting a reply from the remote server for the ABOR processing,
1867 then the connection will be closed.
1868 This is different from the traditional behaviour (which ignores the
1869 terminal interrupt during this phase), but is considered more useful.
1870 .Sh FILE NAMING CONVENTIONS
1871 Files specified as arguments to
1873 commands are processed according to the following rules.
1882 (for writing) is used.
1884 If the first character of the file name is
1887 remainder of the argument is interpreted as a shell command.
1889 then forks a shell, using
1891 with the argument supplied, and reads (writes) from the stdout
1893 If the shell command includes spaces, the argument
1894 must be quoted; e.g.
1895 .Dq Qq Li \&| ls\ \-lt .
1897 useful example of this mechanism is:
1898 .Dq Li dir \&"\&" \&|more .
1900 Failing the above checks, if
1902 is enabled, local file names are expanded according to the rules
1910 command expects a single local file (e.g.
1912 only the first filename generated by the "globbing" operation is used.
1918 commands with unspecified local file names, the local filename is
1919 the remote filename, which may be altered by a
1925 The resulting filename may then be altered if
1933 commands with unspecified remote file names, the remote filename is
1934 the local filename, which may be altered by a
1939 The resulting filename may then be altered by the remote server if
1943 .Sh FILE TRANSFER PARAMETERS
1946 specification specifies many parameters which may affect a file transfer.
1962 supports the ascii and image types of file transfer,
1963 plus local byte size 8 for
1968 supports only the default values for the remaining
1969 file transfer parameters:
1977 file contains login and initialization information
1978 used by the auto-login process.
1979 It resides in the user's home directory,
1980 unless overridden with the
1982 option, or specified in the
1984 environment variable.
1985 The following tokens are recognized; they may be separated by spaces,
1987 .Bl -tag -width password
1988 .It Ic machine Ar name
1989 Identify a remote machine
1991 The auto-login process searches the
1995 token that matches the remote machine specified on the
1997 command line or as an
2000 Once a match is made, the subsequent
2002 tokens are processed,
2003 stopping when the end of file is reached or another
2007 token is encountered.
2015 There can be only one
2017 token, and it must be after all
2020 This is normally used as:
2022 .Dl default login anonymous password user@site
2024 thereby giving the user an automatic anonymous
2027 machines not specified in
2029 This can be overridden
2032 flag to disable auto-login.
2033 .It Ic login Ar name
2034 Identify a user on the remote machine.
2035 If this token is present, the auto-login process will initiate
2036 a login using the specified
2038 .It Ic password Ar string
2040 If this token is present, the auto-login process will supply the
2041 specified string if the remote server requires a password as part
2042 of the login process.
2043 Note that if this token is present in the
2045 file for any user other
2049 will abort the auto-login process if the
2052 anyone besides the user.
2053 .It Ic account Ar string
2054 Supply an additional account password.
2055 If this token is present, the auto-login process will supply the
2056 specified string if the remote server requires an additional
2057 account password, or the auto-login process will initiate an
2059 command if it does not.
2060 .It Ic macdef Ar name
2062 This token functions like the
2066 A macro is defined with the specified name; its contents begin with the
2069 line and continue until a blank line (consecutive new-line
2070 characters) is encountered.
2071 Like the other tokens in the
2075 is applicable only to the
2077 definition preceding it.
2080 entry cannot be used by multiple
2082 definitions; rather, it must be defined following each
2084 it is intended to be used with.
2087 is defined, it is automatically executed as the last step in the
2090 .Bd -literal -offset indent
2096 followed by a blank line.
2098 .Sh COMMAND LINE EDITING
2100 supports interactive command line editing, via the
2103 It is enabled with the
2105 command, and is enabled by default if input is from a tty.
2106 Previous lines can be recalled and edited with the arrow keys,
2107 and other GNU Emacs-style editing keys may be used as well.
2111 library is configured with a
2115 for more information.
2117 An extra key binding is available to
2119 to provide context sensitive command and filename completion
2120 (including remote file completion).
2121 To use this, bind a key to the
2125 By default, this is bound to the TAB key.
2126 .Sh COMMAND LINE PROMPT
2129 displays a command line prompt of
2132 This can be changed with the
2136 A prompt can be displayed on the right side of the screen (after the
2137 command input) with the
2141 The following formatting sequences are replaced by the given
2143 .Bl -tag -width "%% " -offset indent
2145 The current remote working directory.
2146 .\" %c[[0]n], %.[[0]n]
2147 .It \&%c Ns Oo Oo Li 0 Oc Ns Ar n Oc , Ns Li \&%. Ns Oo Oo Li 0 Oc Ns Ar n Oc
2148 The trailing component of the current remote working directory, or
2150 trailing components if a digit
2157 the number of skipped components precede the trailing component(s) in
2159 .\" ``/<number>trailing''
2162 .Li / Li \*[Lt] Va number Li \*[Gt]
2170 .Dq Li \&... Ns Va trailing
2174 The remote host name.
2176 The remote host name, up to the first
2179 The remote user name.
2186 uses the following environment variables.
2187 .Bl -tag -width "FTPSERVERPORT"
2189 Password to send in an anonymous
2195 Overrides the default operation mode.
2197 .Bl -tag -width "passive"
2203 automatic determination of passive or active (this is the default)
2212 Command-line prompt to use.
2216 .Sx COMMAND LINE PROMPT
2217 for more information.
2219 Command-line right side prompt to use.
2223 .Sx COMMAND LINE PROMPT
2224 for more information.
2226 Host to use as gate-ftp server when
2229 .It Ev FTPSERVERPORT
2230 Port to use when connecting to gate-ftp server when
2233 Default is port returned by a
2238 The value to send for the
2243 For default location of a
2245 file, if one exists.
2247 An alternate location of the
2251 Used by various commands to display files.
2254 if empty or not set.
2260 proxy to use when making
2263 (if not defined, use the standard
2269 for further notes about proxy use.
2273 proxy to use when making
2276 If proxy authentication is required and there is a username and
2277 password in this URL, they will automatically be used in the first
2278 attempt to authenticate to the proxy.
2282 URL characters are required in the username or password
2292 Note that the use of a username and password in
2296 may be incompatible with other programs that use it
2301 this is not used for interactive sessions, only for command-line
2304 A space or comma separated list of hosts (or domains) for which
2305 proxying is not to be used.
2306 Each entry may have an optional trailing ":port", which restricts
2307 the matching to connections to that port.
2309 .Sh EXTENDED PASSIVE MODE AND FIREWALLS
2310 Some firewall configurations do not allow
2312 to use extended passive mode.
2313 If you find that even a simple
2315 appears to hang after printing a message such as this:
2317 .Dl 229 Entering Extended Passive Mode (|||58551|)
2319 then you will need to disable extended passive mode with
2321 See the above section
2323 for an example of how to make this automatic.
2325 .Xr getservbyname 3 ,
2331 attempts to be compliant with:
2332 .Bl -tag -offset indent -width 8n
2334 .Em File Transfer Protocol
2336 .Em Requirements for Internet Hosts - Application and Support
2338 .Em How to Use Anonymous FTP
2340 .Em Feature negotiation mechanism for the File Transfer Protocol
2342 .Em FTP Extensions for IPv6 and NATs
2344 .Em Hypertext Transfer Protocol -- HTTP/1.1
2346 .Em Internet Message Format
2348 .Em Extensions to FTP
2350 .Em Uniform Resource Identifier (URI)
2358 Various features such as command line editing, context sensitive
2359 command and file completion, dynamic progress bar, automatic
2360 fetching of files and URLs, modification time preservation,
2361 transfer rate throttling, configurable command line prompt,
2362 and other enhancements over the standard
2370 .Aq lukem@NetBSD.org .
2372 IPv6 support was added by the WIDE/KAME project
2373 (but may not be present in all non-NetBSD versions of this program, depending
2374 if the operating system supports IPv6 in a similar manner to KAME).
2376 Correct execution of many commands depends upon proper behavior
2377 by the remote server.
2379 An error in the treatment of carriage returns
2382 ascii-mode transfer code
2384 This correction may result in incorrect transfers of binary files
2387 servers using the ascii type.
2388 Avoid this problem by using the binary image type.
2391 assumes that all IPv4 mapped addresses
2393 IPv6 addresses with a form like
2396 indicate IPv4 destinations which can be handled by
2399 However, in certain IPv6 network configurations, this assumption is not true.
2400 In such an environment, IPv4 mapped addresses must be passed to
2403 For example, if your site uses a SIIT translator for IPv6-to-IPv4 translation,
2405 is unable to support your configuration.