1 .\" $NetBSD: ftp.1,v 1.135 2015/04/23 23:31:23 lukem Exp $
3 .\" Copyright (c) 1996-2015 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]]
87 .Op Fl x Ar xferbufsize
89 .\" [[user@]host [port]]
91 .Oo Ar user Ns Li \&@ Oc Ns Ar host
96 .\" [[user@]host:[path][/]]
115 .\" [ftp://[user[:password]@]host[:port]/path[/]]
120 .Op Li \&: Ar password
122 .Ar host Oo Li \&: Ar port Oc
130 .\" [http://[user[:password]@]host[:port]/path]
135 .Op Li \&: Ar password
137 .Ar host Oo Li \&: Ar port Oc
150 is the user interface to the Internet standard File Transfer Protocol.
151 The program allows a user to transfer files to and from a
154 The last five arguments will fetch a file using the
158 protocols, or by direct copying, into the current directory.
159 This is ideal for scripts.
161 .Sx AUTO-FETCHING FILES
162 below for more information.
164 Options may be specified at the command line, or to the
170 to only use IPv4 addresses.
174 to only use IPv6 addresses.
176 Force active mode ftp.
179 will try to use passive mode ftp and fall back to active mode
180 if passive is not supported by the server.
183 to always use an active connection.
184 It is only useful for connecting to very old servers that do not
185 implement passive mode properly.
189 to bypass normal login procedure, and use an anonymous login instead.
193 Disables command line editing.
194 This is useful for Emacs ange-ftp mode.
196 Forces a cache reload for transfers that go through the
202 Disables file name globbing.
204 Turns off interactive prompting during
205 multiple file transfers.
213 for more information.
219 upon initial connection for non auto-fetch transfers.
220 If auto-login is enabled,
224 (see below) file in the user's home directory for an entry describing
225 an account on the remote machine.
228 will prompt for the remote machine login name (default is the user
229 identity on the local machine), and, if necessary, prompt for a password
230 and an account with which to login.
231 To override the auto-login for auto-fetch transfers, specify the
232 username (and optionally, password) as appropriate.
234 When auto-fetching files, save the contents in
237 is parsed according to the
238 .Sx FILE NAMING CONVENTIONS
244 or doesn't start with
246 then only the first file specified will be retrieved into
248 all other files will be retrieved into the basename of their
251 Sets the port number to
254 Enable passive mode operation for use behind connection filtering firewalls.
255 This option has been deprecated as
257 now tries to use passive mode by default, falling back to active mode
258 if the server does not support passive connections.
260 Quit if the connection has stalled for
264 Restart all non-proxied auto-fetches.
266 Retry the connection attempt if it failed, pausing for
272 as the local IP address for all connections.
274 Enables packet tracing.
275 .It Fl T Ar direction Ns , Ns Ar maximum Ns Oo , Ns Ar increment Oc
276 Set the maximum transfer rate for
281 and if specified, the increment to
286 for more information.
287 .It Fl u Ar URL file Op \&.\&.\&.
288 Upload files on the command line to
292 is one of the ftp URL types as supported by auto-fetch
293 (with an optional target filename for single file uploads), and
295 is one or more local files to be uploaded.
301 overriding the default of enabled when output is to a terminal.
307 This is the default if output is to a terminal (and in the case of
310 is the foreground process).
313 to show all responses from the remote server, as well
314 as report on data transfer statistics.
315 .It Fl x Ar xferbufsize
316 Set the size of the socket send and receive buffers to
320 for more information.
323 The client host with which
325 is to communicate may be specified on the command line.
328 will immediately attempt to establish a connection to an
330 server on that host; otherwise,
332 will enter its command interpreter and await instructions
336 is awaiting commands from the user the prompt
338 is provided to the user.
339 The following commands are recognized
343 .It Ic \&! Op Ar command Op Ar args
344 Invoke an interactive shell on the local machine.
345 If there are arguments, the first is taken to be a command to execute
346 directly, with the rest of the arguments as its arguments.
347 .It Ic \&$ Ar macro-name Op Ar args
350 that was defined with the
353 Arguments are passed to the macro unglobbed.
354 .It Ic account Op Ar passwd
355 Supply a supplemental password required by a remote system for access
356 to resources once a login has been successfully completed.
357 If no argument is included, the user will be prompted for an account
358 password in a non-echoing input mode.
359 .It Ic append Ar local-file Op Ar remote-file
360 Append a local file to a file on the remote machine.
363 is left unspecified, the local file name is used in naming the
364 remote file after being altered by any
369 File transfer uses the current settings for
376 Set the file transfer
380 This is the default type.
382 Arrange that a bell be sounded after each file transfer
383 command is completed.
385 Set the file transfer
387 to support binary image transfer.
391 session with the remote server
394 An end of file will also terminate the session and exit.
396 Toggle remote computer file name case mapping during
404 is on (default is off), remote computer file names with all letters in
405 upper case are written in the local directory with the letters mapped
407 .It Ic \&cd Ar remote-directory
408 Change the working directory on the remote machine
410 .Ar remote-directory .
412 Change the remote machine working directory to the parent of the
413 current remote machine working directory.
414 .It Ic chmod Ar mode remote-file
415 Change the permission modes of the file
423 session with the remote server, and
424 return to the command interpreter.
425 Any defined macros are erased.
427 Toggle carriage return stripping during
428 ascii type file retrieval.
429 Records are denoted by a carriage return/linefeed sequence
430 during ascii type file transfer.
433 is on (the default), carriage returns are stripped from this
434 sequence to conform with the
436 single linefeed record
440 remote systems may contain single linefeeds;
441 when an ascii type transfer is made, these linefeeds may be
442 distinguished from a record delimiter only when
445 .It Ic delete Ar remote-file
448 on the remote machine.
449 .It Ic dir Op Ar remote-path Op Ar local-file
450 Print a listing of the contents of a
451 directory on the remote machine.
452 The listing includes any system-dependent information that the server
453 chooses to include; for example, most
456 output from the command
460 is left unspecified, the current working directory is used.
461 If interactive prompting is on,
463 will prompt the user to verify that the last argument is indeed the
464 target local file for receiving
467 If no local file is specified, or if
471 the output is sent to the terminal.
476 Toggle command line editing, and context sensitive command and file
478 This is automatically enabled if input is from a terminal, and
480 .It Ic epsv epsv4 epsv6
481 Toggle the use of the extended
485 commands on all IP, IPv4, and IPv6 connections respectively.
492 This is enabled by default.
493 If an extended command fails then this option will be temporarily
494 disabled for the duration of the current connection, or until
504 Display what features the remote server supports (using the
507 .It Ic fget Ar localfile
508 Retrieve the files listed in
510 which has one line per filename.
511 .It Ic form Ar format
512 Set the file transfer
516 The default (and only supported)
519 .It Ic ftp Ar host Op Ar port
522 .It Ic ftp_debug Op Ar ftp_debug-value
523 Toggle debugging mode.
526 is specified it is used to set the debugging level.
527 When debugging is on,
529 prints each command sent to the remote machine, preceded
532 .It Ic gate Op Ar host Op Ar port
533 Toggle gate-ftp mode, which used to connect through the
534 TIS FWTK and Gauntlet ftp proxies.
535 This will not be permitted if the gate-ftp server hasn't been set
536 (either explicitly by the user, or from the
538 environment variable).
542 then gate-ftp mode will be enabled, and the gate-ftp server will be set to
546 is also given, that will be used as the port to connect to on the
548 .It Ic get Ar remote-file Op Ar local-file
551 and store it on the local machine.
553 file name is not specified, it is given the same
554 name it has on the remote machine, subject to
555 alteration by the current
561 The current settings for
567 are used while transferring the file.
569 Toggle filename expansion for
575 If globbing is turned off with
577 the file name arguments
578 are taken literally and not expanded.
588 each remote file name is expanded
589 separately on the remote machine and the lists are not merged.
590 Expansion of a directory name is likely to be
591 different from expansion of the name of an ordinary file:
592 the exact result depends on the foreign operating system and ftp server,
593 and can be previewed by doing
594 .Ql mls remote-files \-
600 are not meant to transfer
601 entire directory subtrees of files.
605 archive of the subtree (in binary mode).
606 .It Ic hash Op Ar size
609 printing for each data block transferred.
610 The size of a data block defaults to 1024 bytes.
611 This can be changed by specifying
618 .It Ic help Op Ar command
619 Print an informative message about the meaning of
621 If no argument is given,
623 prints a list of the known commands.
624 .It Ic idle Op Ar seconds
625 Set the inactivity timer on the remote server to
630 is omitted, the current inactivity timer is printed.
634 .It Ic lcd Op Ar directory
635 Change the working directory on the local machine.
639 is specified, the user's home directory is used.
643 .It Ic lpage Ar local-file
646 with the program specified by the
650 Print the working directory on the local machine.
651 .It Ic \&ls Op Ar remote-path Op Ar local-file
654 .It Ic macdef Ar macro-name
656 Subsequent lines are stored as the macro
658 a null line (consecutive newline characters in a file or carriage
659 returns from the terminal) terminates macro input mode.
660 There is a limit of 16 macros and 4096 total characters in all
662 Macro names can be a maximum of 8 characters.
663 Macros are only applicable to the current session they are
664 defined within (or if defined outside a session, to the session
665 invoked with the next
667 command), and remain defined until a
670 To invoke a macro, use the
674 The macro processor interprets
678 as special characters.
681 followed by a number (or numbers) is replaced by the
682 corresponding argument on the macro invocation command line.
687 signals the macro processor that the executing macro is to be
691 is replaced by the first argument on the macro invocation command
692 line, on the second pass it is replaced by the second argument,
696 followed by any character is replaced by that character.
699 to prevent special treatment of the
701 .It Ic mdelete Op Ar remote-files
704 on the remote machine.
705 .It Ic mdir Ar remote-files local-file
708 except multiple remote files may be specified.
709 If interactive prompting is on,
711 will prompt the user to verify that the last argument is indeed the
712 target local file for receiving
715 .It Ic mget Ar remote-files
718 on the remote machine
721 for each file name thus produced.
724 for details on the filename expansion.
725 Resulting file names will then be processed according to
731 Files are transferred into the local working directory,
732 which can be changed with
734 new local directories can be created with
735 .Ql "\&! mkdir directory" .
736 .It Ic mkdir Ar directory-name
737 Make a directory on the remote machine.
738 .It Ic mls Ar remote-files local-file
741 except multiple remote files may be specified,
745 If interactive prompting is on,
747 will prompt the user to verify that the last argument is indeed the
748 target local file for receiving
751 .It Ic mlsd Op Ar remote-path
752 Display the contents of
754 (which should default to the current directory if not given)
755 in a machine-parsable form, using
757 The format of display can be changed with
758 .Sq "remopts mlst ..." .
759 .It Ic mlst Op Ar remote-path
760 Display the details about
762 (which should default to the current directory if not given)
763 in a machine-parsable form, using
765 The format of display can be changed with
766 .Sq "remopts mlst ..." .
767 .It Ic mode Ar mode-name
768 Set the file transfer
772 The default (and only supported)
775 .It Ic modtime Ar remote-file
776 Show the last modification time of the file on the remote machine, in
782 .It Ic mput Ar local-files
783 Expand wild cards in the list of local files given as arguments
786 for each file in the resulting list.
789 for details of filename expansion.
790 Resulting file names will then be processed according to
795 .It Ic mreget Ar remote-files
802 .It Ic msend Ar local-files
805 .It Ic newer Ar remote-file Op Ar local-file
806 Get the file only if the modification time of the remote file is more
807 recent that the file on the current system.
809 exist on the current system, the remote file is considered
811 Otherwise, this command is identical to
813 .It Ic nlist Op Ar remote-path Op Ar local-file
816 .It Ic nmap Op Ar inpattern outpattern
817 Set or unset the filename mapping mechanism.
818 If no arguments are specified, the filename mapping mechanism is unset.
819 If arguments are specified, remote filenames are mapped during
823 commands issued without a specified remote target filename.
824 If arguments are specified, local filenames are mapped during
828 commands issued without a specified local target filename.
829 This command is useful when connecting to a
832 with different file naming conventions or practices.
833 The mapping follows the pattern set by
838 is a template for incoming filenames (which may have already been
839 processed according to the
844 Variable templating is accomplished by including the
854 to prevent this special treatment of the
857 All other characters are treated literally, and are used to determine the
863 $1.$2 and the remote file name "mydata.data", $1 would have the value
864 "mydata", and $2 would have the value "data".
867 determines the resulting mapped filename.
873 are replaced by any value resulting from the
878 is replaced by the original filename.
879 Additionally, the sequence
880 .Dq Op Ar seq1 , Ar seq2
885 is not a null string; otherwise it is replaced by
887 For example, the command
889 .Bd -literal -offset indent -compact
890 nmap $1.$2.$3 [$1,$2].[$2,file]
894 the output filename "myfile.data" for input filenames "myfile.data" and
895 "myfile.data.old", "myfile.file" for the input filename "myfile", and
896 "myfile.myfile" for the input filename ".myfile".
897 Spaces may be included in
900 .Dl nmap $1 sed "s/ *$//" \*[Gt] $1
903 character to prevent special treatment
911 .It Ic ntrans Op Ar inchars Op Ar outchars
912 Set or unset the filename character translation mechanism.
913 If no arguments are specified, the filename character
914 translation mechanism is unset.
915 If arguments are specified, characters in
916 remote filenames are translated during
920 commands issued without a specified remote target filename.
921 If arguments are specified, characters in
922 local filenames are translated during
926 commands issued without a specified local target filename.
927 This command is useful when connecting to a
930 with different file naming conventions or practices.
931 Characters in a filename matching a character in
933 are replaced with the corresponding character in
935 If the character's position in
937 is longer than the length of
939 the character is deleted from the file name.
940 .It Ic open Ar host Op Ar port
941 Establish a connection to the specified
945 An optional port number may be supplied,
948 will attempt to contact an
953 option is on (default),
955 will also attempt to automatically log the user in to
962 and display with the program specified by the
965 .It Ic passive Op Cm auto
966 Toggle passive mode (if no arguments are given).
973 If passive mode is turned on (default),
977 command for all data connections instead of a
982 command requests that the remote server open a port for the data connection
983 and return the address of that port.
984 The remote server listens on that port and the client connects to it.
985 When using the more traditional
987 command, the client listens on a port and sends that address to the remote
988 server, who connects back to it.
989 Passive mode is useful when using
991 through a gateway router or host that controls the directionality of
995 servers are required to support the
1000 .It Ic pdir Op Ar remote-path
1003 .Op Ar remote-path ,
1004 and display the result with the program specified by the
1007 .It Ic pls Op Ar remote-path
1010 .Op Ar remote-path ,
1011 and display the result with the program specified by the
1014 .It Ic pmlsd Op Ar remote-path
1017 .Op Ar remote-path ,
1018 and display the result with the program specified by the
1022 Toggle preservation of modification times on retrieved files.
1024 Toggle display of transfer progress bar.
1025 The progress bar will be disabled for a transfer that has
1029 or a command that starts with
1032 .Sx FILE NAMING CONVENTIONS
1033 for more information.
1039 Toggle interactive prompting.
1040 Interactive prompting
1041 occurs during multiple file transfers to allow the
1042 user to selectively retrieve or store files.
1043 If prompting is turned off (default is on), any
1047 will transfer all files, and any
1049 will delete all files.
1051 When prompting is on, the following commands are available at a prompt:
1052 .Bl -tag -width 2n -offset indent
1056 to the current file, and automatically answer
1058 to any remaining files for the current command.
1062 and do not transfer the file.
1066 to the current file, and turn off prompt mode
1071 Terminate the current operation.
1075 and transfer the file.
1077 Display a help message.
1080 Any other response will answer
1082 to the current file.
1083 .It Ic proxy Ar ftp-command
1084 Execute an ftp command on a secondary control connection.
1085 This command allows simultaneous connection to two remote
1087 servers for transferring files between the two servers.
1090 command should be an
1092 to establish the secondary control connection.
1093 Enter the command "proxy ?" to see other
1095 commands executable on the secondary connection.
1096 The following commands behave differently when prefaced by
1099 will not define new macros during the auto-login process,
1101 will not erase existing macro definitions,
1105 transfer files from the host on the primary control connection
1106 to the host on the secondary control connection, and
1111 transfer files from the host on the secondary control connection
1112 to the host on the primary control connection.
1113 Third party file transfers depend upon support of the
1117 command by the server on the secondary control connection.
1118 .It Ic put Ar local-file Op Ar remote-file
1119 Store a local file on the remote machine.
1122 is left unspecified, the local file name is used
1123 after processing according to any
1128 in naming the remote file.
1129 File transfer uses the
1130 current settings for
1137 Print the name of the current working directory on the remote
1142 .It Ic quote Ar arg1 arg2 ...
1143 The arguments specified are sent, verbatim, to the remote
1146 .It Ic rate Ar direction Oo Ar maximum Oo Ar increment Oc Oc
1147 Throttle the maximum transfer rate to
1152 is 0, disable the throttle.
1156 .Bl -tag -width "all" -offset indent -compact
1166 can be modified on the fly by
1168 bytes (default: 1024) each time a given signal is received:
1169 .Bl -tag -width "SIGUSR1" -offset indent
1182 The result must be a positive number.
1187 is not supplied, the current throttle rates are displayed.
1191 is not yet implemented for ascii mode transfers.
1192 .It Ic rcvbuf Ar size
1193 Set the size of the socket receive buffer to
1195 .It Ic recv Ar remote-file Op Ar local-file
1198 .It Ic reget Ar remote-file Op Ar local-file
1209 a partially transferred copy of
1212 is continued from the apparent point of failure.
1214 is useful when transferring very large files over networks that
1215 are prone to dropping connections.
1216 .It Ic remopts Ar command Op Ar command-options
1217 Set options on the remote
1223 (whose absence is handled on a command-specific basis).
1226 commands known to support options include:
1232 .It Ic rename Op Ar from Op Ar to
1235 on the remote machine, to the file
1239 This command re-synchronizes command/reply sequencing with the remote
1242 Resynchronization may be necessary following a violation of the
1244 protocol by the remote server.
1245 .It Ic restart Ar marker
1246 Restart the immediately following
1255 systems, marker is usually a byte
1256 offset into the file.
1257 .It Ic rhelp Op Ar command-name
1258 Request help from the remote
1263 is specified it is supplied to the server as well.
1264 .It Ic rmdir Ar directory-name
1265 Delete a directory on the remote machine.
1266 .It Ic rstatus Op Ar remote-file
1267 With no arguments, show status of remote machine.
1270 is specified, show status of
1274 Toggle storing of files on the local system with unique filenames.
1275 If a file already exists with a name equal to the target
1276 local filename for a
1280 command, a ".1" is appended to the name.
1281 If the resulting name matches another existing file,
1282 a ".2" is appended to the original name.
1283 If this process continues up to ".99", an error
1284 message is printed, and the transfer does not take place.
1285 The generated unique filename will be reported.
1288 will not affect local files generated from a shell command
1290 The default value is off.
1291 .It Ic send Ar local-file Op Ar remote-file
1300 will attempt to use a
1302 command when establishing
1303 a connection for each data transfer.
1306 commands can prevent delays
1307 when performing multiple file transfers.
1312 will use the default data port.
1315 commands is disabled, no attempt will be made to use
1317 commands for each data transfer.
1321 implementations which do ignore
1323 commands but, incorrectly, indicate they've been accepted.
1324 .It Ic set Op Ar option Ar value
1333 are not given, display all of the options and their values.
1334 The currently supported options are:
1335 .Bl -tag -width "https_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.
1755 .\" https://[user[:password]@]host[:port]/path
1756 .It Li https:// Ns Oo Ar user Ns Oo Li \&: Ns Ar password Oc Ns Li \&@ Oc \
1757 Ns Ar host Ns Oo Li \&: Ns Ar port Oc Ns Li / Ns Ar path
1760 URL, retrieved using the
1764 .Ic "set https_proxy"
1765 is defined, it is used as a URL to an
1770 authorization is required to retrieve
1776 is in the URL, use them for the first attempt to authenticate.
1777 There is currently no certificate validation and verification.
1779 .It Li file:/// Ns Ar path
1780 A local URL, copied from
1784 .It Li about: Ns Ar topic
1785 Display information regarding
1787 no file is retrieved for this auto-fetched element.
1788 Supported values include:
1789 .Bl -tag -width "about:version"
1793 .It Li about:version
1796 Useful to provide when reporting problems.
1800 Unless noted otherwise above, and
1802 is not given, the file is stored in the current directory as the
1808 redirect is received, the fetch is retried using the new target URL
1809 supplied by the server, with a corresponding new
1813 is recommended, to avoid writing to unexpected file names.
1815 If a classic format or an
1817 URL format has a trailing
1823 will connect to the site and
1825 to the directory given as the path, and leave the user in interactive
1826 mode ready for further input.
1827 This will not work if
1833 transfers use HTTP 1.1.
1838 transfers use HTTP 1.0.
1842 is given, all auto-fetches that don't go via the
1846 proxies will be restarted.
1849 this is implemented by using
1855 this is implemented by using the
1860 If WWW or proxy WWW authentication is required, you will be prompted
1861 to enter a username and password to authenticate with.
1863 When specifying IPv6 numeric addresses in a URL, you need to
1864 surround the address in square brackets.
1866 .Dq ftp://[::1]:21/ .
1867 This is because colons are used in IPv6 numeric address as well as
1868 being the separator for the port number.
1869 .Sh ABORTING A FILE TRANSFER
1870 To abort a file transfer, use the terminal interrupt key
1872 Sending transfers will be immediately halted.
1873 Receiving transfers will be halted by sending an
1877 command to the remote server, and discarding any further data received.
1878 The speed at which this is accomplished depends upon the remote
1879 server's support for
1882 If the remote server does not support the
1884 command, the prompt will not appear until the remote server has completed
1885 sending the requested file.
1887 If the terminal interrupt key sequence is used whilst
1889 is awaiting a reply from the remote server for the ABOR processing,
1890 then the connection will be closed.
1891 This is different from the traditional behaviour (which ignores the
1892 terminal interrupt during this phase), but is considered more useful.
1893 .Sh FILE NAMING CONVENTIONS
1894 Files specified as arguments to
1896 commands are processed according to the following rules.
1905 (for writing) is used.
1907 If the first character of the file name is
1910 remainder of the argument is interpreted as a shell command.
1912 then forks a shell, using
1914 with the argument supplied, and reads (writes) from the stdout
1916 If the shell command includes spaces, the argument
1917 must be quoted; e.g.
1918 .Dq Qq Li \&| ls\ \-lt .
1920 useful example of this mechanism is:
1921 .Dq Li dir \&"\&" \&|more .
1923 Failing the above checks, if
1925 is enabled, local file names are expanded according to the rules
1933 command expects a single local file (e.g.
1935 only the first filename generated by the "globbing" operation is used.
1941 commands with unspecified local file names, the local filename is
1942 the remote filename, which may be altered by a
1948 The resulting filename may then be altered if
1956 commands with unspecified remote file names, the remote filename is
1957 the local filename, which may be altered by a
1962 The resulting filename may then be altered by the remote server if
1966 .Sh FILE TRANSFER PARAMETERS
1969 specification specifies many parameters which may affect a file transfer.
1985 supports the ascii and image types of file transfer,
1986 plus local byte size 8 for
1991 supports only the default values for the remaining
1992 file transfer parameters:
2000 file contains login and initialization information
2001 used by the auto-login process.
2002 It resides in the user's home directory,
2003 unless overridden with the
2005 option, or specified in the
2007 environment variable.
2008 The following tokens are recognized; they may be separated by spaces,
2010 .Bl -tag -width password
2011 .It Ic machine Ar name
2012 Identify a remote machine
2014 The auto-login process searches the
2018 token that matches the remote machine specified on the
2020 command line or as an
2023 Once a match is made, the subsequent
2025 tokens are processed,
2026 stopping when the end of file is reached or another
2030 token is encountered.
2038 There can be only one
2040 token, and it must be after all
2043 This is normally used as:
2045 .Dl default login anonymous password user@site
2047 thereby giving the user an automatic anonymous
2050 machines not specified in
2052 This can be overridden
2055 flag to disable auto-login.
2056 .It Ic login Ar name
2057 Identify a user on the remote machine.
2058 If this token is present, the auto-login process will initiate
2059 a login using the specified
2061 .It Ic password Ar string
2063 If this token is present, the auto-login process will supply the
2064 specified string if the remote server requires a password as part
2065 of the login process.
2066 Note that if this token is present in the
2068 file for any user other
2072 will abort the auto-login process if the
2075 anyone besides the user.
2076 .It Ic account Ar string
2077 Supply an additional account password.
2078 If this token is present, the auto-login process will supply the
2079 specified string if the remote server requires an additional
2080 account password, or the auto-login process will initiate an
2082 command if it does not.
2083 .It Ic macdef Ar name
2085 This token functions like the
2089 A macro is defined with the specified name; its contents begin with the
2092 line and continue until a blank line (consecutive new-line
2093 characters) is encountered.
2094 Like the other tokens in the
2098 is applicable only to the
2100 definition preceding it.
2103 entry cannot be used by multiple
2105 definitions; rather, it must be defined following each
2107 it is intended to be used with.
2110 is defined, it is automatically executed as the last step in the
2113 .Bd -literal -offset indent
2119 followed by a blank line.
2121 .Sh COMMAND LINE EDITING
2123 supports interactive command line editing, via the
2126 It is enabled with the
2128 command, and is enabled by default if input is from a tty.
2129 Previous lines can be recalled and edited with the arrow keys,
2130 and other GNU Emacs-style editing keys may be used as well.
2134 library is configured with a
2138 for more information.
2140 An extra key binding is available to
2142 to provide context sensitive command and filename completion
2143 (including remote file completion).
2144 To use this, bind a key to the
2148 By default, this is bound to the TAB key.
2149 .Sh COMMAND LINE PROMPT
2152 displays a command line prompt of
2155 This can be changed with the
2159 A prompt can be displayed on the right side of the screen (after the
2160 command input) with the
2164 The following formatting sequences are replaced by the given
2166 .Bl -tag -width "%% " -offset indent
2168 The current remote working directory.
2169 .\" %c[[0]n], %.[[0]n]
2170 .It \&%c Ns Oo Oo Li 0 Oc Ns Ar n Oc , Ns Li \&%. Ns Oo Oo Li 0 Oc Ns Ar n Oc
2171 The trailing component of the current remote working directory, or
2173 trailing components if a digit
2180 the number of skipped components precede the trailing component(s) in
2182 .\" ``/<number>trailing''
2185 .Li / Li \*[Lt] Va number Li \*[Gt]
2193 .Dq Li \&... Ns Va trailing
2197 The remote host name.
2199 The remote host name, up to the first
2202 The remote user name.
2209 uses the following environment variables.
2210 .Bl -tag -width "FTPSERVERPORT"
2212 Password to send in an anonymous
2218 Overrides the default operation mode.
2220 .Bl -tag -width "passive"
2226 automatic determination of passive or active (this is the default)
2235 Command-line prompt to use.
2239 .Sx COMMAND LINE PROMPT
2240 for more information.
2242 Command-line right side prompt to use.
2246 .Sx COMMAND LINE PROMPT
2247 for more information.
2249 Host to use as gate-ftp server when
2252 .It Ev FTPSERVERPORT
2253 Port to use when connecting to gate-ftp server when
2256 Default is port returned by a
2261 The value to send for the
2266 For default location of a
2268 file, if one exists.
2270 An alternate location of the
2274 Used by various commands to display files.
2277 if empty or not set.
2283 proxy to use when making
2286 (if not defined, use the standard
2292 for further notes about proxy use.
2296 proxy to use when making
2299 If proxy authentication is required and there is a username and
2300 password in this URL, they will automatically be used in the first
2301 attempt to authenticate to the proxy.
2305 URL characters are required in the username or password
2315 Note that the use of a username and password in
2319 may be incompatible with other programs that use it
2324 this is not used for interactive sessions, only for command-line
2327 A space or comma separated list of hosts (or domains) for which
2328 proxying is not to be used.
2329 Each entry may have an optional trailing ":port", which restricts
2330 the matching to connections to that port.
2332 .Sh EXTENDED PASSIVE MODE AND FIREWALLS
2333 Some firewall configurations do not allow
2335 to use extended passive mode.
2336 If you find that even a simple
2338 appears to hang after printing a message such as this:
2340 .Dl 229 Entering Extended Passive Mode (|||58551|)
2342 then you will need to disable extended passive mode with
2344 See the above section
2346 for an example of how to make this automatic.
2348 .Xr getservbyname 3 ,
2354 attempts to be compliant with:
2355 .Bl -tag -offset indent -width 8n
2357 .Em File Transfer Protocol
2359 .Em Requirements for Internet Hosts - Application and Support
2361 .Em How to Use Anonymous FTP
2363 .Em Feature negotiation mechanism for the File Transfer Protocol
2365 .Em FTP Extensions for IPv6 and NATs
2367 .Em Hypertext Transfer Protocol -- HTTP/1.1
2369 .Em Internet Message Format
2371 .Em Extensions to FTP
2373 .Em Uniform Resource Identifier (URI)
2381 Various features such as command line editing, context sensitive
2382 command and file completion, dynamic progress bar, automatic
2383 fetching of files and URLs, modification time preservation,
2384 transfer rate throttling, configurable command line prompt,
2385 and other enhancements over the standard
2393 .Aq lukem@NetBSD.org .
2395 IPv6 support was added by the WIDE/KAME project
2396 (but may not be present in all non-NetBSD versions of this program, depending
2397 if the operating system supports IPv6 in a similar manner to KAME).
2399 Correct execution of many commands depends upon proper behavior
2400 by the remote server.
2402 An error in the treatment of carriage returns
2405 ascii-mode transfer code
2407 This correction may result in incorrect transfers of binary files
2410 servers using the ascii type.
2411 Avoid this problem by using the binary image type.
2414 assumes that all IPv4 mapped addresses
2416 IPv6 addresses with a form like
2419 indicate IPv4 destinations which can be handled by
2422 However, in certain IPv6 network configurations, this assumption is not true.
2423 In such an environment, IPv4 mapped addresses must be passed to
2426 For example, if your site uses a SIIT translator for IPv6-to-IPv4 translation,
2428 is unable to support your configuration.