summaryrefslogtreecommitdiff
path: root/usr/src/man/man1/ftp.1
blob: 3e04f0306f1f8787352517f41b6b923f832285a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
'\" te
.\" Copyright 1989 AT&T
.\" Copyright (c) 2006, Sun Microsystems, Inc. All Rights Reserved
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH FTP 1 "Jun 6, 2006"
.SH NAME
ftp \- file transfer program
.SH SYNOPSIS
.LP
.nf
\fBftp\fR [\fB-adfginpstvx\fR] [\fB-m\fR \fIGSS Mech\fR] [\fB-T\fR \fItimeout\fR]
     [\fIhostname\fR [\fIport\fR]]
.fi

.SH DESCRIPTION
.LP
The \fBftp\fR command is the user interface to the \fBInternet\fR standard File
Transfer Protocol (\fBFTP\fR). \fBftp\fR transfers files to and from a remote
network site.
.sp
.LP
The host and optional port with which \fBftp\fR is to communicate can be
specified on the command line. If this is done, \fBftp\fR immediately attempts
to establish a connection to an \fBFTP\fR server on that host. Otherwise,
\fBftp\fR enters its command interpreter and awaits instructions from the user.
When \fBftp\fR is awaiting commands from the user, it displays the prompt
\fBftp>\fR.
.SH OPTIONS
.LP
The following options can be specified at the command line, or to the command
interpreter:
.sp
.ne 2
.na
\fB\fB-a\fR\fR
.ad
.RS 14n
Uses \fBGSSAPI\fR authentication \fBonly\fR. If the authentication fails, this
option closes the connection.
.RE

.sp
.ne 2
.na
\fB\fB-d\fR\fR
.ad
.RS 14n
Enables debugging.
.RE

.sp
.ne 2
.na
\fB\fB-f\fR\fR
.ad
.RS 14n
Forwards local security credentials to the remote server.
.RE

.sp
.ne 2
.na
\fB\fB-g\fR\fR
.ad
.RS 14n
Disables filename "globbing".
.RE

.sp
.ne 2
.na
\fB\fB-i\fR\fR
.ad
.RS 14n
Turns off interactive prompting during multiple file transfers.
.RE

.sp
.ne 2
.na
\fB\fB-m\fR\fR
.ad
.RS 14n
Specifies the \fBGSS\fR-\fBAPI\fR mechanism to use. The default is to use the
kerberos_v5 mechanism. Supported alternatives are defined in
\fB/etc/gss/mech\fR (see \fBmech\fR(5)).
.RE

.sp
.ne 2
.na
\fB\fB-n\fR\fR
.ad
.RS 14n
Does not attempt "auto-login" upon initial connection. If auto-login is not
disabled, \fBftp\fR checks the \fB\&.netrc\fR file in the user's home directory
for an entry describing an account on the remote machine. If no entry exists,
\fBftp\fR prompts for the login name of the account on the remote machine (the
default is the login name on the local machine), and, if necessary, prompts for
a password and an account with which to login.
.RE

.sp
.ne 2
.na
\fB\fB-p\fR\fR
.ad
.RS 14n
Enables passive mode for data transfers. This command is useful when connecting
to a remote host from behind a connection filtering firewall.
.RE

.sp
.ne 2
.na
\fB\fB-s\fR\fR
.ad
.RS 14n
Skips the \fBSYST\fR command that is sent by default to all remote servers upon
connection. The system command is what enables the automatic use of binary mode
rather than the protocol default ascii mode.
.sp
As some older servers cannot handle the \fBftp\fR command, this directive is
provided to allow inter-operability with these servers.
.RE

.sp
.ne 2
.na
\fB\fB-t\fR\fR
.ad
.RS 14n
Enables packet tracing (unimplemented).
.RE

.sp
.ne 2
.na
\fB\fB-T\fR \fItimeout\fR\fR
.ad
.RS 14n
Enables global connection timer, specified in seconds (decimal). There is a
timer for the control connection that is reset when anything is sent to the
server and disabled while the client is prompting for user input. Another
independent timer is used to monitor incoming or outgoing data connections.
.RE

.sp
.ne 2
.na
\fB\fB-v\fR\fR
.ad
.RS 14n
Shows all responses from the remote server, as well as report on data transfer
statistics. This is turned on by default if \fBftp\fR is running interactively
with its input coming from the user's terminal.
.RE

.sp
.ne 2
.na
\fB\fB-x\fR\fR
.ad
.RS 14n
Attempts to use \fBGSSAPI\fR for authentication and encryption. Data and
Command channel protection is set to "\fBprivate\fR".
.RE

.sp
.LP
The following commands can be specified to the command interpreter:
.sp
.ne 2
.na
\fB\fB!\fR\fR
.ad
.sp .6
.RS 4n
[ \fIcommand\fR ] Runs \fIcommand\fR as a shell command on the local machine.
If no \fIcommand\fR is given, invokes an interactive shell.
.RE

.sp
.ne 2
.na
\fB\fB$\fR \fImacro-name\fR [ \fIargs\fR ]\fR
.ad
.sp .6
.RS 4n
Executes the macro \fImacro-name\fR that was defined with the \fBmacdef\fR
command. Arguments are passed to the macro unglobbed.
.RE

