xref: /openbsd/usr.bin/ftp/ftp.1 (revision a6445c1d)
1.\" 	$OpenBSD: ftp.1,v 1.94 2014/11/15 14:41:02 bentley Exp $
2.\" 	$NetBSD: ftp.1,v 1.22 1997/08/18 10:20:22 lukem Exp $
3.\"
4.\" Copyright (c) 1985, 1989, 1990, 1993
5.\"	The Regents of the University of California.  All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice, this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\" 3. Neither the name of the University nor the names of its contributors
16.\"    may be used to endorse or promote products derived from this software
17.\"    without specific prior written permission.
18.\"
19.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29.\" SUCH DAMAGE.
30.\"
31.\"	@(#)ftp.1	8.3 (Berkeley) 10/9/94
32.\"
33.Dd $Mdocdate: November 15 2014 $
34.Dt FTP 1
35.Os
36.Sh NAME
37.Nm ftp
38.Nd Internet file transfer program
39.Sh SYNOPSIS
40.Nm ftp
41.Op Fl 46AadEegimnptVv
42.Op Fl D Ar title
43.Op Fl k Ar seconds
44.Op Fl P Ar port
45.Op Fl r Ar seconds
46.Op Fl s Ar srcaddr
47.Op Ar host Op Ar port
48.Nm ftp
49.Op Fl C
50.Op Fl o Ar output
51.Op Fl s Ar srcaddr
52.Sm off
53.No ftp:// Oo Ar user : password No @
54.Oc Ar host Oo : Ar port
55.Oc No / Ar file Oo /
56.Oc
57.Sm on
58.Ar ...
59.Nm ftp
60.Op Fl C
61.Op Fl c Ar cookie
62.Op Fl o Ar output
63.Op Fl S Ar ssl_options
64.Op Fl s Ar srcaddr
65.Op Fl U Ar useragent
66.Sm off
67.No http[s]:// Oo Ar user : password No @
68.Oc Ar host Oo : Ar port
69.Oc No / Ar file
70.Sm on
71.Ar ...
72.Nm ftp
73.Op Fl C
74.Op Fl o Ar output
75.Op Fl s Ar srcaddr
76.Sm off
77.No file: Ar file
78.Sm on
79.Ar ...
80.Nm ftp
81.Op Fl C
82.Op Fl o Ar output
83.Op Fl s Ar srcaddr
84.Sm off
85.Ar host : No / Ar file Oo /
86.Oc
87.Sm on
88.Ar ...
89.Sh DESCRIPTION
90.Nm
91is the user interface to the Internet standard File Transfer
92Protocol (FTP).
93The program allows a user to transfer files to and from a
94remote network site.
95.Pp
96The latter four usage formats will fetch a file using either the
97FTP, HTTP, or HTTPS protocols into the current directory.
98This is ideal for scripts.
99Refer to
100.Sx AUTO-FETCHING FILES
101below for more information.
102.Pp
103The options are as follows:
104.Bl -tag -width Ds
105.It Fl 4
106Forces
107.Nm
108to use IPv4 addresses only.
109.It Fl 6
110Forces
111.Nm
112to use IPv6 addresses only.
113.It Fl A
114Force active mode FTP.
115By default,
116.Nm
117will try to use passive mode FTP and fall back to active mode
118if passive is not supported by the server.
119This option causes
120.Nm
121to always use an active connection.
122It is only useful for connecting
123to very old servers that do not implement passive mode properly.
124.It Fl a
125Causes
126.Nm
127to bypass the normal login procedure and use an anonymous login instead.
128.It Fl C
129Continue a previously interrupted file transfer.
130.Nm
131will continue transferring from an offset equal to the length of
132.Ar file .
133.Pp
134Resuming HTTP(S) transfers are only supported
135if the remote server supports the
136.Dq Range
137header.
138.It Fl c Ar cookie
139Load a Netscape-like cookiejar file
140for HTTP and HTTPS transfers.
141With this option relevant cookies from the jar are sent with each HTTP(S)
142request.
143Setting the
144.Ev http_cookies
145environment variable has the same effect.
146If both the
147.Ev http_cookies
148environment variable is set and the
149.Fl c
150argument is given, the latter takes precedence.
151.It Fl D Ar title
152Specify a short
153.Ar title
154for the start of the progress bar.
155.It Fl d
156Enables debugging.
157.It Fl E
158Disables EPSV/EPRT command on IPv4 connections.
159.It Fl e
160Disables command line editing.
161Useful for Emacs ange-ftp.
162.It Fl g
163Disables file name globbing.
164.It Fl i
165Turns off interactive prompting during
166multiple file transfers.
167.It Fl k Ar seconds
168When greater than zero,
169sends a byte after each
170.Ar seconds
171period over the control connection during long transfers,
172so that incorrectly configured network equipment won't
173aggressively drop it.
174The FTP protocol supports a
175.Dv NOOP
176command that can be used for that purpose.
177This assumes the FTP server can deal with extra commands coming over
178the control connection during a transfer.
179Well-behaved servers queue those commands, and process them after the
180transfer.
181By default,
182.Nm
183will send a byte every 60 seconds.
184.It Fl m
185Causes
186.Nm
187to always display the progress meter in cases where it would not do
188so by default.
189.It Fl n
190Restrains
191.Nm
192from attempting
193.Dq auto-login
194upon initial connection.
195If auto-login is enabled,
196.Nm
197will check the
198.Pa .netrc
199file (see below) in the user's home directory for an entry describing
200an account on the remote machine.
201If no entry exists,
202.Nm
203will prompt for the remote machine login name (default is the user
204identity on the local machine), and, if necessary, prompt for a password
205and an account with which to log in.
206.It Fl o Ar output
207When fetching a single file or URL, save the contents in
208.Ar output .
209To make the contents go to stdout,
210use
211.Sq -
212for
213.Ar output .
214.It Fl P Ar port
215Sets the port number to
216.Ar port .
217.It Fl p
218Enable passive mode operation for use behind connection filtering firewalls.
219This option has been deprecated as
220.Nm
221now tries to use passive mode by default, falling back to active mode
222if the server does not support passive connections.
223.It Fl r Ar seconds
224Retry to connect if failed, pausing for number of
225.Ar seconds .
226.It Fl S Ar ssl_options
227SSL/TLS options to use with HTTPS transfers.
228The following settings are available:
229.Bl -tag -width Ds
230.It Cm cafile Ns = Ns Ar /path/to/cert.pem
231PEM encoded file containing CA certificates used for certificate
232validation.
233.It Cm capath Ns = Ns Ar /path/to/certs/
234Directory containing PEM encoded CA certificates used for certificate
235validation.
236Such a directory can be prepared using the c_rehash script distributed with
237OpenSSL.
238.It Cm ciphers Ns = Ns Ar cipher_list
239Specify the list of ciphers that will be used by
240.Nm .
241See the
242.Xr openssl 1
243.Cm ciphers
244subcommand.
245.It Cm depth Ns = Ns Ar max_depth
246Maximum depth of the certificate chain allowed when performing
247validation.
248.It Cm do
249Perform server certificate validation.
250.It Cm dont
251Don't perform server certificate validation.
252.El
253.Pp
254By default, server certificate validation is performed, and if it fails
255.Nm
256will abort.
257If no
258.Cm cafile
259or
260.Cm capath
261setting is provided,
262.Pa /etc/ssl/cert.pem
263will be used.
264.It Fl s Ar srcaddr
265Use
266.Ar srcaddr
267on the local machine as the source address
268of the connection.
269Only useful on systems with more than one address.
270.It Fl t
271Enables packet tracing.
272.It Fl U Ar useragent
273Set
274.Ar useragent
275as the User-Agent for HTTP(S) URL requests.
276If not specified, the default User-Agent is
277.Dq OpenBSD ftp .
278.It Fl V
279Disable verbose mode, overriding the default of enabled when input
280is from a terminal.
281.It Fl v
282Enable verbose mode.
283This is the default if input is from a terminal.
284Forces
285.Nm
286to show all responses from the remote server, as well
287as report on data transfer statistics.
288.El
289.Pp
290The host with which
291.Nm
292is to communicate may be specified on the command line.
293If this is done,
294.Nm
295will immediately attempt to establish a connection to an
296FTP server on that host; otherwise,
297.Nm
298will enter its command interpreter and await instructions
299from the user.
300When
301.Nm
302is awaiting commands, the prompt
303.Dq ftp\*(Gt
304is provided to the user.
305The following commands are recognized
306by
307.Nm :
308.Bl -tag -width Fl
309.It Ic \&! Oo Ar command
310.Op Ar arg ...
311.Oc
312Invoke an interactive shell on the local machine.
313If there are arguments, the first is taken to be a command to execute
314directly, with the rest of the arguments as its arguments.
315.It Ic \&$ Ar macro-name Op Ar arg ...
316Execute the macro
317.Ar macro-name
318that was defined with the
319.Ic macdef
320command.
321Arguments are passed to the macro unglobbed.
322.It Ic \&? Op Ar command
323A synonym for
324.Ic help .
325.It Ic account Op Ar password
326Supply a supplemental password required by a remote system for access
327to resources once a login has been successfully completed.
328If no argument is included, the user will be prompted for an account
329password in a non-echoing input mode.
330.It Ic append Ar local-file Op Ar remote-file
331Append a local file to a file on the remote machine.
332If
333.Ar remote-file
334is left unspecified, the local file name is used in naming the
335remote file after being altered by any
336.Ic ntrans
337or
338.Ic nmap
339setting.
340File transfer uses the current settings for
341.Ic type ,
342.Ic format ,
343.Ic mode ,
344and
345.Ic structure .
346.It Ic ascii
347Set the file transfer
348.Ic type
349to network
350.Tn ASCII .
351.It Ic bell Op Ic on | off
352Arrange that a bell be sounded after each file transfer
353command is completed.
354.It Ic binary
355Set the file transfer
356.Ic type
357to support binary image transfer.
358This is the default type.
359.It Ic bye
360Terminate the FTP session with the remote server and exit
361.Nm .
362An end-of-file will also terminate the session and exit.
363.It Ic case Op Ic on | off
364Toggle remote computer file name case mapping during
365.Ic mget
366commands.
367When
368.Ic case
369is on (default is off), remote computer file names with all letters in
370upper case are written in the local directory with the letters mapped
371to lower case.
372.It Ic cd Ar remote-directory
373Change the working directory on the remote machine
374to
375.Ar remote-directory .
376.It Ic cdup
377Change the remote machine working directory to the parent of the
378current remote machine working directory.
379.It Ic chmod Ar mode file
380Change the permission modes of
381.Ar file
382on the remote
383system to
384.Ar mode .
385.It Ic close
386Terminate the FTP session with the remote server and
387return to the command interpreter.
388Any defined macros are erased.
389.It Ic cr Op Ic on | off
390Toggle carriage return stripping during
391ASCII type file retrieval.
392Records are denoted by a carriage return/linefeed sequence
393during ASCII type file transfer.
394When
395.Ic cr
396is on (the default), carriage returns are stripped from this
397sequence to conform with the
398.Ux
399single linefeed record delimiter.
400Records on non-UNIX
401remote systems may contain single linefeeds;
402when an ASCII type transfer is made, these linefeeds may be
403distinguished from a record delimiter only when
404.Ic cr
405is off.
406.It Ic debug Oo Ic on | off |
407.Ar debuglevel
408.Oc
409Toggle debugging mode.
410If an optional
411.Ar debuglevel
412is specified, it is used to set the debugging level.
413When debugging is on,
414.Nm
415prints each command sent to the remote machine,
416preceded by the string
417.Ql --\*(Gt .
418.It Ic delete Ar remote-file
419Delete the file
420.Ar remote-file
421on the remote machine.
422.It Ic dir Op Ar remote-directory Op Ar local-file
423A synonym for
424.Ic ls .
425.It Ic disconnect
426A synonym for
427.Ic close .
428.It Ic edit Op Ic on | off
429Toggle command line editing, and context sensitive command and file
430completion.
431This is automatically enabled if input is from a terminal, and
432disabled otherwise.
433.It Ic epsv4 Op Ic on | off
434Toggle use of EPSV/EPRT command on IPv4 connection.
435.It Ic exit
436A synonym for
437.Ic bye .
438.It Ic form Ar format
439Set the file transfer
440.Ic form
441to
442.Ar format .
443The default format is
444.Dq file .
445.It Ic ftp Ar host Op Ar port
446A synonym for
447.Ic open .
448.It Ic gate Oo Ic on | off |
449.Ar host Op Ar port
450.Oc
451Toggle gate-ftp mode.
452This will not be permitted if the gate-ftp server hasn't been set
453(either explicitly by the user, or from the
454.Ev FTPSERVER
455environment variable).
456If
457.Ar host
458is given,
459then gate-ftp mode will be enabled, and the gate-ftp server will be set to
460.Ar host .
461If
462.Ar port
463is also given, that will be used as the port to connect to on the
464gate-ftp server.
465.It Ic get Ar remote-file Op Ar local-file
466Retrieve the
467.Ar remote-file
468and store it on the local machine.
469If the local
470file name is not specified, it is given the same
471name it has on the remote machine, subject to
472alteration by the current
473.Ic case ,
474.Ic ntrans ,
475and
476.Ic nmap
477settings.
478The current settings for
479.Ic type ,
480.Ic form ,
481.Ic mode ,
482and
483.Ic structure
484are used while transferring the file.
485.It Ic glob Op Ic on | off
486Toggle filename expansion for
487.Ic mdelete ,
488.Ic mget
489and
490.Ic mput .
491If globbing is turned off with
492.Ic glob ,
493the file name arguments
494are taken literally and not expanded.
495Globbing for
496.Ic mput
497is done as in
498.Xr csh 1 .
499For
500.Ic mdelete
501and
502.Ic mget ,
503each remote file name is expanded
504separately on the remote machine and the lists are not merged.
505Expansion of a directory name is likely to be
506different from expansion of the name of an ordinary file:
507the exact result depends on the foreign operating system and FTP server,
508and can be previewed by doing
509.Dq mls remote-files - .
510Note:
511.Ic mget
512and
513.Ic mput
514are not meant to transfer
515entire directory subtrees of files.
516That can be done by
517transferring a
518.Xr tar 1
519archive of the subtree (in binary mode).
520.It Ic hash Oo Ic on | off |
521.Ar size
522.Oc
523Toggle hash mark
524.Pq Ql #
525printing for each data block transferred.
526The size of a data block defaults to 1024 bytes.
527This can be changed by specifying
528.Ar size
529in bytes.
530.It Ic help Op Ar command
531Print an informative message about the meaning of
532.Ar command .
533If no argument is given,
534.Nm
535prints a list of the known commands.
536.It Ic idle Op Ar seconds
537Set the inactivity timer on the remote server to
538.Ar seconds
539seconds.
540If
541.Ar seconds
542is omitted, the current inactivity timer is printed.
543.It Ic lcd Op Ar local-directory
544Change the working directory on the local machine.
545If
546no
547.Ar local-directory
548is specified, the user's home directory is used.
549.It Ic less Ar file
550A synonym for
551.Ic page .
552.It Ic lpwd
553Print the working directory on the local machine.
554.It Ic ls Op Ar remote-directory Op Ar local-file
555Print a listing of the contents of a directory on the remote machine.
556The listing includes any system-dependent information that the server
557chooses to include; for example, most
558.Ux
559systems will produce output from the command
560.Ql ls -l .
561If
562.Ar remote-directory
563is left unspecified, the current working directory is used.
564If interactive prompting is on,
565.Nm
566will prompt the user to verify that the last argument is indeed the
567target local file for receiving
568.Ic ls
569output.
570If no local file is specified, or if
571.Ar local-file
572is
573.Sq - ,
574the output is sent to the terminal.
575.It Ic macdef Ar macro-name
576Define a macro.
577Subsequent lines are stored as the macro
578.Ar macro-name ;
579a null line (consecutive newline characters
580in a file or
581carriage returns from the terminal) terminates macro input mode.
582There is a limit of 16 macros and 4096 total characters in all
583defined macros.
584Macro names can be a maximum of 8 characters.
585Macros are only applicable to the current session they are
586defined in (or if defined outside a session, to the session
587invoked with the next
588.Ic open
589command), and remain defined until a
590.Ic close
591command is executed.
592To invoke a macro,
593use the
594.Ic $
595command (see above).
596.Pp
597The macro processor interprets
598.Ql $
599and
600.Ql \e
601as special characters.
602A
603.Ql $
604followed by a number (or numbers) is replaced by the
605corresponding argument on the macro invocation command line.
606A
607.Ql $
608followed by an
609.Sq i
610tells the macro processor that the
611executing macro is to be looped.
612On the first pass
613.Ql $i
614is
615replaced by the first argument on the macro invocation command line,
616on the second pass it is replaced by the second argument, and so on.
617A
618.Ql \e
619followed by any character is replaced by that character.
620Use the
621.Ql \e
622to prevent special treatment of the
623.Ql $ .
624.It Ic mdelete Op Ar remote-files
625Delete the
626.Ar remote-files
627on the remote machine.
628.It Ic mdir Ar remote-files local-file
629A synonym for
630.Ic mls .
631.It Xo Ic mget
632.Op Fl cnr
633.Op Fl d Ar depth
634.Ar remote-files
635.Xc
636Expand the
637.Ar remote-files
638on the remote machine
639and do a
640.Ic get
641for each file name thus produced.
642See
643.Ic glob
644for details on the filename expansion.
645Resulting file names will then be processed according to
646.Ic case ,
647.Ic ntrans ,
648and
649.Ic nmap
650settings.
651Files are transferred into the local working directory,
652which can be changed with
653.Ql lcd directory ;
654new local directories can be created with
655.Ql "\&! mkdir directory" .
656.Pp
657The options are as follows:
658.Bl -tag -width Ds
659.It Fl c
660Use
661.Ic reget
662instead of
663.Ic get .
664.It Fl d Ar depth
665Specify the maximum recursion level
666.Ar depth .
667The default is 0, which means unlimited.
668.It Fl n
669Use
670.Ic newer
671instead of
672.Ic get .
673.It Fl r
674Recursively descend the directory tree, transferring all files and
675directories.
676.El
677.It Ic mkdir Ar directory-name
678Make a directory on the remote machine.
679.It Ic mls Ar remote-files local-file
680Like
681.Ic ls ,
682except multiple remote files may be specified,
683and the
684.Ar local-file
685must be specified.
686If interactive prompting is on,
687.Nm
688will prompt the user to verify that the last argument is indeed the
689target local file for receiving
690.Ic mls
691output.
692.It Ic mode Op Ar mode-name
693Set the file transfer
694.Ic mode
695to
696.Ar mode-name .
697The default mode is
698.Dq stream
699mode.
700.It Ic modtime Ar file
701Show the last modification time of
702.Ar file
703on the remote machine.
704.It Ic more Ar file
705A synonym for
706.Ic page .
707.It Xo Ic mput
708.Op Fl cr
709.Op Fl d Ar depth
710.Ar local-files
711.Xc
712Expand wild cards in the list of local files given as arguments
713and do a
714.Ic put
715for each file in the resulting list.
716See
717.Ic glob
718for details of filename expansion.
719Resulting file names will then be processed according to
720.Ic ntrans
721and
722.Ic nmap
723settings.
724.Pp
725If the
726.Fl c
727flag is specified then
728The options are as follows:
729.Bl -tag -width Ds
730.It Fl c
731Use
732.Ic reput
733instead of
734.Ic put .
735.It Fl d Ar depth
736Specify the maximum recursion level
737.Ar depth .
738The default is 0, which means unlimited.
739.It Fl r
740Recursively descend the directory tree, transferring all files and
741directories.
742.El
743.It Xo Ic msend
744.Op Fl c
745.Ar local-files
746.Xc
747A synonym for
748.Ic mput .
749.It Ic newer Ar remote-file Op Ar local-file
750Get the file only if the modification time of the remote file is more
751recent than the file on the current system.
752If the file does not
753exist on the current system, the remote file is considered
754.Ic newer .
755Otherwise, this command is identical to
756.Ar get .
757.It Ic nlist Op Ar remote-directory Op Ar local-file
758Print a list of the files in a
759directory on the remote machine.
760If
761.Ar remote-directory
762is left unspecified, the current working directory is used.
763If interactive prompting is on,
764.Nm
765will prompt the user to verify that the last argument is indeed the
766target local file for receiving
767.Ic nlist
768output.
769If no local file is specified, or if
770.Ar local-file
771is
772.Sq - ,
773the output is sent to the terminal.
774Note that on some servers, the
775.Ic nlist
776command will only return information on normal files (not directories
777or special files).
778.It Ic nmap Op Ar inpattern outpattern
779Set or unset the filename mapping mechanism.
780If no arguments are specified, the filename mapping mechanism is unset.
781If arguments are specified, remote filenames are mapped during
782.Ic mput
783commands and
784.Ic put
785commands issued without a specified remote target filename.
786If arguments are specified, local filenames are mapped during
787.Ic mget
788commands and
789.Ic get
790commands issued without a specified local target filename.
791This command is useful when connecting to a non-UNIX remote computer
792with different file naming conventions or practices.
793.Pp
794The mapping follows the pattern set by
795.Ar inpattern
796and
797.Ar outpattern .
798.Ar inpattern
799is a template for incoming filenames (which may have already been
800processed according to the
801.Ic ntrans
802and
803.Ic case
804settings).
805Variable templating is accomplished by including the
806sequences
807.Ql $1 ,
808.Ql $2 ,
809\&...,
810.Ql $9
811in
812.Ar inpattern .
813Use
814.Ql \e
815to prevent this special treatment of the
816.Ql $
817character.
818All other characters are treated literally, and are used to determine the
819.Ic nmap
820.Ar inpattern
821variable values.
822.Pp
823For example, given
824.Ar inpattern
825$1.$2 and the remote file name "mydata.data", $1 would have the value
826"mydata", and $2 would have the value "data".
827The
828.Ar outpattern
829determines the resulting mapped filename.
830The sequences
831.Ql $1 ,
832.Ql $2 ,
833\&...,
834.Ql $9
835are replaced by any value resulting from the
836.Ar inpattern
837template.
838The sequence
839.Ql $0
840is replaced by the original filename.
841Additionally, the sequence
842.Sq Op Ar seq1 , Ar seq2
843is replaced by
844.Ar seq1
845if
846.Ar seq1
847is not a null string; otherwise it is replaced by
848.Ar seq2 .
849For example:
850.Pp
851.Dl nmap $1.$2.$3 [$1,$2].[$2,file]
852.Pp
853This command would yield the output filename
854.Pa myfile.data
855for input filenames
856.Pa myfile.data
857and
858.Pa myfile.data.old ;
859.Pa myfile.file
860for the input filename
861.Pa myfile ;
862and
863.Pa myfile.myfile
864for the input filename
865.Pa .myfile .
866Spaces may be included in
867.Ar outpattern
868by quoting them,
869as in the following example:
870.Bd -literal -offset indent
871nmap $1.$2 "$1 $2"
872.Ed
873.Pp
874Use the
875.Ql \e
876character to prevent special treatment
877of the
878.Ql $ ,
879.Ql \&[ ,
880.Ql \&] ,
881and
882.Ql \&,
883characters.
884.It Ic ntrans Op Ar inchars Op Ar outchars
885Set or unset the filename character translation mechanism.
886If no arguments are specified, the filename character
887translation mechanism is unset.
888If arguments are specified, characters in
889remote filenames are translated during
890.Ic mput
891commands and
892.Ic put
893commands issued without a specified remote target filename.
894If arguments are specified, characters in
895local filenames are translated during
896.Ic mget
897commands and
898.Ic get
899commands issued without a specified local target filename.
900This command is useful when connecting to a non-UNIX remote computer
901with different file naming conventions or practices.
902Characters in a filename matching a character in
903.Ar inchars
904are replaced with the corresponding character in
905.Ar outchars .
906If the character's position in
907.Ar inchars
908is longer than the length of
909.Ar outchars ,
910the character is deleted from the file name.
911.It Ic open Ar host Op Ar port
912Establish a connection to the specified
913.Ar host
914FTP server.
915An optional port number may be supplied,
916in which case
917.Nm
918will attempt to contact an FTP server at that port.
919If the
920.Ic auto-login
921option is on (default),
922.Nm
923will also attempt to automatically log the user in to
924the FTP server (see below).
925.It Ic page Ar file
926Retrieve
927.Ic file
928and display with the program defined in
929.Ev PAGER
930(defaulting to
931.Xr more 1
932if
933.Ev PAGER
934is null or not defined).
935.It Ic passive Op Ic on | off
936Toggle passive mode.
937If passive mode is turned on (default is on),
938.Nm
939will send a
940.Dv EPSV
941command for all data connections instead of the usual
942.Dv PORT
943command.
944The
945.Dv PASV
946command requests that the remote server open a port for the data connection
947and return the address of that port.
948The remote server listens on that port and the client connects to it.
949When using the more traditional
950.Dv PORT
951command, the client listens on a port and sends that address to the remote
952server, who connects back to it.
953Passive mode is useful when using
954.Nm
955through a gateway router or host that controls the directionality of
956traffic.
957(Note that though FTP servers are required to support the
958.Dv PASV
959command by RFC 1123, some do not.)
960.It Ic preserve Op Ic on | off
961Toggle preservation of modification times on retrieved files.
962.It Ic progress Op Ic on | off
963Toggle display of transfer progress bar.
964The progress bar will be disabled for a transfer that has
965.Ar local-file
966as
967.Sq -
968or a command that starts with
969.Sq \&| .
970Refer to
971.Sx FILE NAMING CONVENTIONS
972for more information.
973.It Ic prompt Op Ic on | off
974Toggle interactive prompting.
975Interactive prompting
976occurs during multiple file transfers to allow the
977user to selectively retrieve or store files.
978If prompting is turned off (default is on), any
979.Ic mget
980or
981.Ic mput
982will transfer all files, and any
983.Ic mdelete
984will delete all files.
985.Pp
986When prompting is on, the following commands are available at a prompt:
987.Bl -tag -width 2n -offset indent
988.It Ic ?\&
989Print help message.
990.It Ic a
991Answer
992.Dq yes
993to the current file and automatically answer
994.Dq yes
995to any remaining files for the current command.
996.It Ic n
997Do not transfer the file.
998.It Ic p
999Answer
1000.Dq yes
1001to the current file and turn off prompt mode
1002(as if
1003.Dq prompt off
1004had been given).
1005.It Ic q
1006Answer
1007.Dq no
1008to the current file and automatically answer
1009.Dq no
1010to any remaining files for the current command.
1011.It Ic y
1012Transfer the file.
1013.El
1014.It Ic proxy Ar command
1015Execute an FTP command on a secondary control connection.
1016This command allows simultaneous connection to two remote FTP
1017servers for transferring files between the two servers.
1018The first
1019.Ic proxy
1020command should be an
1021.Ic open ,
1022to establish the secondary control connection.
1023Enter the command
1024.Ic proxy ?\&
1025to see other FTP commands executable on the
1026secondary connection.
1027The following commands behave differently when prefaced by
1028.Ic proxy :
1029.Ic open
1030will not define new macros during the auto-login process;
1031.Ic close
1032will not erase existing macro definitions;
1033.Ic get
1034and
1035.Ic mget
1036transfer files from the host on the primary control connection
1037to the host on the secondary control connection; and
1038.Ic put ,
1039.Ic mput ,
1040and
1041.Ic append
1042transfer files from the host on the secondary control connection
1043to the host on the primary control connection.
1044Third party file transfers depend upon support of the FTP protocol
1045.Dv PASV
1046command by the server on the secondary control connection.
1047.It Ic put Ar local-file Op Ar remote-file
1048Store a local file on the remote machine.
1049If
1050.Ar remote-file
1051is left unspecified, the local file name is used
1052after processing according to any
1053.Ic ntrans
1054or
1055.Ic nmap
1056settings
1057in naming the remote file.
1058File transfer uses the
1059current settings for
1060.Ic type ,
1061.Ic format ,
1062.Ic mode ,
1063and
1064.Ic structure .
1065.It Ic pwd
1066Print the name of the current working directory on the remote
1067machine.
1068.It Ic quit
1069A synonym for
1070.Ic bye .
1071.It Ic quote Ar arg ...
1072The arguments specified are sent, verbatim, to the remote FTP server.
1073.It Ic recv Ar remote-file Op Ar local-file
1074A synonym for
1075.Ic get .
1076.It Ic reget Ar remote-file Op Ar local-file
1077Reget acts like get, except that if
1078.Ar local-file
1079exists and is
1080smaller than
1081.Ar remote-file ,
1082.Ar local-file
1083is presumed to be
1084a partially transferred copy of
1085.Ar remote-file
1086and the transfer
1087is continued from the apparent point of failure.
1088This command
1089is useful when transferring very large files over networks that
1090are prone to dropping connections.
1091.It Ic rename Ar from-name to-name
1092Rename the file
1093.Ar from-name
1094on the remote machine to the file
1095.Ar to-name .
1096.It Ic reput Ar local-file Op Ar remote-file
1097Reput acts like put, except that if
1098.Ar remote-file
1099exists and is
1100smaller than
1101.Ar local-file ,
1102.Ar remote-file
1103is presumed to be
1104a partially transferred copy of
1105.Ar local-file
1106and the transfer
1107is continued from the apparent point of failure.
1108This command
1109is useful when transferring very large files over networks that
1110are prone to dropping connections.
1111.It Ic reset
1112Clear reply queue.
1113This command re-synchronizes command/reply sequencing with the remote
1114FTP server.
1115Resynchronization may be necessary following a violation of the FTP protocol
1116by the remote server.
1117.It Ic restart Ar marker
1118Restart the immediately following
1119.Ic get
1120or
1121.Ic put
1122at the
1123indicated
1124.Ar marker .
1125On
1126.Ux
1127systems,
1128.Ar marker
1129is usually a byte
1130offset into the file.
1131.It Ic rhelp Op Ar command-name
1132Request help from the remote FTP server.
1133If a
1134.Ar command-name
1135is specified, it is supplied to the server as well.
1136.It Ic rmdir Ar directory-name
1137Delete a directory on the remote machine.
1138.It Ic rstatus Op Ar file
1139With no arguments, show status of remote machine.
1140If
1141.Ar file
1142is specified, show status of
1143.Ar file
1144on remote machine.
1145.It Ic runique Op Ic on | off
1146Toggle storing of files on the local system with unique filenames.
1147If a file already exists with a name equal to the target
1148local filename for a
1149.Ic get
1150or
1151.Ic mget
1152command, a
1153.Dq .1
1154is appended to the name.
1155If the resulting name matches another existing file,
1156a
1157.Dq .2
1158is appended to the original name.
1159If this process continues up to
1160.Dq .99 ,
1161an error message is printed, and the transfer does not take place.
1162The generated unique filename will be reported.
1163Note that
1164.Ic runique
1165will not affect local files generated from a shell command
1166(see below).
1167The default value is off.
1168.It Ic send Ar local-file Op Ar remote-file
1169A synonym for
1170.Ic put .
1171.It Ic sendport Op Ic on | off
1172Toggle the use of
1173.Dv PORT
1174commands.
1175By default,
1176.Nm
1177will attempt to use a
1178.Dv PORT
1179command when establishing
1180a connection for each data transfer.
1181The use of
1182.Dv PORT
1183commands can prevent delays
1184when performing multiple file transfers.
1185If the
1186.Dv PORT
1187command fails,
1188.Nm
1189will use the default data port.
1190When the use of
1191.Dv PORT
1192commands is disabled, no attempt will be made to use
1193.Dv PORT
1194commands for each data transfer.
1195This is useful for certain FTP implementations which do ignore
1196.Dv PORT
1197commands but, incorrectly, indicate they've been accepted.
1198.It Ic site Ar arg ...
1199The arguments specified are sent, verbatim, to the remote FTP server as a
1200.Dv SITE
1201command.
1202.It Ic size Ar file
1203Return size of
1204.Ar file
1205on remote machine.
1206.It Ic status
1207Show the current status of
1208.Nm .
1209.\" .It Ic struct Op Ar struct-name
1210.\" Set the file transfer
1211.\" .Ar structure
1212.\" to
1213.\" .Ar struct-name .
1214.\" By default,
1215.\" .Dq file
1216.\" structure is used.
1217.It Ic sunique Op Ic on | off
1218Toggle storing of files on remote machine under unique file names.
1219The remote FTP server must support the FTP protocol
1220.Dv STOU
1221command for
1222successful completion.
1223The remote server will report the unique name.
1224Default value is off.
1225.It Ic system
1226Show the type of operating system running on the remote machine.
1227.It Ic tenex
1228Set the file transfer type to that needed to
1229talk to
1230.Tn TENEX
1231machines.
1232.It Ic trace Op Ic on | off
1233Toggle packet tracing.
1234.It Ic type Op Ar type-name
1235Set the file transfer
1236.Ic type
1237to
1238.Ar type-name .
1239If no type is specified, the current type
1240is printed.
1241The default type is
1242.Dq binary .
1243.It Ic umask Op Ar newmask
1244Set the default umask on the remote server to
1245.Ar newmask .
1246If
1247.Ar newmask
1248is omitted, the current umask is printed.
1249.It Xo
1250.Ic user Ar username
1251.Op Ar password Op Ar account
1252.Xc
1253Identify yourself to the remote FTP server.
1254If the
1255.Ar password
1256is not specified and the server requires it,
1257.Nm
1258will prompt the user for it (after disabling local echo).
1259If an
1260.Ar account
1261field is not specified, and the FTP server requires it,
1262the user will be prompted for it.
1263If an
1264.Ar account
1265field is specified, an account command will
1266be relayed to the remote server after the login sequence
1267is completed if the remote server did not require it
1268for logging in.
1269Unless
1270.Nm
1271is invoked with
1272.Dq auto-login
1273disabled, this process is done automatically on initial connection to the
1274FTP server.
1275.It Ic verbose Op Ic on | off
1276Toggle verbose mode.
1277In verbose mode, all responses from
1278the FTP server are displayed to the user.
1279In addition,
1280if verbose is on, when a file transfer completes, statistics
1281regarding the efficiency of the transfer are reported.
1282By default,
1283verbose is on.
1284.El
1285.Pp
1286Command arguments which have embedded spaces may be quoted with
1287quote
1288.Pq Ql \&"
1289marks.
1290.Pp
1291Commands which toggle settings can take an explicit
1292.Ic on
1293or
1294.Ic off
1295argument to force the setting appropriately.
1296.Pp
1297If
1298.Nm
1299receives a
1300.Dv SIGINFO
1301(see the
1302.Dq status
1303argument of
1304.Xr stty 1 )
1305signal whilst a transfer is in progress, the current transfer rate
1306statistics will be written to the standard error output, in the
1307same format as the standard completion message.
1308.Sh AUTO-FETCHING FILES
1309In addition to standard commands, this version of
1310.Nm
1311supports an auto-fetch feature.
1312To enable auto-fetch, simply pass the list of hostnames/files
1313on the command line.
1314.Pp
1315The following formats are valid syntax for an auto-fetch element:
1316.Bl -tag -width Ds
1317.It host:/file[/]
1318.Dq Classic
1319.Nm
1320format.
1321.It ftp://[user:password@]host[:port]/file[/]
1322An FTP URL, retrieved using the FTP protocol if
1323.Ev ftp_proxy
1324isn't defined.
1325Otherwise, transfer using HTTP via the proxy defined in
1326.Ev ftp_proxy .
1327If a
1328.Ar user
1329and
1330.Ar password
1331are given and
1332.Ev ftp_proxy
1333isn't defined,
1334log in as
1335.Ar user
1336with a password of
1337.Ar password .
1338.It http://[user:password@]host[:port]/file
1339An HTTP URL, retrieved using the HTTP protocol.
1340If
1341.Ev http_proxy
1342is defined, it is used as a URL to an HTTP proxy server.
1343If a
1344.Ar user
1345and
1346.Ar password
1347are given and
1348.Ev http_proxy
1349isn't defined,
1350log in as
1351.Ar user
1352with a password of
1353.Ar password
1354using Basic authentication.
1355.It https://[user:password@]host[:port]/file
1356An HTTPS URL, retrieved using the HTTPS protocol.
1357If
1358.Ev http_proxy
1359is defined, this HTTPS proxy server will be used to fetch the
1360file using the CONNECT method.
1361If a
1362.Ar user
1363and
1364.Ar password
1365are given and
1366.Ev http_proxy
1367isn't defined,
1368log in as
1369.Ar user
1370with a password of
1371.Ar password
1372using Basic authentication.
1373.It file:file
1374.Ar file
1375is retrieved from a mounted file system.
1376.El
1377.Pp
1378If a classic format or an FTP URL format has a trailing
1379.Sq / ,
1380then
1381.Nm
1382will connect to the site and
1383.Ic cd
1384to the directory given as the path, and leave the user in interactive
1385mode ready for further input.
1386.Pp
1387If successive auto-fetch FTP elements refer to the same host, then
1388the connection is maintained between transfers, reducing overhead on
1389connection creation and deletion.
1390.Pp
1391If
1392.Ar file
1393contains a glob character and globbing is enabled
1394(see
1395.Ic glob ) ,
1396then the equivalent of
1397.Ic mget Ar file
1398is performed.
1399.Pp
1400If no
1401.Fl o
1402option is specified, and
1403the directory component of
1404.Ar file
1405contains no globbing characters,
1406then
1407it is stored in the current directory as the
1408.Xr basename 1
1409of
1410.Ar file .
1411If
1412.Fl o Ar output
1413is specified, then
1414.Ar file
1415is stored as
1416.Ar output .
1417Otherwise, the remote name is used as the local name.
1418.Sh ABORTING A FILE TRANSFER
1419To abort a file transfer, use the terminal interrupt key
1420(usually Ctrl-C).
1421Sending transfers will be immediately halted.
1422Receiving transfers will be halted by sending an FTP protocol
1423.Dv ABOR
1424command to the remote server, and discarding any further data received.
1425The speed at which this is accomplished depends upon the remote
1426server's support for
1427.Dv ABOR
1428processing.
1429If the remote server does not support the
1430.Dv ABOR
1431command, an
1432.Ql ftp\*(Gt
1433prompt will not appear until the remote server has completed
1434sending the requested file.
1435.Pp
1436The terminal interrupt key sequence will be ignored when
1437.Nm
1438has completed any local processing and is awaiting a reply
1439from the remote server.
1440A long delay in this mode may result from the ABOR processing described
1441above, or from unexpected behavior by the remote server, including
1442violations of the FTP protocol.
1443If the delay results from unexpected remote server behavior, the local
1444.Nm
1445program must be killed by hand.
1446.Sh FILE NAMING CONVENTIONS
1447Files specified as arguments to
1448.Nm
1449commands are processed according to the following rules.
1450.Bl -enum
1451.It
1452If the file name
1453.Sq -
1454is specified, the standard input (for reading)
1455or standard output (for writing)
1456is used.
1457.It
1458If the first character of the file name is
1459.Sq \&| ,
1460the
1461remainder of the argument is interpreted as a shell command.
1462.Nm
1463then forks a shell, using
1464.Xr popen 3
1465with the argument supplied, and reads (writes) from the standard output
1466(standard input).
1467If the shell command includes spaces, the argument
1468must be quoted; e.g.,
1469.Qq ls -lt .
1470A particularly
1471useful example of this mechanism is:
1472.Qq dir |more .
1473.It
1474Failing the above checks, if
1475.Dq globbing
1476is enabled,
1477local file names are expanded
1478according to the rules used in the
1479.Xr csh 1 ;
1480c.f. the
1481.Ic glob
1482command.
1483If the
1484.Nm
1485command expects a single local file (e.g.,
1486.Ic put ) ,
1487only the first filename generated by the
1488.Dq globbing
1489operation is used.
1490.It
1491For
1492.Ic mget
1493commands and
1494.Ic get
1495commands with unspecified local file names, the local filename is
1496the remote filename, which may be altered by a
1497.Ic case ,
1498.Ic ntrans ,
1499or
1500.Ic nmap
1501setting.
1502The resulting filename may then be altered if
1503.Ic runique
1504is on.
1505.It
1506For
1507.Ic mput
1508commands and
1509.Ic put
1510commands with unspecified remote file names, the remote filename is
1511the local filename, which may be altered by a
1512.Ic ntrans
1513or
1514.Ic nmap
1515setting.
1516The resulting filename may then be altered by the remote server if
1517.Ic sunique
1518is on.
1519.El
1520.Sh FILE TRANSFER PARAMETERS
1521The FTP specification specifies many parameters which may
1522affect a file transfer.
1523The
1524.Ic type
1525may be one of
1526.Dq ascii ,
1527.Dq binary ,
1528.Dq image ,
1529.Dq ebcdic
1530.Pq currently not supported
1531or
1532.Dq tenex
1533(local byte size 8, for PDP-10's and PDP-20's mostly).
1534.Nm
1535supports the ASCII and image types of file transfer,
1536plus local byte size 8 for
1537.Ic tenex
1538mode transfers.
1539.Pp
1540.Nm
1541supports only the default values for the remaining
1542file transfer parameters:
1543.Ic mode ,
1544.Ic form ,
1545and
1546.Ic struct .
1547.Sh THE .netrc FILE
1548The
1549.Pa .netrc
1550file contains login and initialization information
1551used by the auto-login process.
1552It resides in the user's home directory.
1553The following tokens are recognized; they may be separated by spaces,
1554tabs, or new-lines:
1555.Bl -tag -width password
1556.It Ic machine Ar name
1557Identify a remote machine
1558.Ar name .
1559The auto-login process searches the
1560.Pa .netrc
1561file for a
1562.Ic machine
1563token that matches the remote machine specified on the
1564.Nm
1565command line or as an
1566.Ic open
1567command argument.
1568Once a match is made, the subsequent
1569.Pa .netrc
1570tokens are processed,
1571stopping when the end of file is reached or another
1572.Ic machine
1573or a
1574.Ic default
1575token is encountered.
1576.It Ic default
1577This is the same as
1578.Ic machine
1579.Ar name
1580except that
1581.Ic default
1582matches any name.
1583There can be only one
1584.Ic default
1585token, and it must be after all
1586.Ic machine
1587tokens.
1588This is normally used as:
1589.Pp
1590.Dl default login anonymous password user@site
1591.Pp
1592thereby giving the user
1593.Ar automatic
1594anonymous FTP login to
1595machines not specified in
1596.Pa .netrc .
1597This can be overridden
1598by using the
1599.Fl n
1600flag to disable auto-login.
1601.It Ic login Ar name
1602Identify a user on the remote machine.
1603If this token is present, the auto-login process will initiate
1604a login using the specified
1605.Ar name .
1606.It Ic password Ar string
1607Supply a password.
1608If this token is present, the auto-login process will supply the
1609specified string if the remote server requires a password as part
1610of the login process.
1611Note that if this token is present in the
1612.Pa .netrc
1613file for any user other
1614than
1615.Ar anonymous ,
1616.Nm
1617will abort the auto-login process if the
1618.Pa .netrc
1619is readable by
1620anyone besides the user.
1621.It Ic account Ar string
1622Supply an additional account password.
1623If this token is present, the auto-login process will supply the
1624specified string if the remote server requires an additional
1625account password, or the auto-login process will initiate an
1626.Dv ACCT
1627command if it does not.
1628.It Ic macdef Ar name
1629Define a macro.
1630This token functions like the
1631.Nm
1632.Ic macdef
1633command functions.
1634A macro is defined with the specified name; its contents begin with the
1635next
1636.Pa .netrc
1637line and continue until a null line (consecutive new-line
1638characters) is encountered.
1639Like the other tokens in the
1640.Pa .netrc
1641file, a
1642.Ic macdef
1643is applicable only to the
1644.Ic machine
1645definition preceding it.
1646A
1647.Ic macdef
1648entry cannot be utilized by multiple
1649.Ic machine
1650definitions; rather, it must be defined following each
1651.Ic machine
1652it is intended to be used with.
1653If a macro named
1654.Ic init
1655is defined, it is automatically executed as the last step in the
1656auto-login process.
1657.El
1658.Sh COMMAND LINE EDITING
1659.Nm
1660supports interactive command line editing, via the
1661.Xr editline 3
1662library.
1663It is enabled with the
1664.Ic edit
1665command, and is enabled by default if input is from a tty.
1666Previous lines can be recalled and edited with the arrow keys,
1667and other GNU Emacs-style editing keys may be used as well.
1668.Pp
1669The
1670.Xr editline 3
1671library is configured with a
1672.Pa .editrc
1673file \- refer to
1674.Xr editrc 5
1675for more information.
1676.Pp
1677An extra key binding is available to
1678.Nm
1679to provide context sensitive command and filename completion
1680(including remote file completion).
1681To use this, bind a key to the
1682.Xr editline 3
1683command
1684.Ic ftp-complete .
1685By default, this is bound to the TAB key.
1686.Sh ENVIRONMENT
1687.Nm
1688utilizes the following environment variables:
1689.Bl -tag -width "FTPSERVERPORT"
1690.It Ev FTPMODE
1691Overrides the default operation mode.
1692Recognized values are:
1693.Pp
1694.Bl -tag -width "passive  " -offset indent -compact
1695.It passive
1696passive mode FTP only
1697.It active
1698active mode FTP only
1699.It auto
1700automatic determination of passive or active (this is the default)
1701.It gate
1702gate-ftp mode
1703.El
1704.It Ev FTPSERVER
1705Host to use as gate-ftp server when
1706.Ic gate
1707is enabled.
1708.It Ev FTPSERVERPORT
1709Port to use when connecting to gate-ftp server when
1710.Ic gate
1711is enabled.
1712Default is port returned by a
1713.Fn getservbyname
1714lookup of
1715.Dq ftpgate/tcp .
1716.It Ev HOME
1717For default location of a
1718.Pa .netrc
1719file, if one exists.
1720.It Ev PAGER
1721Used by
1722.Ic page
1723to display files.
1724.It Ev SHELL
1725For default shell.
1726.It Ev TMPDIR
1727Directory in which temporary files are stored.
1728.It Ev ftp_proxy
1729URL of FTP proxy to use when making FTP URL requests
1730(if not defined, use the standard FTP protocol).
1731.It Ev http_proxy
1732URL of HTTP proxy to use when making HTTP or HTTPS URL requests.
1733.It Ev http_cookies
1734Path of a Netscape-like cookiejar file to use when making
1735HTTP or HTTPS URL requests.
1736.El
1737.Sh PORT ALLOCATION
1738For active mode data connections,
1739.Nm
1740will listen to a random high TCP port.
1741The interval of ports used are configurable using
1742.Xr sysctl 8
1743variables
1744.Va net.inet.ip.porthifirst
1745and
1746.Va net.inet.ip.porthilast .
1747.Sh SEE ALSO
1748.Xr basename 1 ,
1749.Xr csh 1 ,
1750.Xr more 1 ,
1751.Xr stty 1 ,
1752.Xr tar 1 ,
1753.Xr tftp 1 ,
1754.Xr editline 3 ,
1755.Xr getservbyname 3 ,
1756.Xr popen 3 ,
1757.Xr editrc 5 ,
1758.Xr services 5 ,
1759.Xr ftp-proxy 8 ,
1760.Xr ftpd 8
1761.Sh STANDARDS
1762.Rs
1763.%A J. Postel
1764.%A J. Reynolds
1765.%D October 1985
1766.%R RFC 959
1767.%T FILE TRANSFER PROTOCOL (FTP)
1768.Re
1769.Pp
1770.Rs
1771.%A P. Hethmon
1772.%D March 2007
1773.%R RFC 3659
1774.%T Extensions to FTP
1775.Re
1776.Sh HISTORY
1777The
1778.Nm
1779command appeared in
1780.Bx 4.2 .
1781.Sh BUGS
1782Correct execution of many commands depends upon proper behavior
1783by the remote server.
1784.Pp
1785In the recursive mode of
1786.Ic mget ,
1787files and directories starting with whitespace are ignored
1788because the list cannot be parsed any other way.
1789