Commit | Line | Data |
---|---|---|
a83a5d06 | 1 | .\" $NetBSD: ftp.1,v 1.134 2012/12/22 16:57:10 christos Exp $ |
eedc536d | 2 | .\" |
20e59a13 | 3 | .\" Copyright (c) 1996-2010 The NetBSD Foundation, Inc. |
eedc536d PA |
4 | .\" All rights reserved. |
5 | .\" | |
6 | .\" This code is derived from software contributed to The NetBSD Foundation | |
7 | .\" by Luke Mewburn. | |
8 | .\" | |
9 | .\" Redistribution and use in source and binary forms, with or without | |
10 | .\" modification, are permitted provided that the following conditions | |
11 | .\" are met: | |
12 | .\" 1. Redistributions of source code must retain the above copyright | |
13 | .\" notice, this list of conditions and the following disclaimer. | |
14 | .\" 2. Redistributions in binary form must reproduce the above copyright | |
15 | .\" notice, this list of conditions and the following disclaimer in the | |
16 | .\" documentation and/or other materials provided with the distribution. | |
eedc536d PA |
17 | .\" |
18 | .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | |
19 | .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
20 | .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
21 | .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
22 | .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
23 | .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
24 | .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
25 | .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
26 | .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
27 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
28 | .\" POSSIBILITY OF SUCH DAMAGE. | |
29 | .\" | |
30 | .\" | |
31 | .\" Copyright (c) 1985, 1989, 1990, 1993 | |
32 | .\" The Regents of the University of California. All rights reserved. | |
33 | .\" | |
34 | .\" Redistribution and use in source and binary forms, with or without | |
35 | .\" modification, are permitted provided that the following conditions | |
36 | .\" are met: | |
37 | .\" 1. Redistributions of source code must retain the above copyright | |
38 | .\" notice, this list of conditions and the following disclaimer. | |
39 | .\" 2. Redistributions in binary form must reproduce the above copyright | |
40 | .\" notice, this list of conditions and the following disclaimer in the | |
41 | .\" documentation and/or other materials provided with the distribution. | |
42 | .\" 3. Neither the name of the University nor the names of its contributors | |
43 | .\" may be used to endorse or promote products derived from this software | |
44 | .\" without specific prior written permission. | |
45 | .\" | |
46 | .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
47 | .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
48 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
49 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
50 | .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
51 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
52 | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
53 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
54 | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
55 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
56 | .\" SUCH DAMAGE. | |
57 | .\" | |
58 | .\" @(#)ftp.1 8.3 (Berkeley) 10/9/94 | |
59 | .\" | |
a83a5d06 | 60 | .Dd December 22, 2012 |
eedc536d PA |
61 | .Dt FTP 1 |
62 | .Os | |
63 | .Sh NAME | |
64 | .Nm ftp | |
20e59a13 | 65 | .Nd Internet file transfer program |
eedc536d PA |
66 | .Sh SYNOPSIS |
67 | .Nm | |
3b706bf0 | 68 | .Op Fl 46AadefginpRtVv |
eedc536d | 69 | .Op Fl N Ar netrc |
eedc536d | 70 | .Op Fl o Ar output |
eedc536d | 71 | .Op Fl P Ar port |
eedc536d | 72 | .Op Fl q Ar quittime |
eedc536d | 73 | .Op Fl r Ar retry |
8b05fa7f | 74 | .Op Fl s Ar srcaddr |
eedc536d PA |
75 | .Bk -words |
76 | .\" [-T dir,max[,inc]] | |
77 | .Oo | |
78 | .Fl T Xo | |
79 | .Sm off | |
80 | .Ar dir , | |
81 | .Ar max | |
82 | .Op , Ar inc | |
83 | .Sm on | |
84 | .Xc | |
85 | .Oc | |
86 | .Ek | |
87 | .Bk -words | |
88 | .\" [[user@]host [port]] | |
89 | .Oo | |
90 | .Oo Ar user Ns Li \&@ Oc Ns Ar host | |
91 | .Op Ar port | |
92 | .Oc | |
93 | .Ek | |
94 | .Bk -words | |
95 | .\" [[user@]host:[path][/]] | |
96 | .Sm off | |
97 | .Oo | |
98 | .Op Ar user Li \&@ | |
99 | .Ar host Li \&: | |
100 | .Op Ar path | |
101 | .Op Li / | |
102 | .Oc | |
103 | .Sm on | |
104 | .Ek | |
105 | .Bk -words | |
106 | .\" [file:///path] | |
107 | .Sm off | |
108 | .Oo | |
109 | .Li file:/// Ar path | |
110 | .Oc | |
111 | .Sm on | |
112 | .Ek | |
113 | .Bk -words | |
114 | .\" [ftp://[user[:password]@]host[:port]/path[/]] | |
115 | .Sm off | |
116 | .Oo | |
117 | .Li ftp:// | |
118 | .Oo Ar user | |
119 | .Op Li \&: Ar password | |
120 | .Li \&@ Oc | |
121 | .Ar host Oo Li \&: Ar port Oc | |
122 | .Li / Ar path | |
123 | .Op Li / | |
124 | .Op Li ;type= Ar X | |
125 | .Oc | |
126 | .Sm on | |
127 | .Ek | |
128 | .Bk -words | |
129 | .\" [http://[user[:password]@]host[:port]/path] | |
130 | .Sm off | |
131 | .Oo | |
132 | .Li http:// | |
133 | .Oo Ar user | |
134 | .Op Li \&: Ar password | |
135 | .Li \&@ Oc | |
136 | .Ar host Oo Li \&: Ar port Oc | |
137 | .Li / Ar path | |
138 | .Oc | |
139 | .Sm on | |
140 | .Ek | |
141 | .Op Ar \&.\&.\&. | |
142 | .Nm | |
143 | .Bk -words | |
144 | .Fl u Ar URL Ar file | |
145 | .Ek | |
146 | .Op Ar \&.\&.\&. | |
147 | .Sh DESCRIPTION | |
148 | .Nm | |
149 | is the user interface to the Internet standard File Transfer Protocol. | |
150 | The program allows a user to transfer files to and from a | |
151 | remote network site. | |
152 | .Pp | |
153 | The last five arguments will fetch a file using the | |
154 | .Tn FTP | |
155 | or | |
156 | .Tn HTTP | |
157 | protocols, or by direct copying, into the current directory. | |
158 | This is ideal for scripts. | |
159 | Refer to | |
160 | .Sx AUTO-FETCHING FILES | |
161 | below for more information. | |
162 | .Pp | |
163 | Options may be specified at the command line, or to the | |
164 | command interpreter. | |
0511850f | 165 | .Bl -tag -width Fl |
eedc536d PA |
166 | .It Fl 4 |
167 | Forces | |
168 | .Nm | |
169 | to only use IPv4 addresses. | |
170 | .It Fl 6 | |
171 | Forces | |
172 | .Nm | |
173 | to only use IPv6 addresses. | |
174 | .It Fl A | |
175 | Force active mode ftp. | |
176 | By default, | |
177 | .Nm | |
178 | will try to use passive mode ftp and fall back to active mode | |
179 | if passive is not supported by the server. | |
180 | This option causes | |
181 | .Nm | |
182 | to always use an active connection. | |
183 | It is only useful for connecting to very old servers that do not | |
184 | implement passive mode properly. | |
185 | .It Fl a | |
186 | Causes | |
187 | .Nm | |
188 | to bypass normal login procedure, and use an anonymous login instead. | |
189 | .It Fl d | |
190 | Enables debugging. | |
191 | .It Fl e | |
192 | Disables command line editing. | |
193 | This is useful for Emacs ange-ftp mode. | |
194 | .It Fl f | |
195 | Forces a cache reload for transfers that go through the | |
196 | .Tn FTP | |
197 | or | |
198 | .Tn HTTP | |
199 | proxies. | |
200 | .It Fl g | |
201 | Disables file name globbing. | |
202 | .It Fl i | |
203 | Turns off interactive prompting during | |
204 | multiple file transfers. | |
3b706bf0 PA |
205 | .It Fl N Ar netrc |
206 | Use | |
207 | .Ar netrc | |
208 | instead of | |
209 | .Pa ~/.netrc . | |
210 | Refer to | |
211 | .Sx THE .netrc FILE | |
212 | for more information. | |
eedc536d PA |
213 | .It Fl n |
214 | Restrains | |
215 | .Nm | |
216 | from attempting | |
217 | .Dq auto-login | |
218 | upon initial connection for non auto-fetch transfers. | |
219 | If auto-login is enabled, | |
220 | .Nm | |
221 | will check the | |
222 | .Pa .netrc | |
223 | (see below) file in the user's home directory for an entry describing | |
224 | an account on the remote machine. | |
225 | If no entry exists, | |
226 | .Nm | |
227 | will prompt for the remote machine login name (default is the user | |
228 | identity on the local machine), and, if necessary, prompt for a password | |
229 | and an account with which to login. | |
230 | To override the auto-login for auto-fetch transfers, specify the | |
231 | username (and optionally, password) as appropriate. | |
eedc536d PA |
232 | .It Fl o Ar output |
233 | When auto-fetching files, save the contents in | |
234 | .Ar output . | |
235 | .Ar output | |
236 | is parsed according to the | |
237 | .Sx FILE NAMING CONVENTIONS | |
238 | below. | |
239 | If | |
240 | .Ar output | |
241 | is not | |
242 | .Sq - | |
243 | or doesn't start with | |
244 | .Sq \&| , | |
245 | then only the first file specified will be retrieved into | |
246 | .Ar output ; | |
247 | all other files will be retrieved into the basename of their | |
248 | remote name. | |
3b706bf0 PA |
249 | .It Fl P Ar port |
250 | Sets the port number to | |
251 | .Ar port . | |
eedc536d PA |
252 | .It Fl p |
253 | Enable passive mode operation for use behind connection filtering firewalls. | |
254 | This option has been deprecated as | |
255 | .Nm | |
256 | now tries to use passive mode by default, falling back to active mode | |
257 | if the server does not support passive connections. | |
eedc536d PA |
258 | .It Fl q Ar quittime |
259 | Quit if the connection has stalled for | |
260 | .Ar quittime | |
261 | seconds. | |
3b706bf0 PA |
262 | .It Fl R |
263 | Restart all non-proxied auto-fetches. | |
0511850f PA |
264 | .It Fl r Ar wait |
265 | Retry the connection attempt if it failed, pausing for | |
266 | .Ar wait | |
267 | seconds. | |
0511850f PA |
268 | .It Fl s Ar srcaddr |
269 | Uses | |
270 | .Ar srcaddr | |
271 | as the local IP address for all connections. | |
eedc536d PA |
272 | .It Fl t |
273 | Enables packet tracing. | |
20e59a13 | 274 | .It Fl T Ar direction Ns , Ns Ar maximum Ns Oo , Ns Ar increment Oc |
eedc536d PA |
275 | Set the maximum transfer rate for |
276 | .Ar direction | |
277 | to | |
278 | .Ar maximum | |
279 | bytes/second, | |
280 | and if specified, the increment to | |
281 | .Ar increment | |
282 | bytes/second. | |
283 | Refer to | |
284 | .Ic rate | |
285 | for more information. | |
286 | .It Fl u Ar URL file Op \&.\&.\&. | |
287 | Upload files on the command line to | |
288 | .Ar URL | |
289 | where | |
290 | .Ar URL | |
291 | is one of the ftp URL types as supported by auto-fetch | |
292 | (with an optional target filename for single file uploads), and | |
293 | .Ar file | |
294 | is one or more local files to be uploaded. | |
3b706bf0 PA |
295 | .It Fl V |
296 | Disable | |
297 | .Ic verbose | |
298 | and | |
299 | .Ic progress , | |
300 | overriding the default of enabled when output is to a terminal. | |
eedc536d PA |
301 | .It Fl v |
302 | Enable | |
303 | .Ic verbose | |
304 | and | |
305 | .Ic progress . | |
306 | This is the default if output is to a terminal (and in the case of | |
307 | .Ic progress , | |
308 | .Nm | |
309 | is the foreground process). | |
310 | Forces | |
311 | .Nm | |
312 | to show all responses from the remote server, as well | |
313 | as report on data transfer statistics. | |
eedc536d PA |
314 | .El |
315 | .Pp | |
316 | The client host with which | |
317 | .Nm | |
318 | is to communicate may be specified on the command line. | |
319 | If this is done, | |
320 | .Nm | |
321 | will immediately attempt to establish a connection to an | |
322 | .Tn FTP | |
323 | server on that host; otherwise, | |
324 | .Nm | |
325 | will enter its command interpreter and await instructions | |
326 | from the user. | |
327 | When | |
328 | .Nm | |
329 | is awaiting commands from the user the prompt | |
330 | .Ql ftp\*[Gt] | |
331 | is provided to the user. | |
332 | The following commands are recognized | |
333 | by | |
c106ca54 | 334 | .Nm ftp : |
0511850f | 335 | .Bl -tag -width Ic |
eedc536d PA |
336 | .It Ic \&! Op Ar command Op Ar args |
337 | Invoke an interactive shell on the local machine. | |
338 | If there are arguments, the first is taken to be a command to execute | |
339 | directly, with the rest of the arguments as its arguments. | |
340 | .It Ic \&$ Ar macro-name Op Ar args | |
341 | Execute the macro | |
342 | .Ar macro-name | |
343 | that was defined with the | |
344 | .Ic macdef | |
345 | command. | |
346 | Arguments are passed to the macro unglobbed. | |
347 | .It Ic account Op Ar passwd | |
348 | Supply a supplemental password required by a remote system for access | |
349 | to resources once a login has been successfully completed. | |
350 | If no argument is included, the user will be prompted for an account | |
351 | password in a non-echoing input mode. | |
352 | .It Ic append Ar local-file Op Ar remote-file | |
353 | Append a local file to a file on the remote machine. | |
354 | If | |
355 | .Ar remote-file | |
356 | is left unspecified, the local file name is used in naming the | |
357 | remote file after being altered by any | |
358 | .Ic ntrans | |
359 | or | |
360 | .Ic nmap | |
361 | setting. | |
362 | File transfer uses the current settings for | |
363 | .Ic type , | |
364 | .Ic format , | |
365 | .Ic mode , | |
366 | and | |
367 | .Ic structure . | |
368 | .It Ic ascii | |
369 | Set the file transfer | |
370 | .Ic type | |
371 | to network | |
372 | .Tn ASCII . | |
373 | This is the default type. | |
374 | .It Ic bell | |
375 | Arrange that a bell be sounded after each file transfer | |
376 | command is completed. | |
377 | .It Ic binary | |
378 | Set the file transfer | |
379 | .Ic type | |
380 | to support binary image transfer. | |
381 | .It Ic bye | |
382 | Terminate the | |
383 | .Tn FTP | |
384 | session with the remote server | |
385 | and exit | |
386 | .Nm ftp . | |
387 | An end of file will also terminate the session and exit. | |
388 | .It Ic case | |
389 | Toggle remote computer file name case mapping during | |
390 | .Ic get , | |
391 | .Ic mget | |
392 | and | |
393 | .Ic mput | |
394 | commands. | |
395 | When | |
396 | .Ic case | |
397 | is on (default is off), remote computer file names with all letters in | |
398 | upper case are written in the local directory with the letters mapped | |
399 | to lower case. | |
400 | .It Ic \&cd Ar remote-directory | |
401 | Change the working directory on the remote machine | |
402 | to | |
403 | .Ar remote-directory . | |
404 | .It Ic cdup | |
405 | Change the remote machine working directory to the parent of the | |
406 | current remote machine working directory. | |
407 | .It Ic chmod Ar mode remote-file | |
408 | Change the permission modes of the file | |
409 | .Ar remote-file | |
410 | on the remote | |
411 | system to | |
412 | .Ar mode . | |
413 | .It Ic close | |
414 | Terminate the | |
415 | .Tn FTP | |
416 | session with the remote server, and | |
417 | return to the command interpreter. | |
418 | Any defined macros are erased. | |
419 | .It Ic \&cr | |
420 | Toggle carriage return stripping during | |
421 | ascii type file retrieval. | |
422 | Records are denoted by a carriage return/linefeed sequence | |
423 | during ascii type file transfer. | |
424 | When | |
425 | .Ic \&cr | |
426 | is on (the default), carriage returns are stripped from this | |
427 | sequence to conform with the | |
428 | .Ux | |
429 | single linefeed record | |
430 | delimiter. | |
431 | Records on | |
432 | .Pf non\- Ns Ux | |
433 | remote systems may contain single linefeeds; | |
434 | when an ascii type transfer is made, these linefeeds may be | |
435 | distinguished from a record delimiter only when | |
436 | .Ic \&cr | |
437 | is off. | |
eedc536d PA |
438 | .It Ic delete Ar remote-file |
439 | Delete the file | |
440 | .Ar remote-file | |
441 | on the remote machine. | |
442 | .It Ic dir Op Ar remote-path Op Ar local-file | |
443 | Print a listing of the contents of a | |
444 | directory on the remote machine. | |
445 | The listing includes any system-dependent information that the server | |
446 | chooses to include; for example, most | |
447 | .Ux | |
448 | systems will produce | |
449 | output from the command | |
450 | .Ql ls \-l . | |
451 | If | |
452 | .Ar remote-path | |
453 | is left unspecified, the current working directory is used. | |
454 | If interactive prompting is on, | |
455 | .Nm | |
456 | will prompt the user to verify that the last argument is indeed the | |
457 | target local file for receiving | |
458 | .Ic dir | |
459 | output. | |
460 | If no local file is specified, or if | |
461 | .Ar local-file | |
462 | is | |
463 | .Sq Fl , | |
464 | the output is sent to the terminal. | |
465 | .It Ic disconnect | |
466 | A synonym for | |
467 | .Ic close . | |
468 | .It Ic edit | |
469 | Toggle command line editing, and context sensitive command and file | |
470 | completion. | |
471 | This is automatically enabled if input is from a terminal, and | |
472 | disabled otherwise. | |
fa70ef36 | 473 | .It Ic epsv epsv4 epsv6 |
eedc536d PA |
474 | Toggle the use of the extended |
475 | .Dv EPSV | |
476 | and | |
477 | .Dv EPRT | |
20e59a13 PA |
478 | commands on all IP, IPv4, and IPv6 connections respectively. |
479 | First try | |
eedc536d PA |
480 | .Dv EPSV / |
481 | .Dv EPRT , | |
482 | and then | |
483 | .Dv PASV / | |
484 | .Dv PORT . | |
485 | This is enabled by default. | |
486 | If an extended command fails then this option will be temporarily | |
487 | disabled for the duration of the current connection, or until | |
fa70ef36 PA |
488 | .Ic epsv , |
489 | .Ic epsv4 , | |
490 | or | |
491 | .Ic epsv6 | |
eedc536d PA |
492 | is executed again. |
493 | .It Ic exit | |
494 | A synonym for | |
495 | .Ic bye . | |
496 | .It Ic features | |
497 | Display what features the remote server supports (using the | |
498 | .Dv FEAT | |
499 | command). | |
500 | .It Ic fget Ar localfile | |
501 | Retrieve the files listed in | |
502 | .Ar localfile , | |
503 | which has one line per filename. | |
504 | .It Ic form Ar format | |
505 | Set the file transfer | |
506 | .Ic form | |
507 | to | |
508 | .Ar format . | |
509 | The default (and only supported) | |
510 | format is | |
511 | .Dq non-print . | |
512 | .It Ic ftp Ar host Op Ar port | |
513 | A synonym for | |
514 | .Ic open . | |
3b706bf0 PA |
515 | .It Ic ftp_debug Op Ar ftp_debug-value |
516 | Toggle debugging mode. | |
517 | If an optional | |
518 | .Ar ftp_debug-value | |
519 | is specified it is used to set the debugging level. | |
520 | When debugging is on, | |
521 | .Nm | |
522 | prints each command sent to the remote machine, preceded | |
523 | by the string | |
524 | .Ql \-\-\*[Gt] . | |
eedc536d PA |
525 | .It Ic gate Op Ar host Op Ar port |
526 | Toggle gate-ftp mode, which used to connect through the | |
527 | TIS FWTK and Gauntlet ftp proxies. | |
528 | This will not be permitted if the gate-ftp server hasn't been set | |
529 | (either explicitly by the user, or from the | |
530 | .Ev FTPSERVER | |
531 | environment variable). | |
532 | If | |
533 | .Ar host | |
534 | is given, | |
535 | then gate-ftp mode will be enabled, and the gate-ftp server will be set to | |
536 | .Ar host . | |
537 | If | |
538 | .Ar port | |
539 | is also given, that will be used as the port to connect to on the | |
540 | gate-ftp server. | |
541 | .It Ic get Ar remote-file Op Ar local-file | |
542 | Retrieve the | |
543 | .Ar remote-file | |
544 | and store it on the local machine. | |
545 | If the local | |
546 | file name is not specified, it is given the same | |
547 | name it has on the remote machine, subject to | |
548 | alteration by the current | |
549 | .Ic case , | |
550 | .Ic ntrans , | |
551 | and | |
552 | .Ic nmap | |
553 | settings. | |
554 | The current settings for | |
555 | .Ic type , | |
556 | .Ic form , | |
557 | .Ic mode , | |
558 | and | |
559 | .Ic structure | |
560 | are used while transferring the file. | |
561 | .It Ic glob | |
562 | Toggle filename expansion for | |
563 | .Ic mdelete , | |
564 | .Ic mget , | |
565 | .Ic mput , | |
566 | and | |
567 | .Ic mreget . | |
568 | If globbing is turned off with | |
569 | .Ic glob , | |
570 | the file name arguments | |
571 | are taken literally and not expanded. | |
572 | Globbing for | |
573 | .Ic mput | |
574 | is done as in | |
575 | .Xr csh 1 . | |
576 | For | |
577 | .Ic mdelete , | |
578 | .Ic mget , | |
579 | and | |
580 | .Ic mreget , | |
581 | each remote file name is expanded | |
582 | separately on the remote machine and the lists are not merged. | |
583 | Expansion of a directory name is likely to be | |
584 | different from expansion of the name of an ordinary file: | |
585 | the exact result depends on the foreign operating system and ftp server, | |
586 | and can be previewed by doing | |
587 | .Ql mls remote-files \- | |
588 | Note: | |
589 | .Ic mget , | |
590 | .Ic mput | |
591 | and | |
592 | .Ic mreget | |
593 | are not meant to transfer | |
594 | entire directory subtrees of files. | |
595 | That can be done by | |
596 | transferring a | |
597 | .Xr tar 1 | |
598 | archive of the subtree (in binary mode). | |
599 | .It Ic hash Op Ar size | |
600 | Toggle hash-sign | |
601 | .Pq Sq # | |
602 | printing for each data block transferred. | |
603 | The size of a data block defaults to 1024 bytes. | |
604 | This can be changed by specifying | |
605 | .Ar size | |
606 | in bytes. | |
607 | Enabling | |
608 | .Ic hash | |
609 | disables | |
610 | .Ic progress . | |
611 | .It Ic help Op Ar command | |
612 | Print an informative message about the meaning of | |
613 | .Ar command . | |
614 | If no argument is given, | |
615 | .Nm | |
616 | prints a list of the known commands. | |
617 | .It Ic idle Op Ar seconds | |
618 | Set the inactivity timer on the remote server to | |
619 | .Ar seconds | |
620 | seconds. | |
621 | If | |
622 | .Ar seconds | |
623 | is omitted, the current inactivity timer is printed. | |
624 | .It Ic image | |
625 | A synonym for | |
626 | .Ic binary . | |
627 | .It Ic lcd Op Ar directory | |
628 | Change the working directory on the local machine. | |
629 | If | |
630 | no | |
631 | .Ar directory | |
632 | is specified, the user's home directory is used. | |
633 | .It Ic less Ar file | |
634 | A synonym for | |
635 | .Ic page . | |
636 | .It Ic lpage Ar local-file | |
637 | Display | |
638 | .Ar local-file | |
639 | with the program specified by the | |
640 | .Ic "set pager" | |
641 | option. | |
642 | .It Ic lpwd | |
643 | Print the working directory on the local machine. | |
644 | .It Ic \&ls Op Ar remote-path Op Ar local-file | |
645 | A synonym for | |
646 | .Ic dir . | |
647 | .It Ic macdef Ar macro-name | |
648 | Define a macro. | |
649 | Subsequent lines are stored as the macro | |
650 | .Ar macro-name ; | |
651 | a null line (consecutive newline characters in a file or carriage | |
652 | returns from the terminal) terminates macro input mode. | |
653 | There is a limit of 16 macros and 4096 total characters in all | |
654 | defined macros. | |
655 | Macro names can be a maximum of 8 characters. | |
656 | Macros are only applicable to the current session they are | |
657 | defined within (or if defined outside a session, to the session | |
658 | invoked with the next | |
659 | .Ic open | |
660 | command), and remain defined until a | |
661 | .Ic close | |
662 | command is executed. | |
663 | To invoke a macro, use the | |
664 | .Ic $ | |
665 | command (see above). | |
666 | .Pp | |
667 | The macro processor interprets | |
668 | .Sq $ | |
669 | and | |
670 | .Sq \e | |
671 | as special characters. | |
672 | A | |
673 | .Sq $ | |
674 | followed by a number (or numbers) is replaced by the | |
675 | corresponding argument on the macro invocation command line. | |
676 | A | |
677 | .Sq $ | |
678 | followed by an | |
679 | .Sq i | |
680 | signals the macro processor that the executing macro is to be | |
681 | looped. | |
682 | On the first pass | |
683 | .Dq $i | |
684 | is replaced by the first argument on the macro invocation command | |
685 | line, on the second pass it is replaced by the second argument, | |
686 | and so on. | |
687 | A | |
688 | .Sq \e | |
689 | followed by any character is replaced by that character. | |
690 | Use the | |
691 | .Sq \e | |
692 | to prevent special treatment of the | |
693 | .Sq $ . | |
694 | .It Ic mdelete Op Ar remote-files | |
695 | Delete the | |
696 | .Ar remote-files | |
697 | on the remote machine. | |
698 | .It Ic mdir Ar remote-files local-file | |
699 | Like | |
700 | .Ic dir , | |
701 | except multiple remote files may be specified. | |
702 | If interactive prompting is on, | |
703 | .Nm | |
704 | will prompt the user to verify that the last argument is indeed the | |
705 | target local file for receiving | |
706 | .Ic mdir | |
707 | output. | |
708 | .It Ic mget Ar remote-files | |
709 | Expand the | |
710 | .Ar remote-files | |
711 | on the remote machine | |
712 | and do a | |
713 | .Ic get | |
714 | for each file name thus produced. | |
715 | See | |
716 | .Ic glob | |
717 | for details on the filename expansion. | |
718 | Resulting file names will then be processed according to | |
719 | .Ic case , | |
720 | .Ic ntrans , | |
721 | and | |
722 | .Ic nmap | |
723 | settings. | |
724 | Files are transferred into the local working directory, | |
725 | which can be changed with | |
726 | .Ql lcd directory ; | |
727 | new local directories can be created with | |
728 | .Ql "\&! mkdir directory" . | |
729 | .It Ic mkdir Ar directory-name | |
730 | Make a directory on the remote machine. | |
731 | .It Ic mls Ar remote-files local-file | |
732 | Like | |
733 | .Ic ls , | |
734 | except multiple remote files may be specified, | |
735 | and the | |
736 | .Ar local-file | |
737 | must be specified. | |
738 | If interactive prompting is on, | |
739 | .Nm | |
740 | will prompt the user to verify that the last argument is indeed the | |
741 | target local file for receiving | |
742 | .Ic mls | |
743 | output. | |
744 | .It Ic mlsd Op Ar remote-path | |
745 | Display the contents of | |
746 | .Ar remote-path | |
747 | (which should default to the current directory if not given) | |
748 | in a machine-parsable form, using | |
749 | .Dv MLSD . | |
750 | The format of display can be changed with | |
751 | .Sq "remopts mlst ..." . | |
752 | .It Ic mlst Op Ar remote-path | |
753 | Display the details about | |
754 | .Ar remote-path | |
755 | (which should default to the current directory if not given) | |
756 | in a machine-parsable form, using | |
757 | .Dv MLST . | |
758 | The format of display can be changed with | |
759 | .Sq "remopts mlst ..." . | |
760 | .It Ic mode Ar mode-name | |
761 | Set the file transfer | |
762 | .Ic mode | |
763 | to | |
764 | .Ar mode-name . | |
765 | The default (and only supported) | |
766 | mode is | |
767 | .Dq stream . | |
768 | .It Ic modtime Ar remote-file | |
c106ca54 | 769 | Show the last modification time of the file on the remote machine, in |
20e59a13 | 770 | .Li RFC 2822 |
c106ca54 | 771 | format. |
eedc536d PA |
772 | .It Ic more Ar file |
773 | A synonym for | |
774 | .Ic page . | |
775 | .It Ic mput Ar local-files | |
776 | Expand wild cards in the list of local files given as arguments | |
777 | and do a | |
778 | .Ic put | |
779 | for each file in the resulting list. | |
780 | See | |
781 | .Ic glob | |
782 | for details of filename expansion. | |
783 | Resulting file names will then be processed according to | |
784 | .Ic ntrans | |
785 | and | |
786 | .Ic nmap | |
787 | settings. | |
788 | .It Ic mreget Ar remote-files | |
789 | As per | |
790 | .Ic mget , | |
791 | but performs a | |
792 | .Ic reget | |
793 | instead of | |
794 | .Ic get . | |
795 | .It Ic msend Ar local-files | |
796 | A synonym for | |
797 | .Ic mput . | |
798 | .It Ic newer Ar remote-file Op Ar local-file | |
799 | Get the file only if the modification time of the remote file is more | |
800 | recent that the file on the current system. | |
801 | If the file does not | |
802 | exist on the current system, the remote file is considered | |
803 | .Ic newer . | |
804 | Otherwise, this command is identical to | |
805 | .Ar get . | |
806 | .It Ic nlist Op Ar remote-path Op Ar local-file | |
807 | A synonym for | |
808 | .Ic ls . | |
809 | .It Ic nmap Op Ar inpattern outpattern | |
810 | Set or unset the filename mapping mechanism. | |
811 | If no arguments are specified, the filename mapping mechanism is unset. | |
812 | If arguments are specified, remote filenames are mapped during | |
813 | .Ic mput | |
814 | commands and | |
815 | .Ic put | |
816 | commands issued without a specified remote target filename. | |
817 | If arguments are specified, local filenames are mapped during | |
818 | .Ic mget | |
819 | commands and | |
820 | .Ic get | |
821 | commands issued without a specified local target filename. | |
822 | This command is useful when connecting to a | |
823 | .No non\- Ns Ux | |
824 | remote computer | |
825 | with different file naming conventions or practices. | |
826 | The mapping follows the pattern set by | |
827 | .Ar inpattern | |
828 | and | |
829 | .Ar outpattern . | |
830 | .Op Ar Inpattern | |
831 | is a template for incoming filenames (which may have already been | |
832 | processed according to the | |
833 | .Ic ntrans | |
834 | and | |
835 | .Ic case | |
836 | settings). | |
837 | Variable templating is accomplished by including the | |
838 | sequences | |
839 | .Dq $1 , | |
840 | .Dq $2 , | |
841 | \&... | |
842 | .Dq $9 | |
843 | in | |
844 | .Ar inpattern . | |
845 | Use | |
846 | .Sq \e | |
847 | to prevent this special treatment of the | |
848 | .Sq $ | |
849 | character. | |
850 | All other characters are treated literally, and are used to determine the | |
851 | .Ic nmap | |
852 | .Op Ar inpattern | |
853 | variable values. | |
854 | For example, given | |
855 | .Ar inpattern | |
856 | $1.$2 and the remote file name "mydata.data", $1 would have the value | |
857 | "mydata", and $2 would have the value "data". | |
858 | The | |
859 | .Ar outpattern | |
860 | determines the resulting mapped filename. | |
861 | The sequences | |
862 | .Dq $1 , | |
863 | .Dq $2 , | |
864 | \&... | |
865 | .Dq $9 | |
866 | are replaced by any value resulting from the | |
867 | .Ar inpattern | |
868 | template. | |
869 | The sequence | |
870 | .Dq $0 | |
871 | is replaced by the original filename. | |
872 | Additionally, the sequence | |
873 | .Dq Op Ar seq1 , Ar seq2 | |
874 | is replaced by | |
875 | .Op Ar seq1 | |
876 | if | |
877 | .Ar seq1 | |
878 | is not a null string; otherwise it is replaced by | |
879 | .Ar seq2 . | |
880 | For example, the command | |
881 | .Pp | |
882 | .Bd -literal -offset indent -compact | |
883 | nmap $1.$2.$3 [$1,$2].[$2,file] | |
884 | .Ed | |
885 | .Pp | |
886 | would yield | |
887 | the output filename "myfile.data" for input filenames "myfile.data" and | |
888 | "myfile.data.old", "myfile.file" for the input filename "myfile", and | |
889 | "myfile.myfile" for the input filename ".myfile". | |
890 | Spaces may be included in | |
891 | .Ar outpattern , | |
892 | as in the example: | |
893 | .Dl nmap $1 sed "s/ *$//" \*[Gt] $1 | |
894 | Use the | |
895 | .Sq \e | |
896 | character to prevent special treatment | |
897 | of the | |
898 | .Sq $ , | |
899 | .Sq \&[ , | |
900 | .Sq \&] , | |
901 | and | |
902 | .Sq \&, | |
903 | characters. | |
904 | .It Ic ntrans Op Ar inchars Op Ar outchars | |
905 | Set or unset the filename character translation mechanism. | |
906 | If no arguments are specified, the filename character | |
907 | translation mechanism is unset. | |
908 | If arguments are specified, characters in | |
909 | remote filenames are translated during | |
910 | .Ic mput | |
911 | commands and | |
912 | .Ic put | |
913 | commands issued without a specified remote target filename. | |
914 | If arguments are specified, characters in | |
915 | local filenames are translated during | |
916 | .Ic mget | |
917 | commands and | |
918 | .Ic get | |
919 | commands issued without a specified local target filename. | |
920 | This command is useful when connecting to a | |
921 | .No non\- Ns Ux | |
922 | remote computer | |
923 | with different file naming conventions or practices. | |
924 | Characters in a filename matching a character in | |
925 | .Ar inchars | |
926 | are replaced with the corresponding character in | |
927 | .Ar outchars . | |
928 | If the character's position in | |
929 | .Ar inchars | |
930 | is longer than the length of | |
931 | .Ar outchars , | |
932 | the character is deleted from the file name. | |
933 | .It Ic open Ar host Op Ar port | |
934 | Establish a connection to the specified | |
935 | .Ar host | |
936 | .Tn FTP | |
937 | server. | |
938 | An optional port number may be supplied, | |
939 | in which case, | |
940 | .Nm | |
941 | will attempt to contact an | |
942 | .Tn FTP | |
943 | server at that port. | |
944 | If the | |
945 | .Ic "set auto-login" | |
946 | option is on (default), | |
947 | .Nm | |
948 | will also attempt to automatically log the user in to | |
949 | the | |
950 | .Tn FTP | |
951 | server (see below). | |
952 | .It Ic page Ar file | |
953 | Retrieve | |
954 | .Ic file | |
955 | and display with the program specified by the | |
956 | .Ic "set pager" | |
957 | option. | |
958 | .It Ic passive Op Cm auto | |
959 | Toggle passive mode (if no arguments are given). | |
960 | If | |
961 | .Cm auto | |
962 | is given, act as if | |
963 | .Ev FTPMODE | |
964 | is set to | |
965 | .Sq auto . | |
966 | If passive mode is turned on (default), | |
967 | .Nm | |
968 | will send a | |
969 | .Dv PASV | |
970 | command for all data connections instead of a | |
971 | .Dv PORT | |
972 | command. | |
973 | The | |
974 | .Dv PASV | |
975 | command requests that the remote server open a port for the data connection | |
976 | and return the address of that port. | |
977 | The remote server listens on that port and the client connects to it. | |
978 | When using the more traditional | |
979 | .Dv PORT | |
980 | command, the client listens on a port and sends that address to the remote | |
981 | server, who connects back to it. | |
982 | Passive mode is useful when using | |
983 | .Nm | |
984 | through a gateway router or host that controls the directionality of | |
985 | traffic. | |
986 | (Note that though | |
987 | .Tn FTP | |
988 | servers are required to support the | |
989 | .Dv PASV | |
990 | command by | |
20e59a13 | 991 | .Li RFC 1123 , |
eedc536d PA |
992 | some do not.) |
993 | .It Ic pdir Op Ar remote-path | |
994 | Perform | |
995 | .Ic dir | |
996 | .Op Ar remote-path , | |
997 | and display the result with the program specified by the | |
998 | .Ic "set pager" | |
999 | option. | |
1000 | .It Ic pls Op Ar remote-path | |
1001 | Perform | |
1002 | .Ic ls | |
1003 | .Op Ar remote-path , | |
1004 | and display the result with the program specified by the | |
1005 | .Ic "set pager" | |
1006 | option. | |
1007 | .It Ic pmlsd Op Ar remote-path | |
1008 | Perform | |
1009 | .Ic mlsd | |
1010 | .Op Ar remote-path , | |
1011 | and display the result with the program specified by the | |
1012 | .Ic "set pager" | |
1013 | option. | |
1014 | .It Ic preserve | |
1015 | Toggle preservation of modification times on retrieved files. | |
1016 | .It Ic progress | |
1017 | Toggle display of transfer progress bar. | |
1018 | The progress bar will be disabled for a transfer that has | |
1019 | .Ar local-file | |
1020 | as | |
1021 | .Sq Fl | |
1022 | or a command that starts with | |
1023 | .Sq \&| . | |
1024 | Refer to | |
1025 | .Sx FILE NAMING CONVENTIONS | |
1026 | for more information. | |
1027 | Enabling | |
1028 | .Ic progress | |
1029 | disables | |
1030 | .Ic hash . | |
1031 | .It Ic prompt | |
1032 | Toggle interactive prompting. | |
1033 | Interactive prompting | |
1034 | occurs during multiple file transfers to allow the | |
1035 | user to selectively retrieve or store files. | |
1036 | If prompting is turned off (default is on), any | |
1037 | .Ic mget | |
1038 | or | |
1039 | .Ic mput | |
1040 | will transfer all files, and any | |
1041 | .Ic mdelete | |
1042 | will delete all files. | |
1043 | .Pp | |
1044 | When prompting is on, the following commands are available at a prompt: | |
1045 | .Bl -tag -width 2n -offset indent | |
1046 | .It Cm a | |
1047 | Answer | |
1048 | .Sq yes | |
1049 | to the current file, and automatically answer | |
1050 | .Sq yes | |
1051 | to any remaining files for the current command. | |
1052 | .It Cm n | |
1053 | Answer | |
1054 | .Sq no , | |
1055 | and do not transfer the file. | |
1056 | .It Cm p | |
1057 | Answer | |
1058 | .Sq yes | |
1059 | to the current file, and turn off prompt mode | |
1060 | (as is | |
1061 | .Dq prompt off | |
1062 | had been given). | |
1063 | .It Cm q | |
1064 | Terminate the current operation. | |
1065 | .It Cm y | |
1066 | Answer | |
1067 | .Sq yes , | |
1068 | and transfer the file. | |
1069 | .It Cm \&? | |
1070 | Display a help message. | |
1071 | .El | |
1072 | .Pp | |
1073 | Any other response will answer | |
1074 | .Sq yes | |
1075 | to the current file. | |
1076 | .It Ic proxy Ar ftp-command | |
1077 | Execute an ftp command on a secondary control connection. | |
1078 | This command allows simultaneous connection to two remote | |
1079 | .Tn FTP | |
1080 | servers for transferring files between the two servers. | |
1081 | The first | |
1082 | .Ic proxy | |
1083 | command should be an | |
1084 | .Ic open , | |
1085 | to establish the secondary control connection. | |
1086 | Enter the command "proxy ?" to see other | |
1087 | .Tn FTP | |
1088 | commands executable on the secondary connection. | |
1089 | The following commands behave differently when prefaced by | |
1090 | .Ic proxy : | |
1091 | .Ic open | |
1092 | will not define new macros during the auto-login process, | |
1093 | .Ic close | |
1094 | will not erase existing macro definitions, | |
1095 | .Ic get | |
1096 | and | |
1097 | .Ic mget | |
1098 | transfer files from the host on the primary control connection | |
1099 | to the host on the secondary control connection, and | |
1100 | .Ic put , | |
1101 | .Ic mput , | |
1102 | and | |
1103 | .Ic append | |
1104 | transfer files from the host on the secondary control connection | |
1105 | to the host on the primary control connection. | |
1106 | Third party file transfers depend upon support of the | |
1107 | .Tn FTP | |
1108 | protocol | |
1109 | .Dv PASV | |
1110 | command by the server on the secondary control connection. | |
1111 | .It Ic put Ar local-file Op Ar remote-file | |
1112 | Store a local file on the remote machine. | |
1113 | If | |
1114 | .Ar remote-file | |
1115 | is left unspecified, the local file name is used | |
1116 | after processing according to any | |
1117 | .Ic ntrans | |
1118 | or | |
1119 | .Ic nmap | |
1120 | settings | |
1121 | in naming the remote file. | |
1122 | File transfer uses the | |
1123 | current settings for | |
1124 | .Ic type , | |
1125 | .Ic format , | |
1126 | .Ic mode , | |
1127 | and | |
1128 | .Ic structure . | |
1129 | .It Ic pwd | |
1130 | Print the name of the current working directory on the remote | |
1131 | machine. | |
1132 | .It Ic quit | |
1133 | A synonym for | |
1134 | .Ic bye . | |
1135 | .It Ic quote Ar arg1 arg2 ... | |
1136 | The arguments specified are sent, verbatim, to the remote | |
1137 | .Tn FTP | |
1138 | server. | |
20e59a13 | 1139 | .It Ic rate Ar direction Oo Ar maximum Oo Ar increment Oc Oc |
eedc536d PA |
1140 | Throttle the maximum transfer rate to |
1141 | .Ar maximum | |
1142 | bytes/second. | |
1143 | If | |
1144 | .Ar maximum | |
1145 | is 0, disable the throttle. | |
1146 | .Pp | |
1147 | .Ar direction | |
1148 | may be one of: | |
1149 | .Bl -tag -width "all" -offset indent -compact | |
1150 | .It Cm all | |
1151 | Both directions. | |
1152 | .It Cm get | |
1153 | Incoming transfers. | |
1154 | .It Cm put | |
1155 | Outgoing transfers. | |
1156 | .El | |
1157 | .Pp | |
1158 | .Ar maximum | |
1159 | can be modified on the fly by | |
1160 | .Ar increment | |
1161 | bytes (default: 1024) each time a given signal is received: | |
eedc536d PA |
1162 | .Bl -tag -width "SIGUSR1" -offset indent |
1163 | .It Dv SIGUSR1 | |
1164 | Increment | |
1165 | .Ar maximum | |
1166 | by | |
1167 | .Ar increment | |
1168 | bytes. | |
1169 | .It Dv SIGUSR2 | |
1170 | Decrement | |
1171 | .Ar maximum | |
1172 | by | |
1173 | .Ar increment | |
1174 | bytes. | |
1175 | The result must be a positive number. | |
1176 | .El | |
1177 | .Pp | |
1178 | If | |
1179 | .Ar maximum | |
1180 | is not supplied, the current throttle rates are displayed. | |
1181 | .Pp | |
1182 | Note: | |
1183 | .Ic rate | |
1184 | is not yet implemented for ascii mode transfers. | |
1185 | .It Ic rcvbuf Ar size | |
1186 | Set the size of the socket receive buffer to | |
1187 | .Ar size . | |
1188 | .It Ic recv Ar remote-file Op Ar local-file | |
1189 | A synonym for | |
1190 | .Ic get . | |
1191 | .It Ic reget Ar remote-file Op Ar local-file | |
1192 | .Ic reget | |
1193 | acts like | |
1194 | .Ic get , | |
1195 | except that if | |
1196 | .Ar local-file | |
1197 | exists and is | |
1198 | smaller than | |
1199 | .Ar remote-file , | |
1200 | .Ar local-file | |
1201 | is presumed to be | |
1202 | a partially transferred copy of | |
1203 | .Ar remote-file | |
1204 | and the transfer | |
1205 | is continued from the apparent point of failure. | |
1206 | This command | |
1207 | is useful when transferring very large files over networks that | |
1208 | are prone to dropping connections. | |
1209 | .It Ic remopts Ar command Op Ar command-options | |
1210 | Set options on the remote | |
1211 | .Tn FTP | |
1212 | server for | |
1213 | .Ar command | |
1214 | to | |
1215 | .Ar command-options | |
1216 | (whose absence is handled on a command-specific basis). | |
1217 | Remote | |
1218 | .Tn FTP | |
1219 | commands known to support options include: | |
1220 | .Sq MLST | |
1221 | (used for | |
1222 | .Dv MLSD | |
1223 | and | |
1224 | .Dv MLST ) . | |
1225 | .It Ic rename Op Ar from Op Ar to | |
1226 | Rename the file | |
1227 | .Ar from | |
1228 | on the remote machine, to the file | |
1229 | .Ar to . | |
1230 | .It Ic reset | |
1231 | Clear reply queue. | |
1232 | This command re-synchronizes command/reply sequencing with the remote | |
1233 | .Tn FTP | |
1234 | server. | |
1235 | Resynchronization may be necessary following a violation of the | |
1236 | .Tn FTP | |
1237 | protocol by the remote server. | |
1238 | .It Ic restart Ar marker | |
1239 | Restart the immediately following | |
1240 | .Ic get | |
1241 | or | |
1242 | .Ic put | |
1243 | at the | |
1244 | indicated | |
1245 | .Ar marker . | |
1246 | On | |
1247 | .Ux | |
1248 | systems, marker is usually a byte | |
1249 | offset into the file. | |
1250 | .It Ic rhelp Op Ar command-name | |
1251 | Request help from the remote | |
1252 | .Tn FTP | |
1253 | server. | |
1254 | If a | |
1255 | .Ar command-name | |
1256 | is specified it is supplied to the server as well. | |
1257 | .It Ic rmdir Ar directory-name | |
1258 | Delete a directory on the remote machine. | |
1259 | .It Ic rstatus Op Ar remote-file | |
1260 | With no arguments, show status of remote machine. | |
1261 | If | |
1262 | .Ar remote-file | |
1263 | is specified, show status of | |
1264 | .Ar remote-file | |
1265 | on remote machine. | |
1266 | .It Ic runique | |
1267 | Toggle storing of files on the local system with unique filenames. | |
1268 | If a file already exists with a name equal to the target | |
1269 | local filename for a | |
1270 | .Ic get | |
1271 | or | |
1272 | .Ic mget | |
1273 | command, a ".1" is appended to the name. | |
1274 | If the resulting name matches another existing file, | |
1275 | a ".2" is appended to the original name. | |
1276 | If this process continues up to ".99", an error | |
1277 | message is printed, and the transfer does not take place. | |
1278 | The generated unique filename will be reported. | |
1279 | Note that | |
1280 | .Ic runique | |
1281 | will not affect local files generated from a shell command | |
1282 | (see below). | |
1283 | The default value is off. | |
1284 | .It Ic send Ar local-file Op Ar remote-file | |
1285 | A synonym for | |
1286 | .Ic put . | |
1287 | .It Ic sendport | |
1288 | Toggle the use of | |
1289 | .Dv PORT | |
1290 | commands. | |
1291 | By default, | |
1292 | .Nm | |
1293 | will attempt to use a | |
1294 | .Dv PORT | |
1295 | command when establishing | |
1296 | a connection for each data transfer. | |
1297 | The use of | |
1298 | .Dv PORT | |
1299 | commands can prevent delays | |
1300 | when performing multiple file transfers. | |
1301 | If the | |
1302 | .Dv PORT | |
1303 | command fails, | |
1304 | .Nm | |
1305 | will use the default data port. | |
1306 | When the use of | |
1307 | .Dv PORT | |
1308 | commands is disabled, no attempt will be made to use | |
1309 | .Dv PORT | |
1310 | commands for each data transfer. | |
1311 | This is useful | |
1312 | for certain | |
1313 | .Tn FTP | |
1314 | implementations which do ignore | |
1315 | .Dv PORT | |
1316 | commands but, incorrectly, indicate they've been accepted. | |
1317 | .It Ic set Op Ar option Ar value | |
1318 | Set | |
1319 | .Ar option | |
1320 | to | |
1321 | .Ar value . | |
1322 | If | |
1323 | .Ar option | |
1324 | and | |
1325 | .Ar value | |
1326 | are not given, display all of the options and their values. | |
1327 | The currently supported options are: | |
a83a5d06 | 1328 | .Bl -tag -width "https_proxy" -offset indent |
eedc536d PA |
1329 | .It Cm anonpass |
1330 | Defaults to | |
1331 | .Ev $FTPANONPASS | |
1332 | .It Cm ftp_proxy | |
1333 | Defaults to | |
1334 | .Ev $ftp_proxy . | |
1335 | .It Cm http_proxy | |
1336 | Defaults to | |
1337 | .Ev $http_proxy . | |
a83a5d06 PA |
1338 | .It Cm https_proxy |
1339 | Defaults to | |
1340 | .Ev $https_proxy . | |
eedc536d PA |
1341 | .It Cm no_proxy |
1342 | Defaults to | |
1343 | .Ev $no_proxy . | |
1344 | .It Cm pager | |
1345 | Defaults to | |
1346 | .Ev $PAGER . | |
1347 | .It Cm prompt | |
1348 | Defaults to | |
1349 | .Ev $FTPPROMPT . | |
1350 | .It Cm rprompt | |
1351 | Defaults to | |
1352 | .Ev $FTPRPROMPT . | |
1353 | .El | |
1354 | .It Ic site Ar arg1 arg2 ... | |
1355 | The arguments specified are sent, verbatim, to the remote | |
1356 | .Tn FTP | |
1357 | server as a | |
1358 | .Dv SITE | |
1359 | command. | |
1360 | .It Ic size Ar remote-file | |
1361 | Return size of | |
1362 | .Ar remote-file | |
1363 | on remote machine. | |
1364 | .It Ic sndbuf Ar size | |
1365 | Set the size of the socket send buffer to | |
1366 | .Ar size . | |
1367 | .It Ic status | |
1368 | Show the current status of | |
1369 | .Nm ftp . | |
1370 | .It Ic struct Ar struct-name | |
1371 | Set the file transfer | |
1372 | .Ar structure | |
1373 | to | |
1374 | .Ar struct-name . | |
1375 | The default (and only supported) | |
1376 | structure is | |
1377 | .Dq file . | |
1378 | .It Ic sunique | |
1379 | Toggle storing of files on remote machine under unique file names. | |
1380 | The remote | |
1381 | .Tn FTP | |
1382 | server must support | |
1383 | .Tn FTP | |
1384 | protocol | |
1385 | .Dv STOU | |
1386 | command for | |
1387 | successful completion. | |
1388 | The remote server will report unique name. | |
1389 | Default value is off. | |
1390 | .It Ic system | |
1391 | Show the type of operating system running on the remote machine. | |
1392 | .It Ic tenex | |
1393 | Set the file transfer type to that needed to | |
1394 | talk to | |
1395 | .Tn TENEX | |
1396 | machines. | |
1397 | .It Ic throttle | |
1398 | A synonym for | |
1399 | .Ic rate . | |
1400 | .It Ic trace | |
1401 | Toggle packet tracing. | |
1402 | .It Ic type Op Ar type-name | |
1403 | Set the file transfer | |
1404 | .Ic type | |
1405 | to | |
1406 | .Ar type-name . | |
1407 | If no type is specified, the current type | |
1408 | is printed. | |
1409 | The default type is network | |
1410 | .Tn ASCII . | |
1411 | .It Ic umask Op Ar newmask | |
1412 | Set the default umask on the remote server to | |
1413 | .Ar newmask . | |
1414 | If | |
1415 | .Ar newmask | |
1416 | is omitted, the current umask is printed. | |
1417 | .It Ic unset Ar option | |
1418 | Unset | |
1419 | .Ar option . | |
1420 | Refer to | |
1421 | .Ic set | |
1422 | for more information. | |
1423 | .It Ic usage Ar command | |
1424 | Print the usage message for | |
1425 | .Ar command . | |
20e59a13 | 1426 | .It Ic user Ar user-name Oo Ar password Oo Ar account Oc Oc |
eedc536d PA |
1427 | Identify yourself to the remote |
1428 | .Tn FTP | |
1429 | server. | |
1430 | If the | |
1431 | .Ar password | |
1432 | is not specified and the server requires it, | |
1433 | .Nm | |
1434 | will prompt the user for it (after disabling local echo). | |
1435 | If an | |
1436 | .Ar account | |
1437 | field is not specified, and the | |
1438 | .Tn FTP | |
1439 | server | |
1440 | requires it, the user will be prompted for it. | |
1441 | If an | |
1442 | .Ar account | |
1443 | field is specified, an account command will | |
1444 | be relayed to the remote server after the login sequence | |
1445 | is completed if the remote server did not require it | |
1446 | for logging in. | |
1447 | Unless | |
1448 | .Nm | |
1449 | is invoked with | |
1450 | .Dq auto-login | |
1451 | disabled, this process is done automatically on initial connection to the | |
1452 | .Tn FTP | |
1453 | server. | |
1454 | .It Ic verbose | |
1455 | Toggle verbose mode. | |
1456 | In verbose mode, all responses from | |
1457 | the | |
1458 | .Tn FTP | |
1459 | server are displayed to the user. | |
1460 | In addition, | |
1461 | if verbose is on, when a file transfer completes, statistics | |
1462 | regarding the efficiency of the transfer are reported. | |
1463 | By default, | |
1464 | verbose is on. | |
1465 | .It Ic xferbuf Ar size | |
1466 | Set the size of the socket send and receive buffers to | |
1467 | .Ar size . | |
1468 | .It Ic \&? Op Ar command | |
1469 | A synonym for | |
1470 | .Ic help . | |
1471 | .El | |
1472 | .Pp | |
1473 | Command arguments which have embedded spaces may be quoted with | |
1474 | quote | |
1475 | .Sq \&" | |
1476 | marks. | |
1477 | .Pp | |
1478 | Commands which toggle settings can take an explicit | |
1479 | .Ic on | |
1480 | or | |
1481 | .Ic off | |
1482 | argument to force the setting appropriately. | |
1483 | .Pp | |
1484 | Commands which take a byte count as an argument | |
1485 | (e.g., | |
1486 | .Ic hash , | |
1487 | .Ic rate , | |
1488 | and | |
1489 | .Ic xferbuf ) | |
1490 | support an optional suffix on the argument which changes the | |
1491 | interpretation of the argument. | |
1492 | Supported suffixes are: | |
1493 | .Bl -tag -width 3n -offset indent -compact | |
1494 | .It Li b | |
1495 | Causes no modification. | |
1496 | (Optional) | |
1497 | .It Li k | |
1498 | Kilo; multiply the argument by 1024 | |
1499 | .It Li m | |
1500 | Mega; multiply the argument by 1048576 | |
1501 | .It Li g | |
1502 | Giga; multiply the argument by 1073741824 | |
1503 | .El | |
1504 | .Pp | |
1505 | If | |
1506 | .Nm | |
1507 | receives a | |
1508 | .Dv SIGINFO | |
1509 | (see the | |
1510 | .Dq status | |
1511 | argument of | |
1512 | .Xr stty 1 ) | |
1513 | or | |
1514 | .Dv SIGQUIT | |
1515 | signal whilst a transfer is in progress, the current transfer rate | |
1516 | statistics will be written to the standard error output, in the | |
1517 | same format as the standard completion message. | |
1518 | .Sh AUTO-FETCHING FILES | |
1519 | In addition to standard commands, this version of | |
1520 | .Nm | |
1521 | supports an auto-fetch feature. | |
1522 | To enable auto-fetch, simply pass the list of hostnames/files | |
1523 | on the command line. | |
1524 | .Pp | |
1525 | The following formats are valid syntax for an auto-fetch element: | |
1526 | .Bl -tag -width "FOO " | |
1527 | .\" [user@]host:[path][/] | |
20e59a13 PA |
1528 | .It Oo Ar user Ns Li \&@ Oc Ns Ar host Ns Li \&: Ns Oo Ar path Oc \ |
1529 | Ns Oo Li / Oc | |
eedc536d PA |
1530 | .Dq Classic |
1531 | .Tn FTP | |
1532 | format. | |
1533 | .Pp | |
1534 | If | |
1535 | .Ar path | |
1536 | contains a glob character and globbing is enabled, | |
1537 | (see | |
1538 | .Ic glob ) , | |
1539 | then the equivalent of | |
1540 | .Ql mget path | |
1541 | is performed. | |
1542 | .Pp | |
1543 | If the directory component of | |
1544 | .Ar path | |
1545 | contains no globbing characters, | |
1546 | it is stored locally with the name basename (see | |
1547 | .Xr basename 1 ) | |
1548 | of | |
1549 | .Ic path , | |
1550 | in the current directory. | |
1551 | Otherwise, the full remote name is used as the local name, | |
1552 | relative to the local root directory. | |
1553 | .\" ftp://[user[:password]@]host[:port]/path[/][;type=X] | |
20e59a13 PA |
1554 | .It Li ftp:// Ns Oo Ar user Ns Oo Ns Li \&: Ns Ar password Oc Ns Li \&@ Oc \ |
1555 | Ns Ar host Ns Oo Li \&: Ns Ar port Oc Ns Li / Ns Ar path Ns Oo Li / Oc \ | |
1556 | Ns Oo Li ;type= Ns Ar X Oc | |
eedc536d PA |
1557 | An |
1558 | .Tn FTP | |
1559 | URL, retrieved using the | |
1560 | .Tn FTP | |
1561 | protocol if | |
1562 | .Ic "set ftp_proxy" | |
1563 | isn't defined. | |
1564 | Otherwise, transfer the URL using | |
1565 | .Tn HTTP | |
1566 | via the proxy defined in | |
1567 | .Ic "set ftp_proxy" . | |
1568 | If | |
1569 | .Ic "set ftp_proxy" | |
1570 | isn't defined and | |
1571 | .Ar user | |
1572 | is given, login as | |
1573 | .Ar user . | |
1574 | In this case, use | |
1575 | .Ar password | |
1576 | if supplied, otherwise prompt the user for one. | |
1577 | .Pp | |
1578 | If a suffix of | |
1579 | .Sq ;type=A | |
1580 | or | |
1581 | .Sq ;type=I | |
1582 | is supplied, then the transfer type will take place as | |
1583 | ascii or binary (respectively). | |
1584 | The default transfer type is binary. | |
1585 | .Pp | |
1586 | In order to be compliant with | |
20e59a13 | 1587 | .Li RFC 3986 , |
eedc536d PA |
1588 | .Nm |
1589 | interprets the | |
1590 | .Ar path | |
1591 | part of an | |
1592 | .Dq ftp:// | |
1593 | auto-fetch URL as follows: | |
1594 | .Bl -bullet | |
1595 | .It | |
1596 | The | |
1597 | .Sq Li / | |
1598 | immediately after the | |
1599 | .Ar host Ns Oo Li \&: Ns Ar port Oc | |
1600 | is interpreted as a separator before the | |
1601 | .Ar path , | |
1602 | and not as part of the | |
1603 | .Ar path | |
1604 | itself. | |
1605 | .It | |
1606 | The | |
1607 | .Ar path | |
1608 | is interpreted as a | |
1609 | .So Li / Sc Ns -separated | |
1610 | list of name components. | |
1611 | For all but the last such component, | |
1612 | .Nm | |
1613 | performs the equivalent of a | |
1614 | .Ic cd | |
1615 | command. | |
1616 | For the last path component, | |
1617 | .Nm | |
1618 | performs the equivalent of a | |
1619 | .Ic get | |
1620 | command. | |
1621 | .It | |
1622 | Empty name components, | |
1623 | which result from | |
1624 | .Sq Li // | |
1625 | within the | |
1626 | .Ar path , | |
1627 | or from an extra | |
1628 | .Sq Li / | |
1629 | at the beginning of the | |
1630 | .Ar path , | |
1631 | will cause the equivalent of a | |
1632 | .Ic cd | |
1633 | command without a directory name. | |
1634 | This is unlikely to be useful. | |
1635 | .It | |
1636 | Any | |
1637 | .Sq Li \&% Ns Ar XX | |
1638 | codes | |
1639 | (per | |
20e59a13 | 1640 | .Li RFC 3986 ) |
eedc536d PA |
1641 | within the path components are decoded, with |
1642 | .Ar XX | |
1643 | representing a character code in hexadecimal. | |
1644 | This decoding takes place after the | |
1645 | .Ar path | |
1646 | has been split into components, | |
1647 | but before each component is used in the equivalent of a | |
1648 | .Ic cd | |
1649 | or | |
1650 | .Ic get | |
1651 | command. | |
1652 | Some often-used codes are | |
1653 | .Sq Li \&%2F | |
1654 | (which represents | |
1655 | .Sq Li / ) | |
1656 | and | |
1657 | .Sq Li \&%7E | |
1658 | (which represents | |
1659 | .Sq Li ~ ) . | |
1660 | .El | |
1661 | .Pp | |
1662 | The above interpretation has the following consequences: | |
1663 | .Bl -bullet | |
1664 | .It | |
1665 | The path is interpreted relative to the | |
1666 | default login directory of the specified user or of the | |
1667 | .Sq anonymous | |
1668 | user. | |
1669 | If the | |
1670 | .Pa / | |
1671 | directory is required, use a leading path of | |
1672 | .Dq %2F . | |
1673 | If a user's home directory is required (and the remote server supports | |
1674 | the syntax), use a leading path of | |
1675 | .Dq %7Euser/ . | |
1676 | For example, to retrieve | |
1677 | .Pa /etc/motd | |
1678 | from | |
1679 | .Sq localhost | |
1680 | as the user | |
1681 | .Sq myname | |
1682 | with the password | |
1683 | .Sq mypass , | |
1684 | use | |
1685 | .Dq ftp://myname:mypass@localhost/%2fetc/motd | |
1686 | .It | |
1687 | The exact | |
1688 | .Ic cd | |
1689 | and | |
1690 | .Ic get | |
1691 | commands can be controlled by careful choice of | |
1692 | where to use | |
1693 | .Sq / | |
1694 | and where to use | |
1695 | .Sq %2F | |
1696 | (or | |
1697 | .Sq %2f ) . | |
1698 | For example, the following URLs correspond to the | |
1699 | equivalents of the indicated commands: | |
1700 | .Bl -tag -width "ftp://host/%2Fdir1%2Fdir2%2Ffile" | |
1701 | .It ftp://host/dir1/dir2/file | |
1702 | .Dq "cd dir1" , | |
1703 | .Dq "cd dir2" , | |
1704 | .Dq "get file" . | |
1705 | .It ftp://host/%2Fdir1/dir2/file | |
1706 | .Dq "cd /dir1" , | |
1707 | .Dq "cd dir2" , | |
1708 | .Dq "get file" . | |
1709 | .It ftp://host/dir1%2Fdir2/file | |
1710 | .Dq "cd dir1/dir2" , | |
1711 | .Dq "get file" . | |
1712 | .It ftp://host/%2Fdir1%2Fdir2/file | |
1713 | .Dq "cd /dir1/dir2" , | |
1714 | .Dq "get file" . | |
1715 | .It ftp://host/dir1%2Fdir2%2Ffile | |
1716 | .Dq "get dir1/dir2/file" . | |
1717 | .It ftp://host/%2Fdir1%2Fdir2%2Ffile | |
1718 | .Dq "get /dir1/dir2/file" . | |
1719 | .El | |
1720 | .It | |
1721 | You must have appropriate access permission for each of the | |
1722 | intermediate directories that is used in the equivalent of a | |
1723 | .Ic cd | |
1724 | command. | |
1725 | .El | |
1726 | .\" http://[user[:password]@]host[:port]/path | |
20e59a13 PA |
1727 | .It Li http:// Ns Oo Ar user Ns Oo Li \&: Ns Ar password Oc Ns Li \&@ Oc \ |
1728 | Ns Ar host Ns Oo Li \&: Ns Ar port Oc Ns Li / Ns Ar path | |
eedc536d PA |
1729 | An |
1730 | .Tn HTTP | |
1731 | URL, retrieved using the | |
1732 | .Tn HTTP | |
1733 | protocol. | |
1734 | If | |
1735 | .Ic "set http_proxy" | |
1736 | is defined, it is used as a URL to an | |
1737 | .Tn HTTP | |
1738 | proxy server. | |
1739 | If | |
1740 | .Tn HTTP | |
1741 | authorization is required to retrieve | |
1742 | .Ar path , | |
1743 | and | |
1744 | .Sq user | |
1745 | (and optionally | |
1746 | .Sq password ) | |
1747 | is in the URL, use them for the first attempt to authenticate. | |
a83a5d06 PA |
1748 | .\" https://[user[:password]@]host[:port]/path |
1749 | .It Li https:// Ns Oo Ar user Ns Oo Li \&: Ns Ar password Oc Ns Li \&@ Oc \ | |
1750 | Ns Ar host Ns Oo Li \&: Ns Ar port Oc Ns Li / Ns Ar path | |
1751 | An | |
1752 | .Tn HTTPS | |
1753 | URL, retrieved using the | |
1754 | .Tn HTTPS | |
1755 | protocol. | |
1756 | If | |
1757 | .Ic "set https_proxy" | |
1758 | is defined, it is used as a URL to an | |
1759 | .Tn HTTPS | |
1760 | proxy server. | |
1761 | If | |
1762 | .Tn HTTPS | |
1763 | authorization is required to retrieve | |
1764 | .Ar path , | |
1765 | and | |
1766 | .Sq user | |
1767 | (and optionally | |
1768 | .Sq password ) | |
1769 | is in the URL, use them for the first attempt to authenticate. | |
1770 | There is currently no certificate validation and verification. | |
eedc536d | 1771 | .\" file:///path |
20e59a13 | 1772 | .It Li file:/// Ns Ar path |
eedc536d PA |
1773 | A local URL, copied from |
1774 | .Pa / Ns Ar path | |
1775 | on the local host. | |
c106ca54 | 1776 | .\" about: |
20e59a13 | 1777 | .It Li about: Ns Ar topic |
c106ca54 PA |
1778 | Display information regarding |
1779 | .Ar topic ; | |
1780 | no file is retrieved for this auto-fetched element. | |
1781 | Supported values include: | |
1782 | .Bl -tag -width "about:version" | |
1783 | .It Li about:ftp | |
1784 | Information about | |
1785 | .Nm ftp . | |
1786 | .It Li about:version | |
1787 | The version of | |
1788 | .Nm ftp . | |
1789 | Useful to provide when reporting problems. | |
1790 | .El | |
eedc536d PA |
1791 | .El |
1792 | .Pp | |
1793 | Unless noted otherwise above, and | |
1794 | .Fl o Ar output | |
1795 | is not given, the file is stored in the current directory as the | |
1796 | .Xr basename 1 | |
1797 | of | |
1798 | .Ar path . | |
1799 | Note that if a | |
1800 | .Tn HTTP | |
1801 | redirect is received, the fetch is retried using the new target URL | |
1802 | supplied by the server, with a corresponding new | |
1803 | .Ar path . | |
1804 | Using an explicit | |
1805 | .Fl o Ar output | |
1806 | is recommended, to avoid writing to unexpected file names. | |
1807 | .Pp | |
1808 | If a classic format or an | |
1809 | .Tn FTP | |
1810 | URL format has a trailing | |
1811 | .Sq / | |
1812 | or an empty | |
1813 | .Ar path | |
1814 | component, then | |
1815 | .Nm | |
1816 | will connect to the site and | |
1817 | .Ic cd | |
1818 | to the directory given as the path, and leave the user in interactive | |
1819 | mode ready for further input. | |
1820 | This will not work if | |
1821 | .Ic "set ftp_proxy" | |
1822 | is being used. | |
1823 | .Pp | |
1824 | Direct | |
1825 | .Tn HTTP | |
1826 | transfers use HTTP 1.1. | |
1827 | Proxied | |
1828 | .Tn FTP | |
1829 | and | |
1830 | .Tn HTTP | |
1831 | transfers use HTTP 1.0. | |
1832 | .Pp | |
1833 | If | |
1834 | .Fl R | |
1835 | is given, all auto-fetches that don't go via the | |
1836 | .Tn FTP | |
1837 | or | |
1838 | .Tn HTTP | |
1839 | proxies will be restarted. | |
1840 | For | |
1841 | .Tn FTP , | |
1842 | this is implemented by using | |
1843 | .Nm reget | |
1844 | instead of | |
1845 | .Nm get . | |
1846 | For | |
1847 | .Tn HTTP , | |
1848 | this is implemented by using the | |
1849 | .Sq "Range: bytes=" | |
1850 | .Tn "HTTP/1.1" | |
1851 | directive. | |
1852 | .Pp | |
1853 | If WWW or proxy WWW authentication is required, you will be prompted | |
1854 | to enter a username and password to authenticate with. | |
1855 | .Pp | |
1856 | When specifying IPv6 numeric addresses in a URL, you need to | |
1857 | surround the address in square brackets. | |
1858 | E.g.: | |
1859 | .Dq ftp://[::1]:21/ . | |
1860 | This is because colons are used in IPv6 numeric address as well as | |
1861 | being the separator for the port number. | |
1862 | .Sh ABORTING A FILE TRANSFER | |
1863 | To abort a file transfer, use the terminal interrupt key | |
1864 | (usually Ctrl-C). | |
1865 | Sending transfers will be immediately halted. | |
1866 | Receiving transfers will be halted by sending an | |
1867 | .Tn FTP | |
1868 | protocol | |
1869 | .Dv ABOR | |
1870 | command to the remote server, and discarding any further data received. | |
1871 | The speed at which this is accomplished depends upon the remote | |
1872 | server's support for | |
1873 | .Dv ABOR | |
1874 | processing. | |
1875 | If the remote server does not support the | |
1876 | .Dv ABOR | |
1877 | command, the prompt will not appear until the remote server has completed | |
1878 | sending the requested file. | |
1879 | .Pp | |
1880 | If the terminal interrupt key sequence is used whilst | |
1881 | .Nm | |
1882 | is awaiting a reply from the remote server for the ABOR processing, | |
1883 | then the connection will be closed. | |
1884 | This is different from the traditional behaviour (which ignores the | |
1885 | terminal interrupt during this phase), but is considered more useful. | |
1886 | .Sh FILE NAMING CONVENTIONS | |
1887 | Files specified as arguments to | |
1888 | .Nm | |
1889 | commands are processed according to the following rules. | |
1890 | .Bl -enum | |
1891 | .It | |
1892 | If the file name | |
1893 | .Sq Fl | |
1894 | is specified, the | |
1895 | .Ar stdin | |
1896 | (for reading) or | |
1897 | .Ar stdout | |
1898 | (for writing) is used. | |
1899 | .It | |
1900 | If the first character of the file name is | |
1901 | .Sq \&| , | |
1902 | the | |
1903 | remainder of the argument is interpreted as a shell command. | |
1904 | .Nm | |
1905 | then forks a shell, using | |
1906 | .Xr popen 3 | |
1907 | with the argument supplied, and reads (writes) from the stdout | |
1908 | (stdin). | |
1909 | If the shell command includes spaces, the argument | |
1910 | must be quoted; e.g. | |
1911 | .Dq Qq Li \&| ls\ \-lt . | |
1912 | A particularly | |
1913 | useful example of this mechanism is: | |
1914 | .Dq Li dir \&"\&" \&|more . | |
1915 | .It | |
1916 | Failing the above checks, if | |
1917 | .Dq globbing | |
1918 | is enabled, local file names are expanded according to the rules | |
1919 | used in the | |
d2b51479 | 1920 | .Xr csh 1 ; |
eedc536d PA |
1921 | see the |
1922 | .Ic glob | |
1923 | command. | |
1924 | If the | |
1925 | .Nm | |
1926 | command expects a single local file (e.g. | |
1927 | .Ic put ) , | |
1928 | only the first filename generated by the "globbing" operation is used. | |
1929 | .It | |
1930 | For | |
1931 | .Ic mget | |
1932 | commands and | |
1933 | .Ic get | |
1934 | commands with unspecified local file names, the local filename is | |
1935 | the remote filename, which may be altered by a | |
1936 | .Ic case , | |
1937 | .Ic ntrans , | |
1938 | or | |
1939 | .Ic nmap | |
1940 | setting. | |
1941 | The resulting filename may then be altered if | |
1942 | .Ic runique | |
1943 | is on. | |
1944 | .It | |
1945 | For | |
1946 | .Ic mput | |
1947 | commands and | |
1948 | .Ic put | |
1949 | commands with unspecified remote file names, the remote filename is | |
1950 | the local filename, which may be altered by a | |
1951 | .Ic ntrans | |
1952 | or | |
1953 | .Ic nmap | |
1954 | setting. | |
1955 | The resulting filename may then be altered by the remote server if | |
1956 | .Ic sunique | |
1957 | is on. | |
1958 | .El | |
1959 | .Sh FILE TRANSFER PARAMETERS | |
1960 | The | |
1961 | .Tn FTP | |
1962 | specification specifies many parameters which may affect a file transfer. | |
1963 | The | |
1964 | .Ic type | |
1965 | may be one of | |
1966 | .Dq ascii , | |
1967 | .Dq image | |
1968 | (binary), | |
1969 | .Dq ebcdic , | |
1970 | and | |
1971 | .Dq local byte size | |
1972 | (for | |
1973 | .Tn PDP Ns -10's | |
1974 | and | |
1975 | .Tn PDP Ns -20's | |
1976 | mostly). | |
1977 | .Nm | |
1978 | supports the ascii and image types of file transfer, | |
1979 | plus local byte size 8 for | |
1980 | .Ic tenex | |
1981 | mode transfers. | |
1982 | .Pp | |
1983 | .Nm | |
1984 | supports only the default values for the remaining | |
1985 | file transfer parameters: | |
1986 | .Ic mode , | |
1987 | .Ic form , | |
1988 | and | |
1989 | .Ic struct . | |
1990 | .Sh THE .netrc FILE | |
1991 | The | |
1992 | .Pa .netrc | |
1993 | file contains login and initialization information | |
1994 | used by the auto-login process. | |
1995 | It resides in the user's home directory, | |
1996 | unless overridden with the | |
1997 | .Fl N Ar netrc | |
1998 | option, or specified in the | |
1999 | .Ev NETRC | |
2000 | environment variable. | |
2001 | The following tokens are recognized; they may be separated by spaces, | |
2002 | tabs, or new-lines: | |
2003 | .Bl -tag -width password | |
2004 | .It Ic machine Ar name | |
2005 | Identify a remote machine | |
2006 | .Ar name . | |
2007 | The auto-login process searches the | |
2008 | .Pa .netrc | |
2009 | file for a | |
2010 | .Ic machine | |
2011 | token that matches the remote machine specified on the | |
2012 | .Nm | |
2013 | command line or as an | |
2014 | .Ic open | |
2015 | command argument. | |
2016 | Once a match is made, the subsequent | |
2017 | .Pa .netrc | |
2018 | tokens are processed, | |
2019 | stopping when the end of file is reached or another | |
2020 | .Ic machine | |
2021 | or a | |
2022 | .Ic default | |
2023 | token is encountered. | |
2024 | .It Ic default | |
2025 | This is the same as | |
2026 | .Ic machine | |
2027 | .Ar name | |
2028 | except that | |
2029 | .Ic default | |
2030 | matches any name. | |
2031 | There can be only one | |
2032 | .Ic default | |
2033 | token, and it must be after all | |
2034 | .Ic machine | |
2035 | tokens. | |
2036 | This is normally used as: | |
2037 | .Pp | |
2038 | .Dl default login anonymous password user@site | |
2039 | .Pp | |
2040 | thereby giving the user an automatic anonymous | |
2041 | .Tn FTP | |
2042 | login to | |
2043 | machines not specified in | |
2044 | .Pa .netrc . | |
2045 | This can be overridden | |
2046 | by using the | |
2047 | .Fl n | |
2048 | flag to disable auto-login. | |
2049 | .It Ic login Ar name | |
2050 | Identify a user on the remote machine. | |
2051 | If this token is present, the auto-login process will initiate | |
2052 | a login using the specified | |
2053 | .Ar name . | |
2054 | .It Ic password Ar string | |
2055 | Supply a password. | |
2056 | If this token is present, the auto-login process will supply the | |
2057 | specified string if the remote server requires a password as part | |
2058 | of the login process. | |
2059 | Note that if this token is present in the | |
2060 | .Pa .netrc | |
2061 | file for any user other | |
2062 | than | |
2063 | .Ar anonymous , | |
2064 | .Nm | |
2065 | will abort the auto-login process if the | |
2066 | .Pa .netrc | |
2067 | is readable by | |
2068 | anyone besides the user. | |
2069 | .It Ic account Ar string | |
2070 | Supply an additional account password. | |
2071 | If this token is present, the auto-login process will supply the | |
2072 | specified string if the remote server requires an additional | |
2073 | account password, or the auto-login process will initiate an | |
2074 | .Dv ACCT | |
2075 | command if it does not. | |
2076 | .It Ic macdef Ar name | |
2077 | Define a macro. | |
2078 | This token functions like the | |
2079 | .Nm | |
2080 | .Ic macdef | |
2081 | command functions. | |
2082 | A macro is defined with the specified name; its contents begin with the | |
2083 | next | |
2084 | .Pa .netrc | |
2085 | line and continue until a blank line (consecutive new-line | |
2086 | characters) is encountered. | |
2087 | Like the other tokens in the | |
2088 | .Pa .netrc | |
2089 | file, a | |
2090 | .Ic macdef | |
2091 | is applicable only to the | |
2092 | .Ic machine | |
2093 | definition preceding it. | |
2094 | A | |
2095 | .Ic macdef | |
8b05fa7f | 2096 | entry cannot be used by multiple |
eedc536d PA |
2097 | .Ic machine |
2098 | definitions; rather, it must be defined following each | |
2099 | .Ic machine | |
2100 | it is intended to be used with. | |
2101 | If a macro named | |
2102 | .Ic init | |
2103 | is defined, it is automatically executed as the last step in the | |
2104 | auto-login process. | |
2105 | For example, | |
2106 | .Bd -literal -offset indent | |
2107 | default | |
2108 | macdef init | |
2109 | epsv4 off | |
2110 | .Ed | |
2111 | .Pp | |
2112 | followed by a blank line. | |
2113 | .El | |
2114 | .Sh COMMAND LINE EDITING | |
2115 | .Nm | |
2116 | supports interactive command line editing, via the | |
2117 | .Xr editline 3 | |
2118 | library. | |
2119 | It is enabled with the | |
2120 | .Ic edit | |
2121 | command, and is enabled by default if input is from a tty. | |
2122 | Previous lines can be recalled and edited with the arrow keys, | |
2123 | and other GNU Emacs-style editing keys may be used as well. | |
2124 | .Pp | |
2125 | The | |
2126 | .Xr editline 3 | |
2127 | library is configured with a | |
2128 | .Pa .editrc | |
2129 | file - refer to | |
2130 | .Xr editrc 5 | |
2131 | for more information. | |
2132 | .Pp | |
2133 | An extra key binding is available to | |
2134 | .Nm | |
2135 | to provide context sensitive command and filename completion | |
2136 | (including remote file completion). | |
2137 | To use this, bind a key to the | |
2138 | .Xr editline 3 | |
2139 | command | |
2140 | .Ic ftp-complete . | |
2141 | By default, this is bound to the TAB key. | |
2142 | .Sh COMMAND LINE PROMPT | |
2143 | By default, | |
2144 | .Nm | |
2145 | displays a command line prompt of | |
2146 | .Dq "ftp\*[Gt] " | |
2147 | to the user. | |
2148 | This can be changed with the | |
2149 | .Ic "set prompt" | |
2150 | command. | |
2151 | .Pp | |
2152 | A prompt can be displayed on the right side of the screen (after the | |
2153 | command input) with the | |
2154 | .Ic "set rprompt" | |
2155 | command. | |
2156 | .Pp | |
2157 | The following formatting sequences are replaced by the given | |
2158 | information: | |
2159 | .Bl -tag -width "%% " -offset indent | |
2160 | .It Li \&%/ | |
2161 | The current remote working directory. | |
2162 | .\" %c[[0]n], %.[[0]n] | |
20e59a13 | 2163 | .It \&%c Ns Oo Oo Li 0 Oc Ns Ar n Oc , Ns Li \&%. Ns Oo Oo Li 0 Oc Ns Ar n Oc |
eedc536d PA |
2164 | The trailing component of the current remote working directory, or |
2165 | .Em n | |
2166 | trailing components if a digit | |
2167 | .Em n | |
2168 | is given. | |
2169 | If | |
2170 | .Em n | |
2171 | begins with | |
2172 | .Sq 0 , | |
2173 | the number of skipped components precede the trailing component(s) in | |
2174 | the format | |
2175 | .\" ``/<number>trailing'' | |
2176 | .Do | |
2177 | .Sm off | |
2178 | .Li / Li \*[Lt] Va number Li \*[Gt] | |
2179 | .Va trailing | |
2180 | .Sm on | |
2181 | .Dc | |
2182 | (for | |
2183 | .Sq \&%c ) | |
2184 | or | |
2185 | .\" ``...trailing'' | |
2186 | .Dq Li \&... Ns Va trailing | |
2187 | (for | |
2188 | .Sq \&%. ) . | |
2189 | .It Li \&%M | |
2190 | The remote host name. | |
2191 | .It Li \&%m | |
2192 | The remote host name, up to the first | |
2193 | .Sq \&. . | |
2194 | .It Li \&%n | |
2195 | The remote user name. | |
2196 | .It Li \&%% | |
2197 | A single | |
2198 | .Sq % . | |
2199 | .El | |
2200 | .Sh ENVIRONMENT | |
2201 | .Nm | |
2202 | uses the following environment variables. | |
2203 | .Bl -tag -width "FTPSERVERPORT" | |
2204 | .It Ev FTPANONPASS | |
2205 | Password to send in an anonymous | |
2206 | .Tn FTP | |
2207 | transfer. | |
2208 | Defaults to | |
2209 | .Dq Li `whoami`@ . | |
2210 | .It Ev FTPMODE | |
2211 | Overrides the default operation mode. | |
2212 | Support values are: | |
2213 | .Bl -tag -width "passive" | |
2214 | .It Cm active | |
2215 | active mode | |
2216 | .Tn FTP | |
2217 | only | |
2218 | .It Cm auto | |
2219 | automatic determination of passive or active (this is the default) | |
2220 | .It Cm gate | |
2221 | gate-ftp mode | |
2222 | .It Cm passive | |
2223 | passive mode | |
2224 | .Tn FTP | |
2225 | only | |
2226 | .El | |
2227 | .It Ev FTPPROMPT | |
2228 | Command-line prompt to use. | |
2229 | Defaults to | |
2230 | .Dq "ftp\*[Gt] " . | |
2231 | Refer to | |
2232 | .Sx COMMAND LINE PROMPT | |
2233 | for more information. | |
2234 | .It Ev FTPRPROMPT | |
2235 | Command-line right side prompt to use. | |
2236 | Defaults to | |
2237 | .Dq "" . | |
2238 | Refer to | |
2239 | .Sx COMMAND LINE PROMPT | |
2240 | for more information. | |
2241 | .It Ev FTPSERVER | |
2242 | Host to use as gate-ftp server when | |
2243 | .Ic gate | |
2244 | is enabled. | |
2245 | .It Ev FTPSERVERPORT | |
2246 | Port to use when connecting to gate-ftp server when | |
2247 | .Ic gate | |
2248 | is enabled. | |
2249 | Default is port returned by a | |
2250 | .Fn getservbyname | |
2251 | lookup of | |
2252 | .Dq ftpgate/tcp . | |
2253 | .It Ev FTPUSERAGENT | |
2254 | The value to send for the | |
2255 | .Tn HTTP | |
2256 | User-Agent | |
2257 | header. | |
2258 | .It Ev HOME | |
2259 | For default location of a | |
2260 | .Pa .netrc | |
2261 | file, if one exists. | |
2262 | .It Ev NETRC | |
2263 | An alternate location of the | |
2264 | .Pa .netrc | |
2265 | file. | |
2266 | .It Ev PAGER | |
2267 | Used by various commands to display files. | |
2268 | Defaults to | |
2269 | .Xr more 1 | |
2270 | if empty or not set. | |
2271 | .It Ev SHELL | |
2272 | For default shell. | |
2273 | .It Ev ftp_proxy | |
2274 | URL of | |
2275 | .Tn FTP | |
2276 | proxy to use when making | |
2277 | .Tn FTP | |
2278 | URL requests | |
2279 | (if not defined, use the standard | |
2280 | .Tn FTP | |
2281 | protocol). | |
2282 | .Pp | |
2283 | See | |
2284 | .Ev http_proxy | |
2285 | for further notes about proxy use. | |
2286 | .It Ev http_proxy | |
2287 | URL of | |
2288 | .Tn HTTP | |
2289 | proxy to use when making | |
2290 | .Tn HTTP | |
2291 | URL requests. | |
2292 | If proxy authentication is required and there is a username and | |
2293 | password in this URL, they will automatically be used in the first | |
2294 | attempt to authenticate to the proxy. | |
2295 | .Pp | |
2296 | If | |
2297 | .Dq unsafe | |
2298 | URL characters are required in the username or password | |
2299 | (for example | |
2300 | .Sq @ | |
2301 | or | |
2302 | .Sq / ) , | |
2303 | encode them with | |
20e59a13 | 2304 | .Li RFC 3986 |
eedc536d PA |
2305 | .Sq Li \&% Ns Ar XX |
2306 | encoding. | |
2307 | .Pp | |
2308 | Note that the use of a username and password in | |
2309 | .Ev ftp_proxy | |
2310 | and | |
2311 | .Ev http_proxy | |
2312 | may be incompatible with other programs that use it | |
2313 | (such as | |
2314 | .Xr lynx 1 ) . | |
2315 | .Pp | |
2316 | .Em NOTE : | |
2317 | this is not used for interactive sessions, only for command-line | |
2318 | fetches. | |
2319 | .It Ev no_proxy | |
2320 | A space or comma separated list of hosts (or domains) for which | |
2321 | proxying is not to be used. | |
2322 | Each entry may have an optional trailing ":port", which restricts | |
2323 | the matching to connections to that port. | |
2324 | .El | |
2325 | .Sh EXTENDED PASSIVE MODE AND FIREWALLS | |
2326 | Some firewall configurations do not allow | |
2327 | .Nm | |
2328 | to use extended passive mode. | |
2329 | If you find that even a simple | |
2330 | .Ic ls | |
2331 | appears to hang after printing a message such as this: | |
2332 | .Pp | |
2333 | .Dl 229 Entering Extended Passive Mode (|||58551|) | |
2334 | .Pp | |
2335 | then you will need to disable extended passive mode with | |
2336 | .Ic epsv4 off . | |
2337 | See the above section | |
2338 | .Sx The .netrc File | |
2339 | for an example of how to make this automatic. | |
2340 | .Sh SEE ALSO | |
2341 | .Xr getservbyname 3 , | |
2342 | .Xr editrc 5 , | |
2343 | .Xr services 5 , | |
2344 | .Xr ftpd 8 | |
2345 | .Sh STANDARDS | |
2346 | .Nm | |
c106ca54 PA |
2347 | attempts to be compliant with: |
2348 | .Bl -tag -offset indent -width 8n | |
20e59a13 | 2349 | .It Li RFC 959 |
c106ca54 | 2350 | .Em File Transfer Protocol |
20e59a13 | 2351 | .It Li RFC 1123 |
c106ca54 | 2352 | .Em Requirements for Internet Hosts - Application and Support |
20e59a13 | 2353 | .It Li RFC 1635 |
c106ca54 | 2354 | .Em How to Use Anonymous FTP |
20e59a13 | 2355 | .It Li RFC 2389 |
c106ca54 | 2356 | .Em Feature negotiation mechanism for the File Transfer Protocol |
20e59a13 | 2357 | .It Li RFC 2428 |
c106ca54 | 2358 | .Em FTP Extensions for IPv6 and NATs |
20e59a13 | 2359 | .It Li RFC 2616 |
c106ca54 | 2360 | .Em Hypertext Transfer Protocol -- HTTP/1.1 |
20e59a13 | 2361 | .It Li RFC 2822 |
c106ca54 | 2362 | .Em Internet Message Format |
20e59a13 | 2363 | .It Li RFC 3659 |
c106ca54 | 2364 | .Em Extensions to FTP |
20e59a13 | 2365 | .It Li RFC 3986 |
c106ca54 PA |
2366 | .Em Uniform Resource Identifier (URI) |
2367 | .El | |
eedc536d PA |
2368 | .Sh HISTORY |
2369 | The | |
2370 | .Nm | |
2371 | command appeared in | |
2372 | .Bx 4.2 . | |
2373 | .Pp | |
2374 | Various features such as command line editing, context sensitive | |
2375 | command and file completion, dynamic progress bar, automatic | |
2376 | fetching of files and URLs, modification time preservation, | |
2377 | transfer rate throttling, configurable command line prompt, | |
2378 | and other enhancements over the standard | |
2379 | .Bx | |
2380 | .Nm | |
2381 | were implemented in | |
2382 | .Nx 1.3 | |
2383 | and later releases | |
2384 | by | |
2385 | .An Luke Mewburn | |
2386 | .Aq lukem@NetBSD.org . | |
2387 | .Pp | |
2388 | IPv6 support was added by the WIDE/KAME project | |
2389 | (but may not be present in all non-NetBSD versions of this program, depending | |
2390 | if the operating system supports IPv6 in a similar manner to KAME). | |
2391 | .Sh BUGS | |
2392 | Correct execution of many commands depends upon proper behavior | |
2393 | by the remote server. | |
2394 | .Pp | |
2395 | An error in the treatment of carriage returns | |
2396 | in the | |
2397 | .Bx 4.2 | |
2398 | ascii-mode transfer code | |
2399 | has been corrected. | |
2400 | This correction may result in incorrect transfers of binary files | |
2401 | to and from | |
2402 | .Bx 4.2 | |
2403 | servers using the ascii type. | |
2404 | Avoid this problem by using the binary image type. | |
2405 | .Pp | |
2406 | .Nm | |
2407 | assumes that all IPv4 mapped addresses | |
2408 | .Po | |
2409 | IPv6 addresses with a form like | |
2410 | .Li ::ffff:10.1.1.1 | |
2411 | .Pc | |
2412 | indicate IPv4 destinations which can be handled by | |
2413 | .Dv AF_INET | |
2414 | sockets. | |
2415 | However, in certain IPv6 network configurations, this assumption is not true. | |
2416 | In such an environment, IPv4 mapped addresses must be passed to | |
2417 | .Dv AF_INET6 | |
2418 | sockets directly. | |
2419 | For example, if your site uses a SIIT translator for IPv6-to-IPv4 translation, | |
2420 | .Nm | |
2421 | is unable to support your configuration. |