1 .\" $NetBSD: ftp.1,v 1.134 2012/12/22 16:57:10 christos Exp $
3 .\" Copyright (c) 1996-2010 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
76 .\" [-T dir,max[,inc]]
88 .\" [[user@]host [port]]
90 .Oo Ar user Ns Li \&@ Oc Ns Ar host
95 .\" [[user@]host:[path][/]]
114 .\" [ftp://[user[:password]@]host[:port]/path[/]]
119 .Op Li \&: Ar password
121 .Ar host Oo Li \&: Ar port Oc
129 .\" [http://[user[:password]@]host[:port]/path]
134 .Op Li \&: Ar password
136 .Ar host Oo Li \&: Ar port Oc
149 is the user interface to the Internet standard File Transfer Protocol.
150 The program allows a user to transfer files to and from a
153 The last five arguments will fetch a file using the
157 protocols, or by direct copying, into the current directory.
158 This is ideal for scripts.
160 .Sx AUTO-FETCHING FILES
161 below for more information.
163 Options may be specified at the command line, or to the
169 to only use IPv4 addresses.
173 to only use IPv6 addresses.
175 Force active mode ftp.
178 will try to use passive mode ftp and fall back to active mode
179 if passive is not supported by the server.
182 to always use an active connection.
183 It is only useful for connecting to very old servers that do not
184 implement passive mode properly.
188 to bypass normal login procedure, and use an anonymous login instead.
192 Disables command line editing.
193 This is useful for Emacs ange-ftp mode.
195 Forces a cache reload for transfers that go through the
201 Disables file name globbing.
203 Turns off interactive prompting during
204 multiple file transfers.
212 for more information.
218 upon initial connection for non auto-fetch transfers.
219 If auto-login is enabled,
223 (see below) file in the user's home directory for an entry describing
224 an account on the remote machine.
227 will prompt for the remote machine login name (default is the user
228 identity on the local machine), and, if necessary, prompt for a password
229 and an account with which to login.
230 To override the auto-login for auto-fetch transfers, specify the
231 username (and optionally, password) as appropriate.
233 When auto-fetching files, save the contents in
236 is parsed according to the
237 .Sx FILE NAMING CONVENTIONS
243 or doesn't start with
245 then only the first file specified will be retrieved into
247 all other files will be retrieved into the basename of their
250 Sets the port number to
253 Enable passive mode operation for use behind connection filtering firewalls.
254 This option has been deprecated as
256 now tries to use passive mode by default, falling back to active mode
257 if the server does not support passive connections.
259 Quit if the connection has stalled for
263 Restart all non-proxied auto-fetches.
265 Retry the connection attempt if it failed, pausing for
271 as the local IP address for all connections.
273 Enables packet tracing.
274 .It Fl T Ar direction Ns , Ns Ar maximum Ns Oo , Ns Ar increment Oc
275 Set the maximum transfer rate for
280 and if specified, the increment to
285 for more information.
286 .It Fl u Ar URL file Op \&.\&.\&.
287 Upload files on the command line to
291 is one of the ftp URL types as supported by auto-fetch
292 (with an optional target filename for single file uploads), and
294 is one or more local files to be uploaded.
300 overriding the default of enabled when output is to a terminal.
306 This is the default if output is to a terminal (and in the case of
309 is the foreground process).
312 to show all responses from the remote server, as well
313 as report on data transfer statistics.
316 The client host with which
318 is to communicate may be specified on the command line.
321 will immediately attempt to establish a connection to an
323 server on that host; otherwise,
325 will enter its command interpreter and await instructions
329 is awaiting commands from the user the prompt
331 is provided to the user.
332 The following commands are recognized
336 .It Ic \&! Op Ar command Op Ar args
337 Invoke an interactive shell on the local machine.
338 If there are arguments, the first is taken to be a command to execute
339 directly, with the rest of the arguments as its arguments.
340 .It Ic \&$ Ar macro-name Op Ar args
343 that was defined with the
346 Arguments are passed to the macro unglobbed.
347 .It Ic account Op Ar passwd
348 Supply a supplemental password required by a remote system for access
349 to resources once a login has been successfully completed.
350 If no argument is included, the user will be prompted for an account
351 password in a non-echoing input mode.
352 .It Ic append Ar local-file Op Ar remote-file
353 Append a local file to a file on the remote machine.
356 is left unspecified, the local file name is used in naming the
357 remote file after being altered by any
362 File transfer uses the current settings for
369 Set the file transfer
373 This is the default type.
375 Arrange that a bell be sounded after each file transfer
376 command is completed.
378 Set the file transfer
380 to support binary image transfer.
384 session with the remote server
387 An end of file will also terminate the session and exit.
389 Toggle remote computer file name case mapping during
397 is on (default is off), remote computer file names with all letters in
398 upper case are written in the local directory with the letters mapped
400 .It Ic \&cd Ar remote-directory
401 Change the working directory on the remote machine
403 .Ar remote-directory .
405 Change the remote machine working directory to the parent of the
406 current remote machine working directory.
407 .It Ic chmod Ar mode remote-file
408 Change the permission modes of the file
416 session with the remote server, and
417 return to the command interpreter.
418 Any defined macros are erased.
420 Toggle carriage return stripping during
421 ascii type file retrieval.
422 Records are denoted by a carriage return/linefeed sequence
423 during ascii type file transfer.
426 is on (the default), carriage returns are stripped from this
427 sequence to conform with the
429 single linefeed record
433 remote systems may contain single linefeeds;
434 when an ascii type transfer is made, these linefeeds may be
435 distinguished from a record delimiter only when
438 .It Ic delete Ar remote-file
441 on the remote machine.
442 .It Ic dir Op Ar remote-path Op Ar local-file
443 Print a listing of the contents of a
444 directory on the remote machine.
445 The listing includes any system-dependent information that the server
446 chooses to include; for example, most
449 output from the command
453 is left unspecified, the current working directory is used.
454 If interactive prompting is on,
456 will prompt the user to verify that the last argument is indeed the
457 target local file for receiving
460 If no local file is specified, or if
464 the output is sent to the terminal.
469 Toggle command line editing, and context sensitive command and file
471 This is automatically enabled if input is from a terminal, and
473 .It Ic epsv epsv4 epsv6
474 Toggle the use of the extended
478 commands on all IP, IPv4, and IPv6 connections respectively.
485 This is enabled by default.
486 If an extended command fails then this option will be temporarily
487 disabled for the duration of the current connection, or until
497 Display what features the remote server supports (using the
500 .It Ic fget Ar localfile
501 Retrieve the files listed in
503 which has one line per filename.
504 .It Ic form Ar format
505 Set the file transfer
509 The default (and only supported)
512 .It Ic ftp Ar host Op Ar port
515 .It Ic ftp_debug Op Ar ftp_debug-value
516 Toggle debugging mode.
519 is specified it is used to set the debugging level.
520 When debugging is on,
522 prints each command sent to the remote machine, preceded
525 .It Ic gate Op Ar host Op Ar port
526 Toggle gate-ftp mode, which used to connect through the
527 TIS FWTK and Gauntlet ftp proxies.
528 This will not be permitted if the gate-ftp server hasn't been set
529 (either explicitly by the user, or from the
531 environment variable).
535 then gate-ftp mode will be enabled, and the gate-ftp server will be set to
539 is also given, that will be used as the port to connect to on the
541 .It Ic get Ar remote-file Op Ar local-file
544 and store it on the local machine.
546 file name is not specified, it is given the same
547 name it has on the remote machine, subject to
548 alteration by the current
554 The current settings for
560 are used while transferring the file.
562 Toggle filename expansion for
568 If globbing is turned off with
570 the file name arguments
571 are taken literally and not expanded.
581 each remote file name is expanded
582 separately on the remote machine and the lists are not merged.
583 Expansion of a directory name is likely to be
584 different from expansion of the name of an ordinary file:
585 the exact result depends on the foreign operating system and ftp server,
586 and can be previewed by doing
587 .Ql mls remote-files \-
593 are not meant to transfer
594 entire directory subtrees of files.
598 archive of the subtree (in binary mode).
599 .It Ic hash Op Ar size
602 printing for each data block transferred.
603 The size of a data block defaults to 1024 bytes.
604 This can be changed by specifying
611 .It Ic help Op Ar command
612 Print an informative message about the meaning of
614 If no argument is given,
616 prints a list of the known commands.
617 .It Ic idle Op Ar seconds
618 Set the inactivity timer on the remote server to
623 is omitted, the current inactivity timer is printed.
627 .It Ic lcd Op Ar directory
628 Change the working directory on the local machine.
632 is specified, the user's home directory is used.
636 .It Ic lpage Ar local-file
639 with the program specified by the
643 Print the working directory on the local machine.
644 .It Ic \&ls Op Ar remote-path Op Ar local-file
647 .It Ic macdef Ar macro-name
649 Subsequent lines are stored as the macro
651 a null line (consecutive newline characters in a file or carriage
652 returns from the terminal) terminates macro input mode.
653 There is a limit of 16 macros and 4096 total characters in all
655 Macro names can be a maximum of 8 characters.
656 Macros are only applicable to the current session they are
657 defined within (or if defined outside a session, to the session
658 invoked with the next
660 command), and remain defined until a
663 To invoke a macro, use the
667 The macro processor interprets
671 as special characters.
674 followed by a number (or numbers) is replaced by the
675 corresponding argument on the macro invocation command line.
680 signals the macro processor that the executing macro is to be
684 is replaced by the first argument on the macro invocation command
685 line, on the second pass it is replaced by the second argument,
689 followed by any character is replaced by that character.
692 to prevent special treatment of the
694 .It Ic mdelete Op Ar remote-files
697 on the remote machine.
698 .It Ic mdir Ar remote-files local-file
701 except multiple remote files may be specified.
702 If interactive prompting is on,
704 will prompt the user to verify that the last argument is indeed the
705 target local file for receiving
708 .It Ic mget Ar remote-files
711 on the remote machine
714 for each file name thus produced.
717 for details on the filename expansion.
718 Resulting file names will then be processed according to
724 Files are transferred into the local working directory,
725 which can be changed with
727 new local directories can be created with
728 .Ql "\&! mkdir directory" .
729 .It Ic mkdir Ar directory-name
730 Make a directory on the remote machine.
731 .It Ic mls Ar remote-files local-file
734 except multiple remote files may be specified,
738 If interactive prompting is on,
740 will prompt the user to verify that the last argument is indeed the
741 target local file for receiving
744 .It Ic mlsd Op Ar remote-path
745 Display the contents of
747 (which should default to the current directory if not given)
748 in a machine-parsable form, using
750 The format of display can be changed with
751 .Sq "remopts mlst ..." .
752 .It Ic mlst Op Ar remote-path
753 Display the details about
755 (which should default to the current directory if not given)
756 in a machine-parsable form, using
758 The format of display can be changed with
759 .Sq "remopts mlst ..." .
760 .It Ic mode Ar mode-name
761 Set the file transfer
765 The default (and only supported)
768 .It Ic modtime Ar remote-file
769 Show the last modification time of the file on the remote machine, in
775 .It Ic mput Ar local-files
776 Expand wild cards in the list of local files given as arguments
779 for each file in the resulting list.
782 for details of filename expansion.
783 Resulting file names will then be processed according to
788 .It Ic mreget Ar remote-files
795 .It Ic msend Ar local-files
798 .It Ic newer Ar remote-file Op Ar local-file
799 Get the file only if the modification time of the remote file is more
800 recent that the file on the current system.
802 exist on the current system, the remote file is considered
804 Otherwise, this command is identical to
806 .It Ic nlist Op Ar remote-path Op Ar local-file
809 .It Ic nmap Op Ar inpattern outpattern
810 Set or unset the filename mapping mechanism.
811 If no arguments are specified, the filename mapping mechanism is unset.
812 If arguments are specified, remote filenames are mapped during
816 commands issued without a specified remote target filename.
817 If arguments are specified, local filenames are mapped during
821 commands issued without a specified local target filename.
822 This command is useful when connecting to a
825 with different file naming conventions or practices.
826 The mapping follows the pattern set by
831 is a template for incoming filenames (which may have already been
832 processed according to the
837 Variable templating is accomplished by including the
847 to prevent this special treatment of the
850 All other characters are treated literally, and are used to determine the
856 $1.$2 and the remote file name "mydata.data", $1 would have the value
857 "mydata", and $2 would have the value "data".
860 determines the resulting mapped filename.
866 are replaced by any value resulting from the
871 is replaced by the original filename.
872 Additionally, the sequence
873 .Dq Op Ar seq1 , Ar seq2
878 is not a null string; otherwise it is replaced by
880 For example, the command
882 .Bd -literal -offset indent -compact
883 nmap $1.$2.$3 [$1,$2].[$2,file]
887 the output filename "myfile.data" for input filenames "myfile.data" and
888 "myfile.data.old", "myfile.file" for the input filename "myfile", and
889 "myfile.myfile" for the input filename ".myfile".
890 Spaces may be included in
893 .Dl nmap $1 sed "s/ *$//" \*[Gt] $1
896 character to prevent special treatment
904 .It Ic ntrans Op Ar inchars Op Ar outchars
905 Set or unset the filename character translation mechanism.
906 If no arguments are specified, the filename character
907 translation mechanism is unset.
908 If arguments are specified, characters in
909 remote filenames are translated during
913 commands issued without a specified remote target filename.
914 If arguments are specified, characters in
915 local filenames are translated during
919 commands issued without a specified local target filename.
920 This command is useful when connecting to a
923 with different file naming conventions or practices.
924 Characters in a filename matching a character in
926 are replaced with the corresponding character in
928 If the character's position in
930 is longer than the length of
932 the character is deleted from the file name.
933 .It Ic open Ar host Op Ar port
934 Establish a connection to the specified
938 An optional port number may be supplied,
941 will attempt to contact an
946 option is on (default),
948 will also attempt to automatically log the user in to
955 and display with the program specified by the
958 .It Ic passive Op Cm auto
959 Toggle passive mode (if no arguments are given).
966 If passive mode is turned on (default),
970 command for all data connections instead of a
975 command requests that the remote server open a port for the data connection
976 and return the address of that port.
977 The remote server listens on that port and the client connects to it.
978 When using the more traditional
980 command, the client listens on a port and sends that address to the remote
981 server, who connects back to it.
982 Passive mode is useful when using
984 through a gateway router or host that controls the directionality of
988 servers are required to support the
993 .It Ic pdir Op Ar remote-path
997 and display the result with the program specified by the
1000 .It Ic pls Op Ar remote-path
1003 .Op Ar remote-path ,
1004 and display the result with the program specified by the
1007 .It Ic pmlsd Op Ar remote-path
1010 .Op Ar remote-path ,
1011 and display the result with the program specified by the
1015 Toggle preservation of modification times on retrieved files.
1017 Toggle display of transfer progress bar.
1018 The progress bar will be disabled for a transfer that has
1022 or a command that starts with
1025 .Sx FILE NAMING CONVENTIONS
1026 for more information.
1032 Toggle interactive prompting.
1033 Interactive prompting
1034 occurs during multiple file transfers to allow the
1035 user to selectively retrieve or store files.
1036 If prompting is turned off (default is on), any
1040 will transfer all files, and any
1042 will delete all files.
1044 When prompting is on, the following commands are available at a prompt:
1045 .Bl -tag -width 2n -offset indent
1049 to the current file, and automatically answer
1051 to any remaining files for the current command.
1055 and do not transfer the file.
1059 to the current file, and turn off prompt mode
1064 Terminate the current operation.
1068 and transfer the file.
1070 Display a help message.
1073 Any other response will answer
1075 to the current file.
1076 .It Ic proxy Ar ftp-command
1077 Execute an ftp command on a secondary control connection.
1078 This command allows simultaneous connection to two remote
1080 servers for transferring files between the two servers.
1083 command should be an
1085 to establish the secondary control connection.
1086 Enter the command "proxy ?" to see other
1088 commands executable on the secondary connection.
1089 The following commands behave differently when prefaced by
1092 will not define new macros during the auto-login process,
1094 will not erase existing macro definitions,
1098 transfer files from the host on the primary control connection
1099 to the host on the secondary control connection, and
1104 transfer files from the host on the secondary control connection
1105 to the host on the primary control connection.
1106 Third party file transfers depend upon support of the
1110 command by the server on the secondary control connection.
1111 .It Ic put Ar local-file Op Ar remote-file
1112 Store a local file on the remote machine.
1115 is left unspecified, the local file name is used
1116 after processing according to any
1121 in naming the remote file.
1122 File transfer uses the
1123 current settings for
1130 Print the name of the current working directory on the remote
1135 .It Ic quote Ar arg1 arg2 ...
1136 The arguments specified are sent, verbatim, to the remote
1139 .It Ic rate Ar direction Oo Ar maximum Oo Ar increment Oc Oc
1140 Throttle the maximum transfer rate to
1145 is 0, disable the throttle.
1149 .Bl -tag -width "all" -offset indent -compact
1159 can be modified on the fly by
1161 bytes (default: 1024) each time a given signal is received:
1162 .Bl -tag -width "SIGUSR1" -offset indent
1175 The result must be a positive number.
1180 is not supplied, the current throttle rates are displayed.
1184 is not yet implemented for ascii mode transfers.
1185 .It Ic rcvbuf Ar size
1186 Set the size of the socket receive buffer to
1188 .It Ic recv Ar remote-file Op Ar local-file
1191 .It Ic reget Ar remote-file Op Ar local-file
1202 a partially transferred copy of
1205 is continued from the apparent point of failure.
1207 is useful when transferring very large files over networks that
1208 are prone to dropping connections.
1209 .It Ic remopts Ar command Op Ar command-options
1210 Set options on the remote
1216 (whose absence is handled on a command-specific basis).
1219 commands known to support options include:
1225 .It Ic rename Op Ar from Op Ar to
1228 on the remote machine, to the file
1232 This command re-synchronizes command/reply sequencing with the remote
1235 Resynchronization may be necessary following a violation of the
1237 protocol by the remote server.
1238 .It Ic restart Ar marker
1239 Restart the immediately following
1248 systems, marker is usually a byte
1249 offset into the file.
1250 .It Ic rhelp Op Ar command-name
1251 Request help from the remote
1256 is specified it is supplied to the server as well.
1257 .It Ic rmdir Ar directory-name
1258 Delete a directory on the remote machine.
1259 .It Ic rstatus Op Ar remote-file
1260 With no arguments, show status of remote machine.
1263 is specified, show status of
1267 Toggle storing of files on the local system with unique filenames.
1268 If a file already exists with a name equal to the target
1269 local filename for a
1273 command, a ".1" is appended to the name.
1274 If the resulting name matches another existing file,
1275 a ".2" is appended to the original name.
1276 If this process continues up to ".99", an error
1277 message is printed, and the transfer does not take place.
1278 The generated unique filename will be reported.
1281 will not affect local files generated from a shell command
1283 The default value is off.
1284 .It Ic send Ar local-file Op Ar remote-file
1293 will attempt to use a
1295 command when establishing
1296 a connection for each data transfer.
1299 commands can prevent delays
1300 when performing multiple file transfers.
1305 will use the default data port.
1308 commands is disabled, no attempt will be made to use
1310 commands for each data transfer.
1314 implementations which do ignore
1316 commands but, incorrectly, indicate they've been accepted.
1317 .It Ic set Op Ar option Ar value
1326 are not given, display all of the options and their values.
1327 The currently supported options are:
1328 .Bl -tag -width "https_proxy" -offset indent
1354 .It Ic site Ar arg1 arg2 ...
1355 The arguments specified are sent, verbatim, to the remote
1360 .It Ic size Ar remote-file
1364 .It Ic sndbuf Ar size
1365 Set the size of the socket send buffer to
1368 Show the current status of
1370 .It Ic struct Ar struct-name
1371 Set the file transfer
1375 The default (and only supported)
1379 Toggle storing of files on remote machine under unique file names.
1387 successful completion.
1388 The remote server will report unique name.
1389 Default value is off.
1391 Show the type of operating system running on the remote machine.
1393 Set the file transfer type to that needed to
1401 Toggle packet tracing.
1402 .It Ic type Op Ar type-name
1403 Set the file transfer
1407 If no type is specified, the current type
1409 The default type is network
1411 .It Ic umask Op Ar newmask
1412 Set the default umask on the remote server to
1416 is omitted, the current umask is printed.
1417 .It Ic unset Ar option
1422 for more information.
1423 .It Ic usage Ar command
1424 Print the usage message for
1426 .It Ic user Ar user-name Oo Ar password Oo Ar account Oc Oc
1427 Identify yourself to the remote
1432 is not specified and the server requires it,
1434 will prompt the user for it (after disabling local echo).
1437 field is not specified, and the
1440 requires it, the user will be prompted for it.
1443 field is specified, an account command will
1444 be relayed to the remote server after the login sequence
1445 is completed if the remote server did not require it
1451 disabled, this process is done automatically on initial connection to the
1455 Toggle verbose mode.
1456 In verbose mode, all responses from
1459 server are displayed to the user.
1461 if verbose is on, when a file transfer completes, statistics
1462 regarding the efficiency of the transfer are reported.
1465 .It Ic xferbuf Ar size
1466 Set the size of the socket send and receive buffers to
1468 .It Ic \&? Op Ar command
1473 Command arguments which have embedded spaces may be quoted with
1478 Commands which toggle settings can take an explicit
1482 argument to force the setting appropriately.
1484 Commands which take a byte count as an argument
1490 support an optional suffix on the argument which changes the
1491 interpretation of the argument.
1492 Supported suffixes are:
1493 .Bl -tag -width 3n -offset indent -compact
1495 Causes no modification.
1498 Kilo; multiply the argument by 1024
1500 Mega; multiply the argument by 1048576
1502 Giga; multiply the argument by 1073741824
1515 signal whilst a transfer is in progress, the current transfer rate
1516 statistics will be written to the standard error output, in the
1517 same format as the standard completion message.
1518 .Sh AUTO-FETCHING FILES
1519 In addition to standard commands, this version of
1521 supports an auto-fetch feature.
1522 To enable auto-fetch, simply pass the list of hostnames/files
1523 on the command line.
1525 The following formats are valid syntax for an auto-fetch element:
1526 .Bl -tag -width "FOO "
1527 .\" [user@]host:[path][/]
1528 .It Oo Ar user Ns Li \&@ Oc Ns Ar host Ns Li \&: Ns Oo Ar path Oc \
1536 contains a glob character and globbing is enabled,
1539 then the equivalent of
1543 If the directory component of
1545 contains no globbing characters,
1546 it is stored locally with the name basename (see
1550 in the current directory.
1551 Otherwise, the full remote name is used as the local name,
1552 relative to the local root directory.
1553 .\" ftp://[user[:password]@]host[:port]/path[/][;type=X]
1554 .It Li ftp:// Ns Oo Ar user Ns Oo Ns Li \&: Ns Ar password Oc Ns Li \&@ Oc \
1555 Ns Ar host Ns Oo Li \&: Ns Ar port Oc Ns Li / Ns Ar path Ns Oo Li / Oc \
1556 Ns Oo Li ;type= Ns Ar X Oc
1559 URL, retrieved using the
1564 Otherwise, transfer the URL using
1566 via the proxy defined in
1567 .Ic "set ftp_proxy" .
1576 if supplied, otherwise prompt the user for one.
1582 is supplied, then the transfer type will take place as
1583 ascii or binary (respectively).
1584 The default transfer type is binary.
1586 In order to be compliant with
1593 auto-fetch URL as follows:
1598 immediately after the
1599 .Ar host Ns Oo Li \&: Ns Ar port Oc
1600 is interpreted as a separator before the
1602 and not as part of the
1609 .So Li / Sc Ns -separated
1610 list of name components.
1611 For all but the last such component,
1613 performs the equivalent of a
1616 For the last path component,
1618 performs the equivalent of a
1622 Empty name components,
1629 at the beginning of the
1631 will cause the equivalent of a
1633 command without a directory name.
1634 This is unlikely to be useful.
1641 within the path components are decoded, with
1643 representing a character code in hexadecimal.
1644 This decoding takes place after the
1646 has been split into components,
1647 but before each component is used in the equivalent of a
1652 Some often-used codes are
1662 The above interpretation has the following consequences:
1665 The path is interpreted relative to the
1666 default login directory of the specified user or of the
1671 directory is required, use a leading path of
1673 If a user's home directory is required (and the remote server supports
1674 the syntax), use a leading path of
1676 For example, to retrieve
1685 .Dq ftp://myname:mypass@localhost/%2fetc/motd
1691 commands can be controlled by careful choice of
1698 For example, the following URLs correspond to the
1699 equivalents of the indicated commands:
1700 .Bl -tag -width "ftp://host/%2Fdir1%2Fdir2%2Ffile"
1701 .It ftp://host/dir1/dir2/file
1705 .It ftp://host/%2Fdir1/dir2/file
1709 .It ftp://host/dir1%2Fdir2/file
1710 .Dq "cd dir1/dir2" ,
1712 .It ftp://host/%2Fdir1%2Fdir2/file
1713 .Dq "cd /dir1/dir2" ,
1715 .It ftp://host/dir1%2Fdir2%2Ffile
1716 .Dq "get dir1/dir2/file" .
1717 .It ftp://host/%2Fdir1%2Fdir2%2Ffile
1718 .Dq "get /dir1/dir2/file" .
1721 You must have appropriate access permission for each of the
1722 intermediate directories that is used in the equivalent of a
1726 .\" http://[user[:password]@]host[:port]/path
1727 .It Li http:// Ns Oo Ar user Ns Oo Li \&: Ns Ar password Oc Ns Li \&@ Oc \
1728 Ns Ar host Ns Oo Li \&: Ns Ar port Oc Ns Li / Ns Ar path
1731 URL, retrieved using the
1735 .Ic "set http_proxy"
1736 is defined, it is used as a URL to an
1741 authorization is required to retrieve
1747 is in the URL, use them for the first attempt to authenticate.
1748 .\" https://[user[:password]@]host[:port]/path
1749 .It Li https:// Ns Oo Ar user Ns Oo Li \&: Ns Ar password Oc Ns Li \&@ Oc \
1750 Ns Ar host Ns Oo Li \&: Ns Ar port Oc Ns Li / Ns Ar path
1753 URL, retrieved using the
1757 .Ic "set https_proxy"
1758 is defined, it is used as a URL to an
1763 authorization is required to retrieve
1769 is in the URL, use them for the first attempt to authenticate.
1770 There is currently no certificate validation and verification.
1772 .It Li file:/// Ns Ar path
1773 A local URL, copied from
1777 .It Li about: Ns Ar topic
1778 Display information regarding
1780 no file is retrieved for this auto-fetched element.
1781 Supported values include:
1782 .Bl -tag -width "about:version"
1786 .It Li about:version
1789 Useful to provide when reporting problems.
1793 Unless noted otherwise above, and
1795 is not given, the file is stored in the current directory as the
1801 redirect is received, the fetch is retried using the new target URL
1802 supplied by the server, with a corresponding new
1806 is recommended, to avoid writing to unexpected file names.
1808 If a classic format or an
1810 URL format has a trailing
1816 will connect to the site and
1818 to the directory given as the path, and leave the user in interactive
1819 mode ready for further input.
1820 This will not work if
1826 transfers use HTTP 1.1.
1831 transfers use HTTP 1.0.
1835 is given, all auto-fetches that don't go via the
1839 proxies will be restarted.
1842 this is implemented by using
1848 this is implemented by using the
1853 If WWW or proxy WWW authentication is required, you will be prompted
1854 to enter a username and password to authenticate with.
1856 When specifying IPv6 numeric addresses in a URL, you need to
1857 surround the address in square brackets.
1859 .Dq ftp://[::1]:21/ .
1860 This is because colons are used in IPv6 numeric address as well as
1861 being the separator for the port number.
1862 .Sh ABORTING A FILE TRANSFER
1863 To abort a file transfer, use the terminal interrupt key
1865 Sending transfers will be immediately halted.
1866 Receiving transfers will be halted by sending an
1870 command to the remote server, and discarding any further data received.
1871 The speed at which this is accomplished depends upon the remote
1872 server's support for
1875 If the remote server does not support the
1877 command, the prompt will not appear until the remote server has completed
1878 sending the requested file.
1880 If the terminal interrupt key sequence is used whilst
1882 is awaiting a reply from the remote server for the ABOR processing,
1883 then the connection will be closed.
1884 This is different from the traditional behaviour (which ignores the
1885 terminal interrupt during this phase), but is considered more useful.
1886 .Sh FILE NAMING CONVENTIONS
1887 Files specified as arguments to
1889 commands are processed according to the following rules.
1898 (for writing) is used.
1900 If the first character of the file name is
1903 remainder of the argument is interpreted as a shell command.
1905 then forks a shell, using
1907 with the argument supplied, and reads (writes) from the stdout
1909 If the shell command includes spaces, the argument
1910 must be quoted; e.g.
1911 .Dq Qq Li \&| ls\ \-lt .
1913 useful example of this mechanism is:
1914 .Dq Li dir \&"\&" \&|more .
1916 Failing the above checks, if
1918 is enabled, local file names are expanded according to the rules
1926 command expects a single local file (e.g.
1928 only the first filename generated by the "globbing" operation is used.
1934 commands with unspecified local file names, the local filename is
1935 the remote filename, which may be altered by a
1941 The resulting filename may then be altered if
1949 commands with unspecified remote file names, the remote filename is
1950 the local filename, which may be altered by a
1955 The resulting filename may then be altered by the remote server if
1959 .Sh FILE TRANSFER PARAMETERS
1962 specification specifies many parameters which may affect a file transfer.
1978 supports the ascii and image types of file transfer,
1979 plus local byte size 8 for
1984 supports only the default values for the remaining
1985 file transfer parameters:
1993 file contains login and initialization information
1994 used by the auto-login process.
1995 It resides in the user's home directory,
1996 unless overridden with the
1998 option, or specified in the
2000 environment variable.
2001 The following tokens are recognized; they may be separated by spaces,
2003 .Bl -tag -width password
2004 .It Ic machine Ar name
2005 Identify a remote machine
2007 The auto-login process searches the
2011 token that matches the remote machine specified on the
2013 command line or as an
2016 Once a match is made, the subsequent
2018 tokens are processed,
2019 stopping when the end of file is reached or another
2023 token is encountered.
2031 There can be only one
2033 token, and it must be after all
2036 This is normally used as:
2038 .Dl default login anonymous password user@site
2040 thereby giving the user an automatic anonymous
2043 machines not specified in
2045 This can be overridden
2048 flag to disable auto-login.
2049 .It Ic login Ar name
2050 Identify a user on the remote machine.
2051 If this token is present, the auto-login process will initiate
2052 a login using the specified
2054 .It Ic password Ar string
2056 If this token is present, the auto-login process will supply the
2057 specified string if the remote server requires a password as part
2058 of the login process.
2059 Note that if this token is present in the
2061 file for any user other
2065 will abort the auto-login process if the
2068 anyone besides the user.
2069 .It Ic account Ar string
2070 Supply an additional account password.
2071 If this token is present, the auto-login process will supply the
2072 specified string if the remote server requires an additional
2073 account password, or the auto-login process will initiate an
2075 command if it does not.
2076 .It Ic macdef Ar name
2078 This token functions like the
2082 A macro is defined with the specified name; its contents begin with the
2085 line and continue until a blank line (consecutive new-line
2086 characters) is encountered.
2087 Like the other tokens in the
2091 is applicable only to the
2093 definition preceding it.
2096 entry cannot be used by multiple
2098 definitions; rather, it must be defined following each
2100 it is intended to be used with.
2103 is defined, it is automatically executed as the last step in the
2106 .Bd -literal -offset indent
2112 followed by a blank line.
2114 .Sh COMMAND LINE EDITING
2116 supports interactive command line editing, via the
2119 It is enabled with the
2121 command, and is enabled by default if input is from a tty.
2122 Previous lines can be recalled and edited with the arrow keys,
2123 and other GNU Emacs-style editing keys may be used as well.
2127 library is configured with a
2131 for more information.
2133 An extra key binding is available to
2135 to provide context sensitive command and filename completion
2136 (including remote file completion).
2137 To use this, bind a key to the
2141 By default, this is bound to the TAB key.
2142 .Sh COMMAND LINE PROMPT
2145 displays a command line prompt of
2148 This can be changed with the
2152 A prompt can be displayed on the right side of the screen (after the
2153 command input) with the
2157 The following formatting sequences are replaced by the given
2159 .Bl -tag -width "%% " -offset indent
2161 The current remote working directory.
2162 .\" %c[[0]n], %.[[0]n]
2163 .It \&%c Ns Oo Oo Li 0 Oc Ns Ar n Oc , Ns Li \&%. Ns Oo Oo Li 0 Oc Ns Ar n Oc
2164 The trailing component of the current remote working directory, or
2166 trailing components if a digit
2173 the number of skipped components precede the trailing component(s) in
2175 .\" ``/<number>trailing''
2178 .Li / Li \*[Lt] Va number Li \*[Gt]
2186 .Dq Li \&... Ns Va trailing
2190 The remote host name.
2192 The remote host name, up to the first
2195 The remote user name.
2202 uses the following environment variables.
2203 .Bl -tag -width "FTPSERVERPORT"
2205 Password to send in an anonymous
2211 Overrides the default operation mode.
2213 .Bl -tag -width "passive"
2219 automatic determination of passive or active (this is the default)
2228 Command-line prompt to use.
2232 .Sx COMMAND LINE PROMPT
2233 for more information.
2235 Command-line right side prompt to use.
2239 .Sx COMMAND LINE PROMPT
2240 for more information.
2242 Host to use as gate-ftp server when
2245 .It Ev FTPSERVERPORT
2246 Port to use when connecting to gate-ftp server when
2249 Default is port returned by a
2254 The value to send for the
2259 For default location of a
2261 file, if one exists.
2263 An alternate location of the
2267 Used by various commands to display files.
2270 if empty or not set.
2276 proxy to use when making
2279 (if not defined, use the standard
2285 for further notes about proxy use.
2289 proxy to use when making
2292 If proxy authentication is required and there is a username and
2293 password in this URL, they will automatically be used in the first
2294 attempt to authenticate to the proxy.
2298 URL characters are required in the username or password
2308 Note that the use of a username and password in
2312 may be incompatible with other programs that use it
2317 this is not used for interactive sessions, only for command-line
2320 A space or comma separated list of hosts (or domains) for which
2321 proxying is not to be used.
2322 Each entry may have an optional trailing ":port", which restricts
2323 the matching to connections to that port.
2325 .Sh EXTENDED PASSIVE MODE AND FIREWALLS
2326 Some firewall configurations do not allow
2328 to use extended passive mode.
2329 If you find that even a simple
2331 appears to hang after printing a message such as this:
2333 .Dl 229 Entering Extended Passive Mode (|||58551|)
2335 then you will need to disable extended passive mode with
2337 See the above section
2339 for an example of how to make this automatic.
2341 .Xr getservbyname 3 ,
2347 attempts to be compliant with:
2348 .Bl -tag -offset indent -width 8n
2350 .Em File Transfer Protocol
2352 .Em Requirements for Internet Hosts - Application and Support
2354 .Em How to Use Anonymous FTP
2356 .Em Feature negotiation mechanism for the File Transfer Protocol
2358 .Em FTP Extensions for IPv6 and NATs
2360 .Em Hypertext Transfer Protocol -- HTTP/1.1
2362 .Em Internet Message Format
2364 .Em Extensions to FTP
2366 .Em Uniform Resource Identifier (URI)
2374 Various features such as command line editing, context sensitive
2375 command and file completion, dynamic progress bar, automatic
2376 fetching of files and URLs, modification time preservation,
2377 transfer rate throttling, configurable command line prompt,
2378 and other enhancements over the standard
2386 .Aq lukem@NetBSD.org .
2388 IPv6 support was added by the WIDE/KAME project
2389 (but may not be present in all non-NetBSD versions of this program, depending
2390 if the operating system supports IPv6 in a similar manner to KAME).
2392 Correct execution of many commands depends upon proper behavior
2393 by the remote server.
2395 An error in the treatment of carriage returns
2398 ascii-mode transfer code
2400 This correction may result in incorrect transfers of binary files
2403 servers using the ascii type.
2404 Avoid this problem by using the binary image type.
2407 assumes that all IPv4 mapped addresses
2409 IPv6 addresses with a form like
2412 indicate IPv4 destinations which can be handled by
2415 However, in certain IPv6 network configurations, this assumption is not true.
2416 In such an environment, IPv4 mapped addresses must be passed to
2419 For example, if your site uses a SIIT translator for IPv6-to-IPv4 translation,
2421 is unable to support your configuration.