1 .\" Copyright (c) 1985, 1989, 1990 The Regents of the University of California.
2 .\" All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
12 .\" 3. All advertising materials mentioning features or use of this software
13 .\" must display the following acknowledgement:
14 .\" This product includes software developed by the University of
15 .\" California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\" may be used to endorse or promote products derived from this software
18 .\" without specific prior written permission.
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 .\" from: @(#)ftp.1 6.18 (Berkeley) 7/30/91
33 .\" $Id: ftp.1,v 1.14 2000/07/30 23:56:59 dholland Exp $
37 .Os "Linux NetKit (0.17)"
52 is the user interface to the
54 standard File Transfer Protocol.
55 The program allows a user to transfer files to and from a
58 Options may be specified at the command line, or to the
62 Use passive mode for data transfers. Allows use of ftp in environments
63 where a firewall prevents connections from the outside world back to
64 the client machine. Requires that the ftp server support the PASV
65 command. This is the default if invoked as
68 Turns off interactive prompting during multiple file transfers.
72 from attempting \*(Lqauto-login\*(Rq upon initial connection.
73 If auto-login is enabled,
79 file in the user's home directory for an entry describing
80 an account on the remote machine.
83 will prompt for the remote machine login name (default is the user
84 identity on the local machine), and, if necessary, prompt for a password
85 and an account with which to login.
87 Disables command editing and history support, if it was compiled into
90 executable. Otherwise, does nothing.
92 Disables file name globbing.
96 to show all responses from the remote server, as well
97 as report on data transfer statistics.
102 The client host with which
104 is to communicate may be specified on the command line.
107 will immediately attempt to establish a connection to an
109 server on that host; otherwise,
111 will enter its command interpreter and await instructions
115 is awaiting commands from the user the prompt
117 is provided to the user.
118 The following commands are recognized
122 .It Ic \&! Op Ar command Op Ar args
123 Invoke an interactive shell on the local machine.
124 If there are arguments, the first is taken to be a command to execute
125 directly, with the rest of the arguments as its arguments.
126 .It Ic \&$ Ar macro-name Op Ar args
129 that was defined with the
132 Arguments are passed to the macro unglobbed.
133 .It Ic account Op Ar passwd
134 Supply a supplemental password required by a remote system for access
135 to resources once a login has been successfully completed.
136 If no argument is included, the user will be prompted for an account
137 password in a non-echoing input mode.
138 .It Ic append Ar local-file Op Ar remote-file
139 Append a local file to a file on the remote machine.
142 is left unspecified, the local file name is used in naming the
143 remote file after being altered by any
148 File transfer uses the current settings for
155 Set the file transfer
159 This is the default type.
161 Arrange that a bell be sounded after each file transfer
162 command is completed.
164 Set the file transfer
166 to support binary image transfer.
170 session with the remote server
173 An end of file will also terminate the session and exit.
175 Toggle remote computer file name case mapping during
180 is on (default is off), remote computer file names with all letters in
181 upper case are written in the local directory with the letters mapped
183 .It Ic \&cd Ar remote-directory
184 Change the working directory on the remote machine
186 .Ar remote-directory .
188 Change the remote machine working directory to the parent of the
189 current remote machine working directory.
190 .It Ic chmod Ar mode file-name
191 Change the permission modes of the file
199 session with the remote server, and
200 return to the command interpreter.
201 Any defined macros are erased.
203 Toggle carriage return stripping during
204 ascii type file retrieval.
205 Records are denoted by a carriage return/linefeed sequence
206 during ascii type file transfer.
209 is on (the default), carriage returns are stripped from this
210 sequence to conform with the
212 single linefeed record
216 remote systems may contain single linefeeds;
217 when an ascii type transfer is made, these linefeeds may be
218 distinguished from a record delimiter only when
221 .It Ic delete Ar remote-file
224 on the remote machine.
225 .It Ic debug Op Ar debug-value
226 Toggle debugging mode.
229 is specified it is used to set the debugging level.
230 When debugging is on,
232 prints each command sent to the remote machine, preceded
237 .Op Ar remote-directory
240 Print a listing of the directory contents in the
242 .Ar remote-directory ,
243 and, optionally, placing the output in
245 If interactive prompting is on,
247 will prompt the user to verify that the last argument is indeed the
248 target local file for receiving
251 If no directory is specified, the current working
252 directory on the remote machine is used.
254 file is specified, or
258 output comes to the terminal.
262 .It Ic form Ar format
263 Set the file transfer
267 The default format is \*(Lqfile\*(Rq.
268 .It Ic get Ar remote-file Op Ar local-file
271 and store it on the local machine.
273 file name is not specified, it is given the same
274 name it has on the remote machine, subject to
275 alteration by the current
281 The current settings for
287 are used while transferring the file.
289 Toggle filename expansion for
294 If globbing is turned off with
296 the file name arguments
297 are taken literally and not expanded.
306 each remote file name is expanded
307 separately on the remote machine and the lists are not merged.
308 Expansion of a directory name is likely to be
309 different from expansion of the name of an ordinary file:
310 the exact result depends on the foreign operating system and ftp server,
311 and can be previewed by doing
312 .Ql mls remote-files \-
317 are not meant to transfer
318 entire directory subtrees of files.
322 archive of the subtree (in binary mode).
324 Toggle hash-sign (``#'') printing for each data block
326 The size of a data block is 1024 bytes.
327 .It Ic help Op Ar command
328 Print an informative message about the meaning of
330 If no argument is given,
332 prints a list of the known commands.
333 .It Ic idle Op Ar seconds
334 Set the inactivity timer on the remote server to
339 is ommitted, the current inactivity timer is printed.
340 .It Ic lcd Op Ar directory
341 Change the working directory on the local machine.
345 is specified, the user's home directory is used.
348 .Op Ar remote-directory
351 Print a listing of the contents of a
352 directory on the remote machine.
353 The listing includes any system-dependent information that the server
354 chooses to include; for example, most
357 output from the command
363 is left unspecified, the current working directory is used.
364 If interactive prompting is on,
366 will prompt the user to verify that the last argument is indeed the
367 target local file for receiving
370 If no local file is specified, or if
374 the output is sent to the terminal.
375 .It Ic macdef Ar macro-name
377 Subsequent lines are stored as the macro
379 a null line (consecutive newline characters
381 carriage returns from the terminal) terminates macro input mode.
382 There is a limit of 16 macros and 4096 total characters in all
384 Macros remain defined until a
387 The macro processor interprets `$' and `\e' as special characters.
388 A `$' followed by a number (or numbers) is replaced by the
389 corresponding argument on the macro invocation command line.
390 A `$' followed by an `i' signals that macro processor that the
391 executing macro is to be looped.
392 On the first pass `$i' is
393 replaced by the first argument on the macro invocation command line,
394 on the second pass it is replaced by the second argument, and so on.
395 A `\e' followed by any character is replaced by that character.
396 Use the `\e' to prevent special treatment of the `$'.
397 .It Ic mdelete Op Ar remote-files
400 on the remote machine.
401 .It Ic mdir Ar remote-files local-file
404 except multiple remote files may be specified.
405 If interactive prompting is on,
407 will prompt the user to verify that the last argument is indeed the
408 target local file for receiving
411 .It Ic mget Ar remote-files
414 on the remote machine
417 for each file name thus produced.
420 for details on the filename expansion.
421 Resulting file names will then be processed according to
427 Files are transferred into the local working directory,
428 which can be changed with
430 new local directories can be created with
431 .Ql "\&! mkdir directory" .
432 .It Ic mkdir Ar directory-name
433 Make a directory on the remote machine.
434 .It Ic mls Ar remote-files local-file
437 except multiple remote files may be specified,
441 If interactive prompting is on,
443 will prompt the user to verify that the last argument is indeed the
444 target local file for receiving
447 .It Ic mode Op Ar mode-name
448 Set the file transfer
452 The default mode is \*(Lqstream\*(Rq mode.
453 .It Ic modtime Ar file-name
454 Show the last modification time of the file on the remote machine.
455 .It Ic mput Ar local-files
456 Expand wild cards in the list of local files given as arguments
459 for each file in the resulting list.
462 for details of filename expansion.
463 Resulting file names will then be processed according to
468 .It Ic newer Ar file-name Op Ar local-file
469 Get the file only if the modification time of the remote file is more
470 recent that the file on the current system.
472 exist on the current system, the remote file is considered
474 Otherwise, this command is identical to
478 .Op Ar remote-directory
481 Print a list of the files in a
482 directory on the remote machine.
485 is left unspecified, the current working directory is used.
486 If interactive prompting is on,
488 will prompt the user to verify that the last argument is indeed the
489 target local file for receiving
492 If no local file is specified, or if
496 the output is sent to the terminal.
497 .It Ic nmap Op Ar inpattern outpattern
498 Set or unset the filename mapping mechanism.
499 If no arguments are specified, the filename mapping mechanism is unset.
500 If arguments are specified, remote filenames are mapped during
504 commands issued without a specified remote target filename.
505 If arguments are specified, local filenames are mapped during
509 commands issued without a specified local target filename.
510 This command is useful when connecting to a
513 with different file naming conventions or practices.
514 The mapping follows the pattern set by
519 is a template for incoming filenames (which may have already been
520 processed according to the
525 Variable templating is accomplished by including the
526 sequences `$1', `$2', ..., `$9' in
528 Use `\\' to prevent this special treatment of the `$' character.
529 All other characters are treated literally, and are used to determine the
535 $1.$2 and the remote file name "mydata.data", $1 would have the value
536 "mydata", and $2 would have the value "data".
539 determines the resulting mapped filename.
540 The sequences `$1', `$2', ...., `$9' are replaced by any value resulting
544 The sequence `$0' is replace by the original filename.
545 Additionally, the sequence
546 .Ql Op Ar seq1 , Ar seq2
551 is not a null string; otherwise it is replaced by
553 For example, the command
555 .Bd -literal -offset indent -compact
556 nmap $1.$2.$3 [$1,$2].[$2,file]
560 the output filename "myfile.data" for input filenames "myfile.data" and
561 "myfile.data.old", "myfile.file" for the input filename "myfile", and
562 "myfile.myfile" for the input filename ".myfile".
563 Spaces may be included in
565 as in the example: `nmap $1 sed "s/ *$//" > $1' .
566 Use the `\e' character to prevent special treatment
567 of the `$','[','[', and `,' characters.
568 .It Ic ntrans Op Ar inchars Op Ar outchars
569 Set or unset the filename character translation mechanism.
570 If no arguments are specified, the filename character
571 translation mechanism is unset.
572 If arguments are specified, characters in
573 remote filenames are translated during
577 commands issued without a specified remote target filename.
578 If arguments are specified, characters in
579 local filenames are translated during
583 commands issued without a specified local target filename.
584 This command is useful when connecting to a
587 with different file naming conventions or practices.
588 Characters in a filename matching a character in
590 are replaced with the corresponding character in
592 If the character's position in
594 is longer than the length of
596 the character is deleted from the file name.
597 .It Ic open Ar host Op Ar port
598 Establish a connection to the specified
602 An optional port number may be supplied,
605 will attempt to contact an
610 option is on (default),
612 will also attempt to automatically log the user in to
617 Toggle interactive prompting.
618 Interactive prompting
619 occurs during multiple file transfers to allow the
620 user to selectively retrieve or store files.
621 If prompting is turned off (default is on), any
625 will transfer all files, and any
627 will delete all files.
628 .It Ic proxy Ar ftp-command
629 Execute an ftp command on a secondary control connection.
630 This command allows simultaneous connection to two remote ftp
631 servers for transferring files between the two servers.
636 to establish the secondary control connection.
637 Enter the command "proxy ?" to see other ftp commands executable on the
638 secondary connection.
639 The following commands behave differently when prefaced by
642 will not define new macros during the auto-login process,
644 will not erase existing macro definitions,
648 transfer files from the host on the primary control connection
649 to the host on the secondary control connection, and
654 transfer files from the host on the secondary control connection
655 to the host on the primary control connection.
656 Third party file transfers depend upon support of the ftp protocol
658 command by the server on the secondary control connection.
659 .It Ic put Ar local-file Op Ar remote-file
660 Store a local file on the remote machine.
663 is left unspecified, the local file name is used
664 after processing according to any
669 in naming the remote file.
670 File transfer uses the
678 Print the name of the current working directory on the remote
683 .It Ic quote Ar arg1 arg2 ...
684 The arguments specified are sent, verbatim, to the remote
687 .It Ic recv Ar remote-file Op Ar local-file
689 .It Ic reget Ar remote-file Op Ar local-file
690 Reget acts like get, except that if
697 a partially transferred copy of
700 is continued from the apparent point of failure.
702 is useful when transferring very large files over networks that
703 are prone to dropping connections.
704 .It Ic remotehelp Op Ar command-name
705 Request help from the remote
710 is specified it is supplied to the server as well.
711 .It Ic remotestatus Op Ar file-name
712 With no arguments, show status of remote machine.
715 is specified, show status of
725 on the remote machine, to the file
729 This command re-synchronizes command/reply sequencing with the remote
731 Resynchronization may be necessary following a violation of the ftp protocol
732 by the remote server.
733 .It Ic restart Ar marker
734 Restart the immediately following
743 systems, marker is usually a byte
744 offset into the file.
745 .It Ic rmdir Ar directory-name
746 Delete a directory on the remote machine.
748 Toggle storing of files on the local system with unique filenames.
749 If a file already exists with a name equal to the target
754 command, a ".1" is appended to the name.
755 If the resulting name matches another existing file,
756 a ".2" is appended to the original name.
757 If this process continues up to ".99", an error
758 message is printed, and the transfer does not take place.
759 The generated unique filename will be reported.
762 will not affect local files generated from a shell command
764 The default value is off.
765 .It Ic send Ar local-file Op Ar remote-file
773 will attempt to use a
775 command when establishing
776 a connection for each data transfer.
779 commands can prevent delays
780 when performing multiple file transfers.
785 will use the default data port.
788 commands is disabled, no attempt will be made to use
790 commands for each data transfer.
794 implementations which do ignore
796 commands but, incorrectly, indicate they've been accepted.
797 .It Ic site Ar arg1 arg2 ...
798 The arguments specified are sent, verbatim, to the remote
803 .It Ic size Ar file-name
808 Show the current status of
810 .It Ic struct Op Ar struct-name
811 Set the file transfer
815 By default \*(Lqstream\*(Rq structure is used.
817 Toggle storing of files on remote machine under unique file names.
818 Remote ftp server must support ftp protocol
821 successful completion.
822 The remote server will report unique name.
823 Default value is off.
825 Show the type of operating system running on the remote machine.
827 Set the file transfer type to that needed to
832 Toggle packet tracing.
833 .It Ic type Op Ar type-name
834 Set the file transfer
838 If no type is specified, the current type
840 The default type is network
842 .It Ic umask Op Ar newmask
843 Set the default umask on the remote server to
847 is ommitted, the current umask is printed.
849 .Ic user Ar user-name
853 Identify yourself to the remote
858 is not specified and the server requires it,
860 will prompt the user for it (after disabling local echo).
863 field is not specified, and the
866 requires it, the user will be prompted for it.
869 field is specified, an account command will
870 be relayed to the remote server after the login sequence
871 is completed if the remote server did not require it
875 is invoked with \*(Lqauto-login\*(Rq disabled, this
876 process is done automatically on initial connection to
882 In verbose mode, all responses from
885 server are displayed to the user.
887 if verbose is on, when a file transfer completes, statistics
888 regarding the efficiency of the transfer are reported.
891 .It Ic ? Op Ar command
895 Command arguments which have embedded spaces may be quoted with
897 .Sh ABORTING A FILE TRANSFER
898 To abort a file transfer, use the terminal interrupt key
900 Sending transfers will be immediately halted.
901 Receiving transfers will be halted by sending a ftp protocol
903 command to the remote server, and discarding any further data received.
904 The speed at which this is accomplished depends upon the remote
908 If the remote server does not support the
912 prompt will not appear until the remote server has completed
913 sending the requested file.
915 The terminal interrupt key sequence will be ignored when
917 has completed any local processing and is awaiting a reply
918 from the remote server.
919 A long delay in this mode may result from the ABOR processing described
920 above, or from unexpected behavior by the remote server, including
921 violations of the ftp protocol.
922 If the delay results from unexpected remote server behavior, the local
924 program must be killed by hand.
925 .Sh FILE NAMING CONVENTIONS
926 Files specified as arguments to
928 commands are processed according to the following rules.
937 (for writing) is used.
939 If the first character of the file name is
942 remainder of the argument is interpreted as a shell command.
944 then forks a shell, using
946 with the argument supplied, and reads (writes) from the stdout
948 If the shell command includes spaces, the argument
952 useful example of this mechanism is: \*(Lqdir more\*(Rq.
954 Failing the above checks, if ``globbing'' is enabled,
955 local file names are expanded
956 according to the rules used in the
963 command expects a single local file (.e.g.
965 only the first filename generated by the "globbing" operation is used.
971 commands with unspecified local file names, the local filename is
972 the remote filename, which may be altered by a
978 The resulting filename may then be altered if
986 commands with unspecified remote file names, the remote filename is
987 the local filename, which may be altered by a
992 The resulting filename may then be altered by the remote server if
996 .Sh FILE TRANSFER PARAMETERS
997 The FTP specification specifies many parameters which may
998 affect a file transfer.
1001 may be one of \*(Lqascii\*(Rq, \*(Lqimage\*(Rq (binary),
1002 \*(Lqebcdic\*(Rq, and \*(Lqlocal byte size\*(Rq (for
1008 supports the ascii and image types of file transfer,
1009 plus local byte size 8 for
1014 supports only the default values for the remaining
1015 file transfer parameters:
1022 utilizes the following environment variables.
1025 For default location of a
1027 file, if one exists.
1040 Correct execution of many commands depends upon proper behavior
1041 by the remote server.
1043 An error in the treatment of carriage returns
1046 ascii-mode transfer code
1048 This correction may result in incorrect transfers of binary files
1051 servers using the ascii type.
1052 Avoid this problem by using the binary image type.