.sp
.ne 2
.na
\fB\fBaccount\fR [ \fIpasswd\fR ]\fR
.ad
.sp .6
.RS 4n
Supplies a supplemental password required by a remote system for access to
resources once a login has been successfully completed. If no argument is
included, the user is prompted for an account password in a non-echoing input
mode.
.RE

.sp
.ne 2
.na
\fB\fBappend\fR \fIlocal-file\fR [ \fIremote-file\fR ]\fR
.ad
.sp .6
.RS 4n
Appends a local file to a file on the remote machine. If \fIremote-file\fR is
not specified, the local file name is used, subject to alteration by any
\fBntrans\fR or \fBnmap\fR settings. File transfer uses the current settings
for "representation type", "file structure", and "transfer mode".
.RE

.sp
.ne 2
.na
\fB\fBascii\fR\fR
.ad
.sp .6
.RS 4n
Sets the "representation type" to "network \fBASCII\fR". This is the default
type.
.RE

.sp
.ne 2
.na
\fB\fBbell\fR\fR
.ad
.sp .6
.RS 4n
Sounds a bell after each file transfer command is completed.
.RE

.sp
.ne 2
.na
\fB\fBbinary\fR\fR
.ad
.sp .6
.RS 4n
Sets the "representation type" to "image".
.RE

.sp
.ne 2
.na
\fB\fBbye\fR\fR
.ad
.sp .6
.RS 4n
Terminates the \fBFTP\fR session with the remote server and exit \fBftp\fR. An
\fBEOF\fR also terminates the session and exit.
.RE

.sp
.ne 2
.na
\fB\fBcase\fR\fR
.ad
.sp .6
.RS 4n
Toggles remote computer file name case mapping during \fBmget\fR commands. When
\fBcase\fR is on (default is off), remote computer file names with all letters
in upper case are written in the local directory with the letters mapped to
lower case.
.RE

.sp
.ne 2
.na
\fB\fBcd\fR \fIremote-directory\fR\fR
.ad
.sp .6
.RS 4n
Changes the working directory on the remote machine to \fIremote-directory\fR.
.RE

.sp
.ne 2
.na
\fB\fBcdup\fR\fR
.ad
.sp .6
.RS 4n
Changes the remote machine working directory to the parent of the current
remote machine working directory.
.RE

.sp
.ne 2
.na
\fB\fBclear\fR\fR
.ad
.sp .6
.RS 4n
Sets the protection level on data transfers to "\fBclear\fR". If no \fBADAT\fR
command succeeded, then this is the default protection level.
.RE

.sp
.ne 2
.na
\fB\fBclose\fR\fR
.ad
.sp .6
.RS 4n
Terminates the \fBFTP\fR session with the remote server, and return to the
command interpreter. Any defined macros are erased.
.RE

.sp
.ne 2
.na
\fB\fBcr\fR\fR
.ad
.sp .6
.RS 4n
Toggles RETURN stripping during "network \fBASCII\fR" type file retrieval.
Records are denoted by a RETURN/\fBLINEFEED\fR sequence during "network
\fBASCII\fR" type file transfer. When \fBcr\fR is on (the default), RETURN
characters are stripped from this sequence to conform with the UNIX system
single \fBLINEFEED\fR record delimiter. Records on non-UNIX-system remote hosts
can contain single \fBLINEFEED\fR characters; when an "network \fBASCII\fR"
type transfer is made, these \fBLINEFEED\fR characters can be distinguished
from a record delimiter only when \fBcr\fR is off.
.RE

.sp
.ne 2
.na
\fB\fBdelete\fR \fIremote-file\fR\fR
.ad
.sp .6
.RS 4n
Deletes the file \fIremote-file\fR on the remote machine.
.RE

.sp
.ne 2
.na
\fB\fBdebug\fR\fR
.ad
.sp .6
.RS 4n
Toggles debugging mode. When debugging is on, \fBftp\fR prints each command
sent to the remote machine, preceded by the string \fB->\fR\&.
.RE

.sp
.ne 2
.na
\fB\fBdir\fR [ \fIremote-directory\fR [ \fIlocal-file\fR ]]\fR
.ad
.sp .6
.RS 4n
Prints a listing of the directory contents in the directory,
\fIremote-directory\fR, and, optionally, placing the output in
\fIlocal-file\fR. If no directory is specified, the current working directory
on the remote machine is used. If no local file is specified, or
\fIlocal-file\fR is \fB\(mi\fR, output is sent to the terminal.
.RE

.sp
.ne 2
.na
\fB\fBdisconnect\fR\fR
.ad
.sp .6
.RS 4n
A synonym for \fBclose\fR.
.RE

.sp
.ne 2
.na
\fB\fBform\fR [ \fIformat-name\fR ]\fR
.ad
.sp .6
.RS 4n
Sets the carriage control format subtype of the "representation type" to
\fIformat-name\fR. The only valid \fIformat-name\fR is \fBnon-print\fR, which
corresponds to the default "non-print" subtype.
.RE

.sp
.ne 2
.na
\fB\fBget\fR \fIremote-file\fR [ \fIlocal-file\fR ]\fR
.ad
.sp .6
.RS 4n
Retrieves the \fIremote-file\fR and store it on the local machine. If the local
file name is not specified, it is given the same name it has on the remote
machine, subject to alteration by the current \fBcase\fR, \fBntrans\fR, and
\fBnmap\fR settings. The current settings for "representation type", "file
structure", and "transfer mode" are used while transferring the file.
.RE

.sp
.ne 2
.na
\fB\fBglob\fR\fR
.ad
.sp .6
.RS 4n
Toggles filename expansion, or "globbing", for \fBmdelete\fR, \fBmget\fR and
\fBmput\fR. If globbing is turned off, filenames are taken literally.
.sp
Globbing for \fBmput\fR is done as in \fBsh\fR(1). For \fBmdelete\fR and
\fBmget\fR, each remote file name is expanded separately on the remote machine,
and the lists are not merged.
.sp
Expansion of a directory name is likely to be radically different from
expansion of the name of an ordinary file: the exact result depends on the
remote operating system and \fBFTP\fR server, and can be previewed with the
command, \fBmls\fR \fIremote-files\fR \(mi.
.sp
\fBmget\fR and \fBmput\fR are not meant to transfer entire directory subtrees
of files. You can do this by transferring a \fBtar\fR(1) archive of the subtree
(using a "representation type" of "image" as set by the \fBbinary\fR command).
.RE

.sp
.ne 2
.na
\fB\fBhash\fR\fR
.ad
.sp .6
.RS 4n
Toggles hash-sign (\fB#\fR) printing for each data block transferred. The size
of a data block is 8192 bytes.
.RE

.sp
.ne 2
.na
\fB\fBhelp\fR [ \fIcommand\fR ]\fR
.ad
.sp .6
.RS 4n
Prints an informative message about the meaning of \fIcommand\fR. If no
argument is given, \fBftp\fR prints a list of the known commands.
.RE

.sp
.ne 2
.na
\fB\fBlcd\fR [ \fIdirectory\fR ]\fR
.ad
.sp .6
.RS 4n
Changes the working directory on the local machine. If no \fIdirectory\fR is
specified, the user's home directory is used.
.RE

.sp
.ne 2
.na
\fB\fBls\fR [ \fB-al\fR | \fIremote-directory\fR [ \fIlocal-file\fR ]]\fR
.ad
.sp .6
.RS 4n
By default, prints an abbreviated listing of the contents of a directory on the
remote machine. This default behavior can be changed to make \fBls\fR a synonym
of the \fBdir\fR command. This change can be achieved by setting
\fBFTP_LS_SENDS_NLST\fR to '\fBno\fR' in \fB/etc/default/ftp\fR or in the
environment. See \fBftp\fR(5) for details.
.sp
The \fB-a\fR option lists all entries, including those that begin with a dot
(\fB\&.\fR), which are normally not listed. The \fB-l\fR option lists files in
long format, giving mode, number of links, owner, group, size in bytes, and
time of last modification for each file. If the file is a special file, the
size field instead contains the major and minor device numbers rather than a
size. If the file is a symbolic link, the filename is printed followed by
"\fB\(->\fR" and the pathname of the referenced file.
.sp
If \fIremote-directory\fR is left unspecified, the current working directory is
used.
.sp
If no local file is specified, or if \fIlocal-file\fR is \fB\(mi\fR, the output
is sent to the terminal.
.RE

.sp
.ne 2
.na
\fB\fBmacdef\fR \fImacro-name\fR\fR
.ad
.sp .6
.RS 4n
Defines a macro. Subsequent lines are stored as the macro \fImacro-name\fR. A
null line (consecutive \fBNEWLINE\fR characters in a file or RETURN characters
from the terminal) terminates macro input mode. There is a limit of 16 macros
and 4096 total characters in all defined macros. Macros remain defined until a
\fBclose\fR command is executed.
.sp
The macro processor interprets \fB$\fR and \fB\e\fR as special characters. A
\fB$\fR followed by a number (or numbers) is replaced by the corresponding
argument on the macro invocation command line. A \fB$\fR followed by an \fBi\fR
signals that macro processor that the executing macro is to be looped. On the
first pass, \fB$i\fR is replaced by the first argument on the macro invocation
command line; on the second pass, it is replaced by the second argument, and so
on. A \fB\e\fR followed by any character is replaced by that character. Use the
\fB\e\fR to prevent special treatment of the \fB$\fR.
.RE

.sp
.ne 2
.na
\fB\fBmdelete\fR \fIremote-files\fR\fR
.ad
.sp .6
.RS 4n
Deletes the \fIremote-files\fR on the remote machine.
.RE

.sp
.ne 2
.na
\fB\fBmdir\fR \fIremote-files local-file\fR\fR
.ad
.sp .6
.RS 4n
Like \fBdir\fR, except multiple remote files can be specified. If interactive
prompting is on, \fBftp\fR prompts the user to verify that the last argument is
indeed the target local file for receiving \fBmdir\fR output.
.RE

.sp
.ne 2
.na
\fB\fBmget\fR \fIremote-files\fR\fR
.ad
.sp .6
.RS 4n
Expands the \fIremote-files\fR on the remote machine and do a \fBget\fR for
each file name thus produced. See \fBglob\fR for details on the filename
expansion. Resulting file names are processed according to \fBcase\fR,
\fBntrans\fR, and \fBnmap\fR settings. Files are transferred into the local
working directory, which can be changed with \fBlcd\fR \fIdirectory\fR. New
local directories can be created with \fB! mkdir\fR \fIdirectory\fR.
.RE

.sp
.ne 2
.na
\fB\fBmkdir\fR \fIdirectory-name\fR\fR
.ad
.sp .6
.RS 4n
Makes a directory on the remote machine.
.RE

.sp
.ne 2
.na
\fB\fBmls\fR \fIremote-files local-file\fR\fR
.ad
.sp .6
.RS 4n
Like \fBls\fR(1), except multiple remote files can be specified. If interactive
prompting is on, \fBftp\fR prompts the user to verify that the last argument is
indeed the target local file for receiving \fBmls\fR output.
.RE

.sp
.ne 2
.na
\fB\fBmode\fR [ \fImode-name\fR ]\fR
.ad
.sp .6
.RS 4n
Sets the "transfer mode" to \fImode-name\fR. The only valid \fImode-name\fR is
\fBstream\fR, which corresponds to the default "stream" mode. This
implementation only supports \fBstream\fR, and requires that it be specified.
.RE

.sp
.ne 2
.na
\fB\fBmput\fR \fIlocal-files\fR\fR
.ad
.sp .6
.RS 4n
Expands wild cards in the list of local files given as arguments and do a
\fBput\fR for each file in the resulting list. See \fBglob\fR for details of
filename expansion. Resulting file names are processed according to
\fBntrans\fR and \fBnmap\fR settings.
.RE

.sp
.ne 2
.na
\fB\fBnlist\fR [ \fB-al\fR | \fIremote-directory\fR [ \fIlocal-file\fR ]]\fR
.ad
.sp .6
.RS 4n
Prints an abbreviated listing of the contents of a directory on the remote
machine, listing only those files that can be retrieved by the \fBget\fR
command, unless the \fB-a\fR or \fB-l\fR option is used. If
\fIremote-directory\fR is left unspecified, the current working directory is
used.
.sp
The \fB-a\fR option lists all entries, including those that begin with a dot
(\fB\&.\fR), which are normally not listed. The \fB-l\fR option lists files in
long format the same way it does when used with the \fBls\fR command.
.RE

.sp
.ne 2
.na
\fB\fBnmap\fR [ \fIinpattern outpattern\fR ]\fR
.ad
.sp .6
.RS 4n
Sets or unsets the filename mapping mechanism. If no arguments are specified,
the filename mapping mechanism is unset. If arguments are specified, remote
filenames are mapped during \fBmput\fR commands and \fBput\fR commands issued
without a specified remote target filename. If arguments are specified, local
filenames are mapped during \fBmget\fR commands and \fBget\fR commands issued
without a specified local target filename.
.sp
This command is useful when connecting to a non-UNIX-system remote host with
different file naming conventions or practices. The mapping follows the pattern
set by \fIinpattern\fR and \fIoutpattern\fR. \fIinpattern\fR is a template for
incoming filenames (which can have already been processed according to the
\fBntrans\fR and \fBcase\fR settings). Variable templating is accomplished by
including the sequences \fB$1\fR, \fB$2\fR, .\|.\|.\|, \fB$9\fR in
\fIinpattern\fR. Use \fB\e\fR to prevent this special treatment of the \fB$\fR
character. All other characters are treated literally, and are used to
determine the \fBnmap\fR \fIinpattern\fR variable values.
.sp
For example, given \fIinpattern\fR \fB$1.$2\fR and the remote file name
\fBmydata.data\fR, \fB$1\fR would have the value \fBmydata\fR, and \fB$2\fR
would have the value \fBdata\fR.
.sp
The \fIoutpattern\fR determines the resulting mapped filename. The sequences
\fB$1\fR, \fB$2\fR, .\|.\|.\|, \fB$9\fR are replaced by any value resulting
from the \fIinpattern\fR template. The sequence \fB$0\fR is replaced by the
original filename. Additionally, the sequence [\fI\|seq1\|\fR,\fI\|seq2\|\fR]
is replaced by \fIseq1\fR if \fIseq1\fR is not a null string; otherwise it is
replaced by \fIseq2\fR.
.sp
For example, the command \fBnmap $1.$2.$3 [$1,$2].[$2,file]\fR would yield the
output filename \fBmyfile.data\fR for input filenames \fBmyfile.data\fR and
\fBmyfile.data.old\fR, \fBmyfile.file\fR for the input filename \fBmyfile\fR,
and \fBmyfile.myfile\fR for the input filename \fB\&.myfile\fR. \fBSPACE\fR
characters can be included in \fIoutpattern\fR, as in the example \fBnmap $1 |
sed "s/ *$//" > $1\fR. Use the \fB\e\fR character to prevent special treatment
of the \fB$\fR, \fB[\fR, \fB]\fR, and \fB,\fR, characters.
.RE

.sp
.ne 2
.na
\fB\fBntrans\fR [ \fIinchars\fR [ \fIoutchars\fR ] ]\fR
.ad
.sp .6
.RS 4n
Sets or unsets the filename character translation mechanism. If no arguments
are specified, the filename character translation mechanism is unset. If
arguments are specified, characters in remote filenames are translated during
\fBmput\fR commands and \fBput\fR commands issued without a specified remote
target filename, and characters in local filenames are translated during
\fBmget\fR commands and \fBget\fR commands issued without a specified local
target filename.
.sp
This command is useful when connecting to a non-UNIX-system remote host with
different file naming conventions or practices. Characters in a filename
matching a character in \fIinchars\fR are replaced with the corresponding
character in \fIoutchars\fR. If the character's position in \fIinchars\fR is
longer than the length of \fIoutchars\fR, the character is deleted from the
file name.
.sp
Only 16 characters can be translated when using the \fBntrans\fR command under
\fBftp\fR. Use \fBcase\fR (described above) if needing to convert the entire
alphabet.
.RE

.sp
.ne 2
.na
\fB\fBopen\fR \fIhost\fR [ \fIport\fR ]\fR
.ad
.sp .6
.RS 4n
Establishes a connection to the specified \fIhost\fR \fBFTP\fR server. An
optional port number can be supplied, in which case, \fBftp\fR attempts to
contact an \fBFTP\fR server at that port. If the \fIauto-login\fR option is on
(default setting), \fBftp\fR also attempts to automatically log the user in to
the \fBFTP\fR server.
.RE

.sp
.ne 2
.na
\fB\fBpassive\fR\fR
.ad
.sp .6
.RS 4n
Toggles passive mode. When passive mode is turned on, the ftp client sends the
\fBPASV\fR command requesting that the \fBFTP\fR server open a port for the
data connection and return the address of that port. The remote server listens
on that port and the client connects to it. When passive mode is turned off,
the ftp client sends the \fBPORT\fR command to the server specifying an address
for the remote server to connect back to. Passive mode is useful when the
connections to the ftp client are controlled, for example, when behind a
firewall. When connecting to an IPv6-enabled \fBFTP\fR server, \fBEPSV\fR can
be used in place of \fBPASV\fR and \fBEPRT\fR in place of \fBPORT\fR.
.RE

.sp
.ne 2
.na
\fB\fBprivate\fR\fR
.ad
.sp .6
.RS 4n
Sets the protection level on data transfers to "\fBprivate\fR". Data
transmissions are confidentiality\(em and integrity\(emprotected by encryption.
If no \fBADAT\fR command succeeded, then the only possible level is "clear".
.RE

.sp
.ne 2
.na
\fB\fBprompt\fR\fR
.ad
.sp .6
.RS 4n
Toggles interactive prompting. Interactive prompting occurs during multiple
file transfers to allow the user to selectively retrieve or store files. By
default, prompting is turned on. If prompting is turned off, any \fBmget\fR or
\fBmput\fR transfers all files, and any \fBmdelete\fR deletes all files.
.RE

.sp
.ne 2
.na
\fB\fBprotect\fR \fIprotection-level\fR\fR
.ad
.sp .6
.RS 4n
Sets the protection level on data transfers to \fIprotection-level\fR. The
valid protection levels are "\fBclear\fR" for unprotected data transmissions,
"\fBsafe\fR" for data transmissions that are integrity-protected by
cryptographic checksum, and "\fBprivate\fR" for data transmissions that are
confidentiality\(em and integrity\(em protected by encryption. If no \fBADAT\fR
command succeeded, then the only possible level is "\fBclear\fR". If no level
is specified, the current level is printed. The default protection level is
"\fBclear\fR".
.RE

.sp
.ne 2
.na
\fB\fBproxy\fR \fIftp-command\fR\fR
.ad
.sp .6
.RS 4n
Executes an \fBFTP\fR command on a secondary control connection. This command
allows simultaneous connection to two remote \fBFTP\fR servers for transferring
files between the two servers. The first \fBproxy\fR command should be an
\fBopen\fR, to establish the secondary control connection. Enter the command
\fBproxy\fR \fB?\fR to see other \fBFTP\fR commands executable on the secondary
connection.
.sp
The following commands behave differently when prefaced by \fBproxy\fR:
\fBopen\fR does not define new macros during the auto-login process,
\fBclose\fR does not erase existing macro definitions, \fBget\fR and \fBmget\fR
transfer files from the host on the primary control connection to the host on
the secondary control connection, and \fBput\fR, \fBmputd\fR, and \fBappend\fR
transfer files from the host on the secondary control connection to the host on
the primary control connection.
.sp
Third party file transfers depend upon support of the \fBPASV\fR command by the
server on the secondary control connection.
.RE

.sp
.ne 2
.na
\fB\fBput\fR \fIlocal-file\fR [ \fIremote-file\fR ]\fR
.ad
.sp .6
.RS 4n
Stores a local file on the remote machine. If \fIremote-file\fR is left
unspecified, the local file name is used after processing according to any
\fBntrans\fR or \fBnmap\fR settings in naming the remote file. File transfer
uses the current settings for "representation type", "file structure", and
"transfer mode".
.RE

.sp
.ne 2
.na
\fB\fBpwd\fR\fR
.ad
.sp .6
.RS 4n
Prints the name of the current working directory on the remote machine.
.RE

.sp
.ne 2
.na
\fB\fBquit\fR\fR
.ad
.sp .6
.RS 4n
A synonym for \fBbye\fR.
.RE

.sp
.ne 2
.na
\fB\fBquote\fR \fIarg1 arg2\fR ...\fR
.ad
.sp .6
.RS 4n
Sends the arguments specified, verbatim, to the remote \fBFTP\fR server. A
single \fBFTP\fR reply code is expected in return. (The \fBremotehelp\fR
command displays a list of valid arguments.)
.sp
\fBquote\fR should be used only by experienced users who are familiar with the
FTP protocol.
.RE

.sp
.ne 2
.na
\fB\fBrecv\fR \fIremote-file\fR [ \fIlocal-file\fR ]\fR
.ad
.sp .6
.RS 4n
 A synonym for \fBget\fR.
.RE

.sp
.ne 2
.na
\fB\fBreget\fR \fIremote-file\fR [ \fIlocal-file\fR ]\fR
.ad
.sp .6
.RS 4n
The \fBreget\fR command acts like \fBget\fR, except that if \fIlocal-file\fR
exists and is smaller than \fIremote-file\fR, \fIlocal-file\fR is presumed to
be a partially transferred copy of \fIremote-file\fR and the transfer is
continued from the apparent point of failure. This command is useful when
transferring large files over networks that are prone to dropping connections.
.RE

.sp
.ne 2
.na
\fB\fBremotehelp\fR [ \fIcommand-name\fR ]\fR
.ad
.sp .6
.RS 4n
Requests help from the remote \fBFTP\fR server. If a \fIcommand-name\fR is
specified it is supplied to the server as well.
.RE

.sp
.ne 2
.na
\fB\fBrename\fR \fIfrom to\fR\fR
.ad
.sp .6
.RS 4n
Renames the file \fIfrom\fR on the remote machine to have the name \fIto\fR.
.RE

.sp
.ne 2
.na
\fB\fBreset\fR\fR
.ad
.sp .6
.RS 4n
Clears reply queue. This command re-synchronizes command/reply sequencing with
the remote \fBFTP\fR server. Resynchronization can be necessary following a
violation of the \fBFTP\fR protocol by the remote server.
.RE

.sp
.ne 2
.na
\fB\fBrestart\fR [ \fImarker\fR ]\fR
.ad
.sp .6
.RS 4n
Restarts the immediately following \fBget\fR or \fBput\fR at the indicated
marker. On UNIX systems, \fImarker\fR is usually a byte offset into the file.
When followed by an \fBmget\fR, the \fBrestart\fR applies to the first
\fBget\fR performed. Specifying a \fImarker\fR of \fB0\fR clears the restart
marker. If no argument is specified, the current restart status is displayed.
.RE

.sp
.ne 2
.na
\fB\fBrmdir\fR \fIdirectory-name\fR\fR
.ad
.sp .6
.RS 4n
Deletes a directory on the remote machine.
.RE

.sp
.ne 2
.na
\fB\fBrunique\fR\fR
.ad
.sp .6
.RS 4n
Toggles storing of files on the local system with unique filenames. If a file
already exists with a name equal to the target local filename for a \fBget\fR
or \fBmget\fR command, a \fB\&.1\fR is appended to the name. If the resulting
name matches another existing file, a \fB\&.2\fR is appended to the original
name. If this process continues up to \fB\&.99\fR, an error message is printed,
and the transfer does not take place. The generated unique filename is
reported. \fBrunique\fR does not affect local files generated from a shell
command. The default value is off.
.RE

.sp
.ne 2
.na
\fB\fBsafe\fR\fR
.ad
.sp .6
.RS 4n
Sets the protection level on data transfers to "\fBsafe\fR". Data transmissions
are integrity-protected by cryptographic checksum. If no \fBADAT\fR command
succeeded, then the only possible level is "\fBclear\fR".
.RE

.sp
.ne 2
.na
\fB\fBsend\fR \fIlocal-file\fR [ \fIremote-file\fR ]\fR
.ad
.sp .6
.RS 4n
A synonym for \fBput\fR.
.RE

.sp
.ne 2
.na
\fB\fBsendport\fR\fR
.ad
.sp .6
.RS 4n
Toggles the use of \fBPORT\fR commands. By default, \fBftp\fR attempts to use a
\fBPORT\fR command when establishing a connection for each data transfer. The
use of \fBPORT\fR commands can prevent delays when performing multiple file
transfers. If the \fBPORT\fR command fails, \fBftp\fR uses the default data
port. When the use of \fBPORT\fR commands is disabled, no attempt is made to
use \fBPORT\fR commands for each data transfer. This is useful when connected
to certain \fBFTP\fR implementations that ignore \fBPORT\fR commands but
incorrectly indicate they have been accepted.
.RE

.sp
.ne 2
.na
\fB\fBsite\fR \fIarg1\fR [ \fIarg2\fR ] ...\fR
.ad
.sp .6
.RS 4n
Sends the arguments specified, verbatim, to the remote \fBFTP\fR server as a
\fBSITE\fR command.
.RE

.sp
.ne 2
.na
\fB\fBstatus\fR\fR
.ad
.sp .6
.RS 4n
Show the current status of \fBftp\fR.
.RE

.sp
.ne 2
.na
\fB\fBstruct\fR [ \fIstruct-name\fR ]\fR
.ad
.sp .6
.RS 4n
Sets the file structure to \fIstruct-name\fR. The only valid \fIstruct-name\fR
is \fBfile\fR, which corresponds to the default "file" structure. The
implementation only supports \fBfile\fR, and requires that it be specified.
.RE

.sp
.ne 2
.na
\fB\fBsunique\fR\fR
.ad
.sp .6
.RS 4n
Toggles storing of files on remote machine under unique file names. The remote
\fBFTP\fR server must support the \fBSTOU\fR command for successful completion.
The remote server reports the unique name. Default value is off.
.RE

.sp
.ne 2
.na
\fB\fBtcpwindow\fR [ \fIsize\fR ]\fR
.ad
.sp .6
.RS 4n
Sets the \fBTCP\fR window size to be used for data connections. Specifying a
size of \fB0\fR stops the explicit setting of the \fBTCP\fR window size on data
connections. If no argument is specified, the current setting is displayed.
.RE

.sp
.ne 2
.na
\fB\fBtenex\fR\fR
.ad
.sp .6
.RS 4n
Sets the "representation type" to that needed to talk to \fBTENEX\fR machines.
.RE

.sp
.ne 2
.na
\fB\fBtrace\fR\fR
.ad
.sp .6
.RS 4n
Toggles packet tracing (unimplemented).
.RE

.sp
.ne 2
.na
\fB\fBtype\fR [ \fItype-name\fR ]\fR
.ad
.sp .6
.RS 4n
Sets the "representation type" to \fItype-name\fR. The valid \fItype-name\fRs
are \fBascii\fR for "network \fBASCII\fR", \fBbinary\fR or \fBimage\fR for
"image", and \fBtenex\fR for "local byte size" with a byte size of 8 (used to
talk to \fBTENEX\fR machines). If no type is specified, the current type is
printed. The default type is "network \fBASCII\fR".
.RE

.sp
.ne 2
.na
\fB\fBuser\fR \fIuser-name\fR [ \fIpassword\fR [ \fIaccount\fR ]]\fR
.ad
.sp .6
.RS 4n
Identify yourself to the remote \fBFTP\fR server. If the password is not
specified and the server requires it, \fBftp\fR prompts the user for it (after
disabling local echo). If an account field is not specified, and the \fBFTP\fR
server requires it, the user is prompted for it. If an account field is
specified, an account command is relayed to the remote server after the login
sequence is completed if the remote server did not require it for logging in.
Unless \fBftp\fR is invoked with "auto-login" disabled, this process is done
automatically on initial connection to the \fBFTP\fR server.
.RE

.sp
.ne 2
.na
\fB\fBverbose\fR\fR
.ad
.sp .6
.RS 4n
Toggles verbose mode. In verbose mode, all responses from the \fBFTP\fR server
are displayed to the user. In addition, if verbose mode is on, when a file
transfer completes, statistics regarding the efficiency of the transfer are
reported. By default, verbose mode is on if \fBftp\fR's commands are coming
from a terminal, and off otherwise.
.RE

.sp
.ne 2
.na
\fB\fB?\fR [ \fIcommand\fR ]\fR
.ad
.sp .6
.RS 4n
A synonym for \fBhelp\fR.
.RE

.sp
.LP
Command arguments which have embedded spaces can be quoted with quote (\fB"\fR)
marks.
.sp
.LP
If any command argument which is not indicated as being optional is not
specified, \fBftp\fR prompts for that argument.
.SH ABORTING A FILE TRANSFER
.LP
To abort a file transfer, use the terminal interrupt key. Sending transfers is
immediately halted. Receiving transfers are halted by sending an \fBFTP\fR
protocol \fBABOR\fR command to the remote server, and discarding any further
data received. The speed at which this is accomplished depends upon the remote
server's support for \fBABOR\fR processing. If the remote server does not
support the \fBABOR\fR command, an \fBftp>\fR prompt does not appear until the
remote server has completed sending the requested file.
.sp
.LP
The terminal interrupt key sequence is ignored when \fBftp\fR has completed any
local processing and is awaiting a reply from the remote server. A long delay
in this mode can result from the \fBABOR\fR processing described above, or from
unexpected behavior by the remote server, including violations of the ftp
protocol. If the delay results from unexpected remote server behavior, the
local \fBftp\fR program must be killed by hand.
.SH FILE NAMING CONVENTIONS
.LP
Local files specified as arguments to \fBftp\fR commands are processed
according to the following rules.
.sp
.ne 2
.na
\fB1)\fR
.ad
.RS 6n
If the file name \fB\(mi\fR is specified, the standard input (for reading) or
standard output (for writing) is used.
.RE

.sp
.ne 2
.na
\fB2)\fR
.ad
.RS 6n
If the first character of the file name is \fB|\fR, the remainder of the
argument is interpreted as a shell command. \fBftp\fR then forks a shell, using
\fBpopen\fR(3C) with the argument supplied, and reads (writes) from the
standard output (standard input) of that shell. If the shell command includes
SPACE characters, the argument must be quoted; for example \fB"| ls
\fR\fB-lt\fR\fB"\fR. A particularly useful example of this mechanism is:
\fB"dir | more"\fR.
.RE

.sp
.ne 2
.na
\fB3)\fR
.ad
.RS 6n
Failing the above checks, if globbing is enabled, local file names are expanded
according to the rules used in the \fBsh\fR(1); see the \fBglob\fR command. If
the \fBftp\fR command expects a single local file (for example, \fBput\fR),
only the first filename generated by the globbing operation is used.
.RE

.sp
.ne 2
.na
\fB4)\fR
.ad
.RS 6n
For \fBmget\fR commands and \fBget\fR commands with unspecified local file
names, the local filename is the remote filename, which can be altered by a
\fBcase\fR, \fBntrans\fR, or \fBnmap\fR setting. The resulting filename can
then be altered if \fBrunique\fR is on.
.RE

.sp
.ne 2
.na
\fB5)\fR
.ad
.RS 6n
For \fBmput\fR commands and \fBput\fR commands with unspecified remote file
names, the remote filename is the local filename, which can be altered by a
\fBntrans\fR or \fBnmap\fR setting. The resulting filename can then be altered
by the remote server if \fBsunique\fR is on.
.RE

.SH FILE TRANSFER PARAMETERS
.LP
The \fBFTP\fR specification specifies many parameters which can affect a file
transfer.
.sp
.LP
The "representation type" can be one of "network \fBASCII\fR", "\fBEBCDIC\fR",
"image", or "local byte size" with a specified byte size (for PDP-10's and
PDP-20's mostly). The "network \fBASCII\fR" and "\fBEBCDIC\fR" types have a
further subtype which specifies whether vertical format control (\fBNEWLINE\fR
characters, form feeds, and so on) are to be passed through ("non-print"),
provided in \fBTELNET\fR format ("\fBTELNET\fR format controls"), or provided
in \fBASA\fR (\fBFORTRAN\fR) ("carriage control (\fBASA\fR)") format. \fBftp\fR
supports the "network \fBASCII\fR" (subtype "non-print" only) and "image"
types, plus "local byte size" with a byte size of 8 for communicating with
\fBTENEX\fR machines.
.sp
.LP
The "file structure" can be one of \fBfile\fR (no record structure),
\fBrecord\fR, or \fBpage\fR. \fBftp\fR supports only the default value, which
is \fBfile\fR.
.sp
.LP
The "transfer mode" can be one of \fBstream\fR, \fBblock\fR, or
\fBcompressed\fR. \fBftp\fR supports only the default value, which is
\fBstream\fR.
.SH USAGE
.LP
See \fBlargefile\fR(7) for the description of the behavior of \fBftp\fR when
encountering files greater than or equal to 2 Gbyte (2^31 bytes).
.sp
.LP
The \fBftp\fR command is IPv6-enabled. See \fBip6\fR(4P).
.SH FILES
.LP
\fB~/.netrc\fR
.SH ATTRIBUTES
.LP
See \fBattributes\fR(7) for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
CSI	enabled
.TE

.SH SEE ALSO
.LP
.BR ls (1),
.BR rcp (1),
.BR sh (1),
.BR tar (1),
.BR popen (3C),
.BR ip6 (4P),
.BR ftp (5),
.BR ftpusers (5),
.BR mech (5),
.BR netrc (5),
.BR attributes (7),
.BR largefile (7)
.sp
.LP
Allman, M., Ostermann, S., and Metz, C. \fIRFC 2428, FTP Extensions for IPv6
and NATs\fR. The Internet Society. September 1998.
.sp
.LP
Lunt, S. J. \fIRFC 2228, FTP Security Extensions\fR. Internet Draft. November
1993.
.sp
.LP
Postel, Jon, and Joyce Reynolds. \fIRFC 959, File Transfer Protocol (FTP )\fR.
Network Information Center. October 1985.
.sp
.LP
Piscitello, D. \fIRFC 1639, FTP Operation Over Big Address Records (FOOBAR)\fR.
Network Working Group. June 1994.
.SH NOTES
.LP
Failure to log in can arise from an explicit denial by the remote \fBFTP\fR
server because the account is listed in \fB/etc/ftpusers\fR. See
\fBftpusers\fR(5).
.sp
.LP
Correct execution of many commands depends upon proper behavior by the remote
server.
.sp
.LP
An error in the treatment of carriage returns in the 4.2 \fBBSD\fR code
handling transfers with a "representation type" of "network \fBASCII\fR" has
been corrected. This correction can result in incorrect transfers of binary
files to and from 4.2 \fBBSD\fR servers using a "representation type" of
"network \fBASCII\fR". Avoid this problem by using the "image" type.