Commit | Line | Data |
---|---|---|
7b089094 WJ |
1 | .\" Copyright (c) 1985, 1989, 1990 The Regents of the University of California. |
2 | .\" All rights reserved. | |
3 | .\" | |
4 | .\" Redistribution and use in source and binary forms, with or without | |
5 | .\" modification, are permitted provided that the following conditions | |
6 | .\" are met: | |
7 | .\" 1. Redistributions of source code must retain the above copyright | |
8 | .\" notice, this list of conditions and the following disclaimer. | |
9 | .\" 2. Redistributions in binary form must reproduce the above copyright | |
10 | .\" notice, this list of conditions and the following disclaimer in the | |
11 | .\" documentation and/or other materials provided with the distribution. | |
12 | .\" 3. All advertising materials mentioning features or use of this software | |
13 | .\" must display the following acknowledgement: | |
14 | .\" This product includes software developed by the University of | |
15 | .\" California, Berkeley and its contributors. | |
16 | .\" 4. Neither the name of the University nor the names of its contributors | |
17 | .\" may be used to endorse or promote products derived from this software | |
18 | .\" without specific prior written permission. | |
19 | .\" | |
20 | .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
21 | .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
22 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
23 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
24 | .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
25 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
26 | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
27 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
28 | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
29 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
30 | .\" SUCH DAMAGE. | |
31 | .\" | |
32 | .\" @(#)ftp.1 6.18 (Berkeley) 7/30/91 | |
33 | .\" | |
34 | .Dd July 30, 1991 | |
35 | .Dt FTP 1 | |
36 | .Os BSD 4.2 | |
37 | .Sh NAME | |
38 | .Nm ftp | |
39 | .Nd | |
40 | .Tn ARPANET | |
41 | file transfer program | |
42 | .Sh SYNOPSIS | |
43 | .Nm ftp | |
44 | .Op Fl v | |
45 | .Op Fl d | |
46 | .Op Fl i | |
47 | .Op Fl n | |
48 | .Op Fl g | |
49 | .Op Ar host | |
50 | .Sh DESCRIPTION | |
51 | .Nm Ftp | |
52 | is the user interface to the | |
53 | .Tn ARPANET | |
54 | standard File Transfer Protocol. | |
55 | The program allows a user to transfer files to and from a | |
56 | remote network site. | |
57 | .Pp | |
58 | Options may be specified at the command line, or to the | |
59 | command interpreter. | |
60 | .Bl -tag -width flag | |
61 | .It Fl v | |
62 | Verbose option forces | |
63 | .Nm ftp | |
64 | to show all responses from the remote server, as well | |
65 | as report on data transfer statistics. | |
66 | .It Fl n | |
67 | Restrains | |
68 | .Nm ftp | |
69 | from attempting \*(Lqauto-login\*(Rq upon initial connection. | |
70 | If auto-login is enabled, | |
71 | .Nm ftp | |
72 | will check the | |
73 | .Pa .netrc | |
74 | (see below) file in the user's home directory for an entry describing | |
75 | an account on the remote machine. | |
76 | If no entry exists, | |
77 | .Nm ftp | |
78 | will prompt for the remote machine login name (default is the user | |
79 | identity on the local machine), and, if necessary, prompt for a password | |
80 | and an account with which to login. | |
81 | .It Fl i | |
82 | Turns off interactive prompting during | |
83 | multiple file transfers. | |
84 | .It Fl d | |
85 | Enables debugging. | |
86 | .It Fl g | |
87 | Disables file name globbing. | |
88 | .El | |
89 | .Pp | |
90 | The client host with which | |
91 | .Nm ftp | |
92 | is to communicate may be specified on the command line. | |
93 | If this is done, | |
94 | .Nm ftp | |
95 | will immediately attempt to establish a connection to an | |
96 | .Tn FTP | |
97 | server on that host; otherwise, | |
98 | .Nm ftp | |
99 | will enter its command interpreter and await instructions | |
100 | from the user. | |
101 | When | |
102 | .Nm ftp | |
103 | is awaiting commands from the user the prompt | |
104 | .Ql ftp> | |
105 | is provided to the user. | |
106 | The following commands are recognized | |
107 | by | |
108 | .Nm ftp : | |
109 | .Bl -tag -width Fl | |
110 | .It Ic \&! Op Ar command Op Ar args | |
111 | Invoke an interactive shell on the local machine. | |
112 | If there are arguments, the first is taken to be a command to execute | |
113 | directly, with the rest of the arguments as its arguments. | |
114 | .It Ic \&$ Ar macro-name Op Ar args | |
115 | Execute the macro | |
116 | .Ar macro-name | |
117 | that was defined with the | |
118 | .Ic macdef | |
119 | command. | |
120 | Arguments are passed to the macro unglobbed. | |
121 | .It Ic account Op Ar passwd | |
122 | Supply a supplemental password required by a remote system for access | |
123 | to resources once a login has been successfully completed. | |
124 | If no argument is included, the user will be prompted for an account | |
125 | password in a non-echoing input mode. | |
126 | .It Ic append Ar local-file Op Ar remote-file | |
127 | Append a local file to a file on the remote machine. | |
128 | If | |
129 | .Ar remote-file | |
130 | is left unspecified, the local file name is used in naming the | |
131 | remote file after being altered by any | |
132 | .Ic ntrans | |
133 | or | |
134 | .Ic nmap | |
135 | setting. | |
136 | File transfer uses the current settings for | |
137 | .Ic type , | |
138 | .Ic format , | |
139 | .Ic mode , | |
140 | and | |
141 | .Ic structure . | |
142 | .It Ic ascii | |
143 | Set the file transfer | |
144 | .Ic type | |
145 | to network | |
146 | .Tn ASCII . | |
147 | This is the default type. | |
148 | .It Ic bell | |
149 | Arrange that a bell be sounded after each file transfer | |
150 | command is completed. | |
151 | .It Ic binary | |
152 | Set the file transfer | |
153 | .Ic type | |
154 | to support binary image transfer. | |
155 | .It Ic bye | |
156 | Terminate the | |
157 | .Tn FTP | |
158 | session with the remote server | |
159 | and exit | |
160 | .Nm ftp . | |
161 | An end of file will also terminate the session and exit. | |
162 | .It Ic case | |
163 | Toggle remote computer file name case mapping during | |
164 | .Ic mget | |
165 | commands. | |
166 | When | |
167 | .Ic case | |
168 | is on (default is off), remote computer file names with all letters in | |
169 | upper case are written in the local directory with the letters mapped | |
170 | to lower case. | |
171 | .It Ic \&cd Ar remote-directory | |
172 | Change the working directory on the remote machine | |
173 | to | |
174 | .Ar remote-directory . | |
175 | .It Ic cdup | |
176 | Change the remote machine working directory to the parent of the | |
177 | current remote machine working directory. | |
178 | .It Ic chmod Ar mode file-name | |
179 | Change the permission modes of the file | |
180 | .Ar file-name | |
181 | on the remote | |
182 | sytem to | |
183 | .Ar mode . | |
184 | .It Ic close | |
185 | Terminate the | |
186 | .Tn FTP | |
187 | session with the remote server, and | |
188 | return to the command interpreter. | |
189 | Any defined macros are erased. | |
190 | .It Ic \&cr | |
191 | Toggle carriage return stripping during | |
192 | ascii type file retrieval. | |
193 | Records are denoted by a carriage return/linefeed sequence | |
194 | during ascii type file transfer. | |
195 | When | |
196 | .Ic \&cr | |
197 | is on (the default), carriage returns are stripped from this | |
198 | sequence to conform with the | |
199 | .Ux | |
200 | single linefeed record | |
201 | delimiter. | |
202 | Records on | |
203 | .Pf non\- Ns Ux | |
204 | remote systems may contain single linefeeds; | |
205 | when an ascii type transfer is made, these linefeeds may be | |
206 | distinguished from a record delimiter only when | |
207 | .Ic \&cr | |
208 | is off. | |
209 | .It Ic delete Ar remote-file | |
210 | Delete the file | |
211 | .Ar remote-file | |
212 | on the remote machine. | |
213 | .It Ic debug Op Ar debug-value | |
214 | Toggle debugging mode. | |
215 | If an optional | |
216 | .Ar debug-value | |
217 | is specified it is used to set the debugging level. | |
218 | When debugging is on, | |
219 | .Nm ftp | |
220 | prints each command sent to the remote machine, preceded | |
221 | by the string | |
222 | .Ql \-\-> | |
223 | .It Xo | |
224 | .Ic dir | |
225 | .Op Ar remote-directory | |
226 | .Op Ar local-file | |
227 | .Xc | |
228 | Print a listing of the directory contents in the | |
229 | directory, | |
230 | .Ar remote-directory , | |
231 | and, optionally, placing the output in | |
232 | .Ar local-file . | |
233 | If interactive prompting is on, | |
234 | .Nm ftp | |
235 | will prompt the user to verify that the last argument is indeed the | |
236 | target local file for receiving | |
237 | .Ic dir | |
238 | output. | |
239 | If no directory is specified, the current working | |
240 | directory on the remote machine is used. | |
241 | If no local | |
242 | file is specified, or | |
243 | .Ar local-file | |
244 | is | |
245 | .Fl , | |
246 | output comes to the terminal. | |
247 | .It Ic disconnect | |
248 | A synonym for | |
249 | .Ar close . | |
250 | .It Ic form Ar format | |
251 | Set the file transfer | |
252 | .Ic form | |
253 | to | |
254 | .Ar format . | |
255 | The default format is \*(Lqfile\*(Rq. | |
256 | .It Ic get Ar remote-file Op Ar local-file | |
257 | Retrieve the | |
258 | .Ar remote-file | |
259 | and store it on the local machine. | |
260 | If the local | |
261 | file name is not specified, it is given the same | |
262 | name it has on the remote machine, subject to | |
263 | alteration by the current | |
264 | .Ic case , | |
265 | .Ic ntrans , | |
266 | and | |
267 | .Ic nmap | |
268 | settings. | |
269 | The current settings for | |
270 | .Ic type , | |
271 | .Ic form , | |
272 | .Ic mode , | |
273 | and | |
274 | .Ic structure | |
275 | are used while transferring the file. | |
276 | .It Ic glob | |
277 | Toggle filename expansion for | |
278 | .Ic mdelete , | |
279 | .Ic mget | |
280 | and | |
281 | .Ic mput . | |
282 | If globbing is turned off with | |
283 | .Ic glob , | |
284 | the file name arguments | |
285 | are taken literally and not expanded. | |
286 | Globbing for | |
287 | .Ic mput | |
288 | is done as in | |
289 | .Xr csh 1 . | |
290 | For | |
291 | .Ic mdelete | |
292 | and | |
293 | .Ic mget , | |
294 | each remote file name is expanded | |
295 | separately on the remote machine and the lists are not merged. | |
296 | Expansion of a directory name is likely to be | |
297 | different from expansion of the name of an ordinary file: | |
298 | the exact result depends on the foreign operating system and ftp server, | |
299 | and can be previewed by doing | |
300 | .Ql mls remote-files \- | |
301 | Note: | |
302 | .Ic mget | |
303 | and | |
304 | .Ic mput | |
305 | are not meant to transfer | |
306 | entire directory subtrees of files. | |
307 | That can be done by | |
308 | transferring a | |
309 | .Xr tar 1 | |
310 | archive of the subtree (in binary mode). | |
311 | .It Ic hash | |
312 | Toggle hash-sign (``#'') printing for each data block | |
313 | transferred. | |
314 | The size of a data block is 1024 bytes. | |
315 | .It Ic help Op Ar command | |
316 | Print an informative message about the meaning of | |
317 | .Ar command . | |
318 | If no argument is given, | |
319 | .Nm ftp | |
320 | prints a list of the known commands. | |
321 | .It Ic idle Op Ar seconds | |
322 | Set the inactivity timer on the remote server to | |
323 | .Ar seconds | |
324 | seconds. | |
325 | If | |
326 | .Ar seconds | |
327 | is ommitted, the current inactivity timer is printed. | |
328 | .It Ic lcd Op Ar directory | |
329 | Change the working directory on the local machine. | |
330 | If | |
331 | no | |
332 | .Ar directory | |
333 | is specified, the user's home directory is used. | |
334 | .It Xo | |
335 | .Ic \&ls | |
336 | .Op Ar remote-directory | |
337 | .Op Ar local-file | |
338 | .Xc | |
339 | Print a listing of the contents of a | |
340 | directory on the remote machine. | |
341 | The listing includes any system-dependent information that the server | |
342 | chooses to include; for example, most | |
343 | .Ux | |
344 | systems will produce | |
345 | output from the command | |
346 | .Ql ls \-l . | |
347 | (See also | |
348 | .Ic nlist . ) | |
349 | If | |
350 | .Ar remote-directory | |
351 | is left unspecified, the current working directory is used. | |
352 | If interactive prompting is on, | |
353 | .Nm ftp | |
354 | will prompt the user to verify that the last argument is indeed the | |
355 | target local file for receiving | |
356 | .Ic \&ls | |
357 | output. | |
358 | If no local file is specified, or if | |
359 | .Ar local-file | |
360 | is | |
361 | .Sq Fl , | |
362 | the output is sent to the terminal. | |
363 | .It Ic macdefNs Ar macro-name | |
364 | Define a macro. | |
365 | Subsequent lines are stored as the macro | |
366 | .Ar macro-name ; | |
367 | a null line (consecutive newline characters | |
368 | in a file or | |
369 | carriage returns from the terminal) terminates macro input mode. | |
370 | There is a limit of 16 macros and 4096 total characters in all | |
371 | defined macros. | |
372 | Macros remain defined until a | |
373 | .Ic close | |
374 | command is executed. | |
375 | The macro processor interprets `$' and `\e' as special characters. | |
376 | A `$' followed by a number (or numbers) is replaced by the | |
377 | corresponding argument on the macro invocation command line. | |
378 | A `$' followed by an `i' signals that macro processor that the | |
379 | executing macro is to be looped. | |
380 | On the first pass `$i' is | |
381 | replaced by the first argument on the macro invocation command line, | |
382 | on the second pass it is replaced by the second argument, and so on. | |
383 | A `\e' followed by any character is replaced by that character. | |
384 | Use the `\e' to prevent special treatment of the `$'. | |
385 | .It Ic mdelete Op Ar remote-files | |
386 | Delete the | |
387 | .Ar remote-files | |
388 | on the remote machine. | |
389 | .It Ic mdir Ar remote-files local-file | |
390 | Like | |
391 | .Ic dir , | |
392 | except multiple remote files may be specified. | |
393 | If interactive prompting is on, | |
394 | .Nm ftp | |
395 | will prompt the user to verify that the last argument is indeed the | |
396 | target local file for receiving | |
397 | .Ic mdir | |
398 | output. | |
399 | .It Ic mget Ar remote-files | |
400 | Expand the | |
401 | .Ar remote-files | |
402 | on the remote machine | |
403 | and do a | |
404 | .Ic get | |
405 | for each file name thus produced. | |
406 | See | |
407 | .Ic glob | |
408 | for details on the filename expansion. | |
409 | Resulting file names will then be processed according to | |
410 | .Ic case , | |
411 | .Ic ntrans , | |
412 | and | |
413 | .Ic nmap | |
414 | settings. | |
415 | Files are transferred into the local working directory, | |
416 | which can be changed with | |
417 | .Ql lcd directory ; | |
418 | new local directories can be created with | |
419 | .Ql "\&! mkdir directory" . | |
420 | .It Ic mkdir Ar directory-name | |
421 | Make a directory on the remote machine. | |
422 | .It Ic mls Ar remote-files local-file | |
423 | Like | |
424 | .Ic nlist , | |
425 | except multiple remote files may be specified, | |
426 | and the | |
427 | .Ar local-file | |
428 | must be specified. | |
429 | If interactive prompting is on, | |
430 | .Nm ftp | |
431 | will prompt the user to verify that the last argument is indeed the | |
432 | target local file for receiving | |
433 | .Ic mls | |
434 | output. | |
435 | .It Ic mode Op Ar mode-name | |
436 | Set the file transfer | |
437 | .Ic mode | |
438 | to | |
439 | .Ar mode-name . | |
440 | The default mode is \*(Lqstream\*(Rq mode. | |
441 | .It Ic modtime Ar file-name | |
442 | Show the last modification time of the file on the remote machine. | |
443 | .It Ic mput Ar local-files | |
444 | Expand wild cards in the list of local files given as arguments | |
445 | and do a | |
446 | .Ic put | |
447 | for each file in the resulting list. | |
448 | See | |
449 | .Ic glob | |
450 | for details of filename expansion. | |
451 | Resulting file names will then be processed according to | |
452 | .Ic ntrans | |
453 | and | |
454 | .Ic nmap | |
455 | settings. | |
456 | .It Ic newer Ar file-name | |
457 | Get the file only if the modification time of the remote file is more | |
458 | recent that the file on the current system. | |
459 | If the file does not | |
460 | exist on the current system, the remote file is considered | |
461 | .Ic newer . | |
462 | Otherwise, this command is identical to | |
463 | .Ar get . | |
464 | .It Xo | |
465 | .Ic nlist | |
466 | .Op Ar remote-directory | |
467 | .Op Ar local-file | |
468 | .Xc | |
469 | Print a list of the files in a | |
470 | directory on the remote machine. | |
471 | If | |
472 | .Ar remote-directory | |
473 | is left unspecified, the current working directory is used. | |
474 | If interactive prompting is on, | |
475 | .Nm ftp | |
476 | will prompt the user to verify that the last argument is indeed the | |
477 | target local file for receiving | |
478 | .Ic nlist | |
479 | output. | |
480 | If no local file is specified, or if | |
481 | .Ar local-file | |
482 | is | |
483 | .Fl , | |
484 | the output is sent to the terminal. | |
485 | .It Ic nmap Op Ar inpattern outpattern | |
486 | Set or unset the filename mapping mechanism. | |
487 | If no arguments are specified, the filename mapping mechanism is unset. | |
488 | If arguments are specified, remote filenames are mapped during | |
489 | .Ic mput | |
490 | commands and | |
491 | .Ic put | |
492 | commands issued without a specified remote target filename. | |
493 | If arguments are specified, local filenames are mapped during | |
494 | .Ic mget | |
495 | commands and | |
496 | .Ic get | |
497 | commands issued without a specified local target filename. | |
498 | This command is useful when connecting to a | |
499 | .No non\- Ns Ux | |
500 | remote computer | |
501 | with different file naming conventions or practices. | |
502 | The mapping follows the pattern set by | |
503 | .Ar inpattern | |
504 | and | |
505 | .Ar outpattern . | |
506 | .Op Ar Inpattern | |
507 | is a template for incoming filenames (which may have already been | |
508 | processed according to the | |
509 | .Ic ntrans | |
510 | and | |
511 | .Ic case | |
512 | settings). | |
513 | Variable templating is accomplished by including the | |
514 | sequences `$1', `$2', ..., `$9' in | |
515 | .Ar inpattern . | |
516 | Use `\\' to prevent this special treatment of the `$' character. | |
517 | All other characters are treated literally, and are used to determine the | |
518 | .Ic nmap | |
519 | .Op Ar inpattern | |
520 | variable values. | |
521 | For example, given | |
522 | .Ar inpattern | |
523 | $1.$2 and the remote file name "mydata.data", $1 would have the value | |
524 | "mydata", and $2 would have the value "data". | |
525 | The | |
526 | .Ar outpattern | |
527 | determines the resulting mapped filename. | |
528 | The sequences `$1', `$2', ...., `$9' are replaced by any value resulting | |
529 | from the | |
530 | .Ar inpattern | |
531 | template. | |
532 | The sequence `$0' is replace by the original filename. | |
533 | Additionally, the sequence | |
534 | .Ql Op Ar seq1 , Ar seq2 | |
535 | is replaced by | |
536 | .Op Ar seq1 | |
537 | if | |
538 | .Ar seq1 | |
539 | is not a null string; otherwise it is replaced by | |
540 | .Ar seq2 . | |
541 | For example, the command | |
542 | .Pp | |
543 | .Bd -literal -offset indent -compact | |
544 | nmap $1.$2.$3 [$1,$2].[$2,file] | |
545 | .Ed | |
546 | .Pp | |
547 | would yield | |
548 | the output filename "myfile.data" for input filenames "myfile.data" and | |
549 | "myfile.data.old", "myfile.file" for the input filename "myfile", and | |
550 | "myfile.myfile" for the input filename ".myfile". | |
551 | Spaces may be included in | |
552 | .Ar outpattern , | |
553 | as in the example: `nmap $1 sed "s/ *$//" > $1' . | |
554 | Use the `\e' character to prevent special treatment | |
555 | of the `$','[','[', and `,' characters. | |
556 | .It Ic ntrans Op Ar inchars Op Ar outchars | |
557 | Set or unset the filename character translation mechanism. | |
558 | If no arguments are specified, the filename character | |
559 | translation mechanism is unset. | |
560 | If arguments are specified, characters in | |
561 | remote filenames are translated during | |
562 | .Ic mput | |
563 | commands and | |
564 | .Ic put | |
565 | commands issued without a specified remote target filename. | |
566 | If arguments are specified, characters in | |
567 | local filenames are translated during | |
568 | .Ic mget | |
569 | commands and | |
570 | .Ic get | |
571 | commands issued without a specified local target filename. | |
572 | This command is useful when connecting to a | |
573 | .No non\- Ns Ux | |
574 | remote computer | |
575 | with different file naming conventions or practices. | |
576 | Characters in a filename matching a character in | |
577 | .Ar inchars | |
578 | are replaced with the corresponding character in | |
579 | .Ar outchars . | |
580 | If the character's position in | |
581 | .Ar inchars | |
582 | is longer than the length of | |
583 | .Ar outchars , | |
584 | the character is deleted from the file name. | |
585 | .It Ic open Ar host Op Ar port | |
586 | Establish a connection to the specified | |
587 | .Ar host | |
588 | .Tn FTP | |
589 | server. | |
590 | An optional port number may be supplied, | |
591 | in which case, | |
592 | .Nm ftp | |
593 | will attempt to contact an | |
594 | .Tn FTP | |
595 | server at that port. | |
596 | If the | |
597 | .Ic auto-login | |
598 | option is on (default), | |
599 | .Nm ftp | |
600 | will also attempt to automatically log the user in to | |
601 | the | |
602 | .Tn FTP | |
603 | server (see below). | |
604 | .It Ic prompt | |
605 | Toggle interactive prompting. | |
606 | Interactive prompting | |
607 | occurs during multiple file transfers to allow the | |
608 | user to selectively retrieve or store files. | |
609 | If prompting is turned off (default is on), any | |
610 | .Ic mget | |
611 | or | |
612 | .Ic mput | |
613 | will transfer all files, and any | |
614 | .Ic mdelete | |
615 | will delete all files. | |
616 | .It Ic proxy Ar ftp-command | |
617 | Execute an ftp command on a secondary control connection. | |
618 | This command allows simultaneous connection to two remote ftp | |
619 | servers for transferring files between the two servers. | |
620 | The first | |
621 | .Ic proxy | |
622 | command should be an | |
623 | .Ic open , | |
624 | to establish the secondary control connection. | |
625 | Enter the command "proxy ?" to see other ftp commands executable on the | |
626 | secondary connection. | |
627 | The following commands behave differently when prefaced by | |
628 | .Ic proxy : | |
629 | .Ic open | |
630 | will not define new macros during the auto-login process, | |
631 | .Ic close | |
632 | will not erase existing macro definitions, | |
633 | .Ic get | |
634 | and | |
635 | .Ic mget | |
636 | transfer files from the host on the primary control connection | |
637 | to the host on the secondary control connection, and | |
638 | .Ic put , | |
639 | .Ic mput , | |
640 | and | |
641 | .Ic append | |
642 | transfer files from the host on the secondary control connection | |
643 | to the host on the primary control connection. | |
644 | Third party file transfers depend upon support of the ftp protocol | |
645 | .Dv PASV | |
646 | command by the server on the secondary control connection. | |
647 | .It Ic put Ar local-file Op Ar remote-file | |
648 | Store a local file on the remote machine. | |
649 | If | |
650 | .Ar remote-file | |
651 | is left unspecified, the local file name is used | |
652 | after processing according to any | |
653 | .Ic ntrans | |
654 | or | |
655 | .Ic nmap | |
656 | settings | |
657 | in naming the remote file. | |
658 | File transfer uses the | |
659 | current settings for | |
660 | .Ic type , | |
661 | .Ic format , | |
662 | .Ic mode , | |
663 | and | |
664 | .Ic structure . | |
665 | .It Ic pwd | |
666 | Print the name of the current working directory on the remote | |
667 | machine. | |
668 | .It Ic quit | |
669 | A synonym for | |
670 | .Ic bye . | |
671 | .It Ic quote Ar arg1 arg2 ... | |
672 | The arguments specified are sent, verbatim, to the remote | |
673 | .Tn FTP | |
674 | server. | |
675 | .It Ic recv Ar remote-file Op Ar local-file | |
676 | A synonym for get. | |
677 | .It Ic reget Ar remote-file Op Ar local-file | |
678 | Reget acts like get, except that if | |
679 | .Ar local-file | |
680 | exists and is | |
681 | smaller than | |
682 | .Ar remote-file , | |
683 | .Ar local-file | |
684 | is presumed to be | |
685 | a partially transferred copy of | |
686 | .Ar remote-file | |
687 | and the transfer | |
688 | is continued from the apparent point of failure. | |
689 | This command | |
690 | is useful when transferring very large files over networks that | |
691 | are prone to dropping connections. | |
692 | .It Ic remotehelp Op Ar command-name | |
693 | Request help from the remote | |
694 | .Tn FTP | |
695 | server. | |
696 | If a | |
697 | .Ar command-name | |
698 | is specified it is supplied to the server as well. | |
699 | .It Ic remotestatus Op Ar file-name | |
700 | With no arguments, show status of remote machine. | |
701 | If | |
702 | .Ar file-name | |
703 | is specified, show status of | |
704 | .Ar file-name | |
705 | on remote machine. | |
706 | .It Xo | |
707 | .Ic rename | |
708 | .Op Ar from | |
709 | .Op Ar to | |
710 | .Xc | |
711 | Rename the file | |
712 | .Ar from | |
713 | on the remote machine, to the file | |
714 | .Ar to . | |
715 | .It Ic reset | |
716 | Clear reply queue. | |
717 | This command re-synchronizes command/reply sequencing with the remote | |
718 | ftp server. | |
719 | Resynchronization may be necessary following a violation of the ftp protocol | |
720 | by the remote server. | |
721 | .It Ic restart Ar marker | |
722 | Restart the immediately following | |
723 | .Ic get | |
724 | or | |
725 | .Ic put | |
726 | at the | |
727 | indicated | |
728 | .Ar marker . | |
729 | On | |
730 | .Ux | |
731 | systems, marker is usually a byte | |
732 | offset into the file. | |
733 | .It Ic rmdir Ar directory-name | |
734 | Delete a directory on the remote machine. | |
735 | .It Ic runique | |
736 | Toggle storing of files on the local system with unique filenames. | |
737 | If a file already exists with a name equal to the target | |
738 | local filename for a | |
739 | .Ic get | |
740 | or | |
741 | .Ic mget | |
742 | command, a ".1" is appended to the name. | |
743 | If the resulting name matches another existing file, | |
744 | a ".2" is appended to the original name. | |
745 | If this process continues up to ".99", an error | |
746 | message is printed, and the transfer does not take place. | |
747 | The generated unique filename will be reported. | |
748 | Note that | |
749 | .Ic runique | |
750 | will not affect local files generated from a shell command | |
751 | (see below). | |
752 | The default value is off. | |
753 | .It Ic send Ar local-file Op Ar remote-file | |
754 | A synonym for put. | |
755 | .It Ic sendport | |
756 | Toggle the use of | |
757 | .Dv PORT | |
758 | commands. | |
759 | By default, | |
760 | .Nm ftp | |
761 | will attempt to use a | |
762 | .Dv PORT | |
763 | command when establishing | |
764 | a connection for each data transfer. | |
765 | The use of | |
766 | .Dv PORT | |
767 | commands can prevent delays | |
768 | when performing multiple file transfers. | |
769 | If the | |
770 | .Dv PORT | |
771 | command fails, | |
772 | .Nm ftp | |
773 | will use the default data port. | |
774 | When the use of | |
775 | .Dv PORT | |
776 | commands is disabled, no attempt will be made to use | |
777 | .Dv PORT | |
778 | commands for each data transfer. | |
779 | This is useful | |
780 | for certain | |
781 | .Tn FTP | |
782 | implementations which do ignore | |
783 | .Dv PORT | |
784 | commands but, incorrectly, indicate they've been accepted. | |
785 | .It Ic site Ar arg1 arg2 ... | |
786 | The arguments specified are sent, verbatim, to the remote | |
787 | .Tn FTP | |
788 | server as a | |
789 | .Dv SITE | |
790 | command. | |
791 | .It Ic size Ar file-name | |
792 | Return size of | |
793 | .Ar file-name | |
794 | on remote machine. | |
795 | .It Ic status | |
796 | Show the current status of | |
797 | .Nm ftp . | |
798 | .It Ic struct Op Ar struct-name | |
799 | Set the file transfer | |
800 | .Ar structure | |
801 | to | |
802 | .Ar struct-name . | |
803 | By default \*(Lqstream\*(Rq structure is used. | |
804 | .It Ic sunique | |
805 | Toggle storing of files on remote machine under unique file names. | |
806 | Remote ftp server must support ftp protocol | |
807 | .Dv STOU | |
808 | command for | |
809 | successful completion. | |
810 | The remote server will report unique name. | |
811 | Default value is off. | |
812 | .It Ic system | |
813 | Show the type of operating system running on the remote machine. | |
814 | .It Ic tenex | |
815 | Set the file transfer type to that needed to | |
816 | talk to | |
817 | .Tn TENEX | |
818 | machines. | |
819 | .It Ic trace | |
820 | Toggle packet tracing. | |
821 | .It Ic type Op Ar type-name | |
822 | Set the file transfer | |
823 | .Ic type | |
824 | to | |
825 | .Ar type-name . | |
826 | If no type is specified, the current type | |
827 | is printed. | |
828 | The default type is network | |
829 | .Tn ASCII . | |
830 | .It Ic umask Op Ar newmask | |
831 | Set the default umask on the remote server to | |
832 | .Ar newmask . | |
833 | If | |
834 | .Ar newmask | |
835 | is ommitted, the current umask is printed. | |
836 | .It Xo | |
837 | .Ic user Ar user-name | |
838 | .Op Ar password | |
839 | .Op Ar account | |
840 | .Xc | |
841 | Identify yourself to the remote | |
842 | .Tn FTP | |
843 | server. | |
844 | If the | |
845 | .Ar password | |
846 | is not specified and the server requires it, | |
847 | .Nm ftp | |
848 | will prompt the user for it (after disabling local echo). | |
849 | If an | |
850 | .Ar account | |
851 | field is not specified, and the | |
852 | .Tn FTP | |
853 | server | |
854 | requires it, the user will be prompted for it. | |
855 | If an | |
856 | .Ar account | |
857 | field is specified, an account command will | |
858 | be relayed to the remote server after the login sequence | |
859 | is completed if the remote server did not require it | |
860 | for logging in. | |
861 | Unless | |
862 | .Nm ftp | |
863 | is invoked with \*(Lqauto-login\*(Rq disabled, this | |
864 | process is done automatically on initial connection to | |
865 | the | |
866 | .Tn FTP | |
867 | server. | |
868 | .It Ic verbose | |
869 | Toggle verbose mode. | |
870 | In verbose mode, all responses from | |
871 | the | |
872 | .Tn FTP | |
873 | server are displayed to the user. | |
874 | In addition, | |
875 | if verbose is on, when a file transfer completes, statistics | |
876 | regarding the efficiency of the transfer are reported. | |
877 | By default, | |
878 | verbose is on. | |
879 | .It Ic ? Op Ar command | |
880 | A synonym for help. | |
881 | .El | |
882 | .Pp | |
883 | Command arguments which have embedded spaces may be quoted with | |
884 | quote `"' marks. | |
885 | .Sh ABORTING A FILE TRANSFER | |
886 | To abort a file transfer, use the terminal interrupt key | |
887 | (usually Ctrl-C). | |
888 | Sending transfers will be immediately halted. | |
889 | Receiving transfers will be halted by sending a ftp protocol | |
890 | .Dv ABOR | |
891 | command to the remote server, and discarding any further data received. | |
892 | The speed at which this is accomplished depends upon the remote | |
893 | server's support for | |
894 | .Dv ABOR | |
895 | processing. | |
896 | If the remote server does not support the | |
897 | .Dv ABOR | |
898 | command, an | |
899 | .Ql ftp> | |
900 | prompt will not appear until the remote server has completed | |
901 | sending the requested file. | |
902 | .Pp | |
903 | The terminal interrupt key sequence will be ignored when | |
904 | .Nm ftp | |
905 | has completed any local processing and is awaiting a reply | |
906 | from the remote server. | |
907 | A long delay in this mode may result from the ABOR processing described | |
908 | above, or from unexpected behavior by the remote server, including | |
909 | violations of the ftp protocol. | |
910 | If the delay results from unexpected remote server behavior, the local | |
911 | .Nm ftp | |
912 | program must be killed by hand. | |
913 | .Sh FILE NAMING CONVENTIONS | |
914 | Files specified as arguments to | |
915 | .Nm ftp | |
916 | commands are processed according to the following rules. | |
917 | .Bl -enum | |
918 | .It | |
919 | If the file name | |
920 | .Sq Fl | |
921 | is specified, the | |
922 | .Ar stdin | |
923 | (for reading) or | |
924 | .Ar stdout | |
925 | (for writing) is used. | |
926 | .It | |
927 | If the first character of the file name is | |
928 | .Sq \&| , | |
929 | the | |
930 | remainder of the argument is interpreted as a shell command. | |
931 | .Nm Ftp | |
932 | then forks a shell, using | |
933 | .Xr popen 3 | |
934 | with the argument supplied, and reads (writes) from the stdout | |
935 | (stdin). | |
936 | If the shell command includes spaces, the argument | |
937 | must be quoted; e.g. | |
938 | \*(Lq" ls -lt"\*(Rq. | |
939 | A particularly | |
940 | useful example of this mechanism is: \*(Lqdir more\*(Rq. | |
941 | .It | |
942 | Failing the above checks, if ``globbing'' is enabled, | |
943 | local file names are expanded | |
944 | according to the rules used in the | |
945 | .Xr csh 1 ; | |
946 | c.f. the | |
947 | .Ic glob | |
948 | command. | |
949 | If the | |
950 | .Nm ftp | |
951 | command expects a single local file (.e.g. | |
952 | .Ic put ) , | |
953 | only the first filename generated by the "globbing" operation is used. | |
954 | .It | |
955 | For | |
956 | .Ic mget | |
957 | commands and | |
958 | .Ic get | |
959 | commands with unspecified local file names, the local filename is | |
960 | the remote filename, which may be altered by a | |
961 | .Ic case , | |
962 | .Ic ntrans , | |
963 | or | |
964 | .Ic nmap | |
965 | setting. | |
966 | The resulting filename may then be altered if | |
967 | .Ic runique | |
968 | is on. | |
969 | .It | |
970 | For | |
971 | .Ic mput | |
972 | commands and | |
973 | .Ic put | |
974 | commands with unspecified remote file names, the remote filename is | |
975 | the local filename, which may be altered by a | |
976 | .Ic ntrans | |
977 | or | |
978 | .Ic nmap | |
979 | setting. | |
980 | The resulting filename may then be altered by the remote server if | |
981 | .Ic sunique | |
982 | is on. | |
983 | .El | |
984 | .Sh FILE TRANSFER PARAMETERS | |
985 | The FTP specification specifies many parameters which may | |
986 | affect a file transfer. | |
987 | The | |
988 | .Ic type | |
989 | may be one of \*(Lqascii\*(Rq, \*(Lqimage\*(Rq (binary), | |
990 | \*(Lqebcdic\*(Rq, and \*(Lqlocal byte size\*(Rq (for | |
991 | .Tn PDP Ns -10's | |
992 | and | |
993 | .Tn PDP Ns -20's | |
994 | mostly). | |
995 | .Nm Ftp | |
996 | supports the ascii and image types of file transfer, | |
997 | plus local byte size 8 for | |
998 | .Ic tenex | |
999 | mode transfers. | |
1000 | .Pp | |
1001 | .Nm Ftp | |
1002 | supports only the default values for the remaining | |
1003 | file transfer parameters: | |
1004 | .Ic mode , | |
1005 | .Ic form , | |
1006 | and | |
1007 | .Ic struct . | |
1008 | .Sh THE .netrc FILE | |
1009 | The | |
1010 | .Pa .netrc | |
1011 | file contains login and initialization information | |
1012 | used by the auto-login process. | |
1013 | It resides in the user's home directory. | |
1014 | The following tokens are recognized; they may be separated by spaces, | |
1015 | tabs, or new-lines: | |
1016 | .Bl -tag -width password | |
1017 | .It Ic machine Ar name | |
1018 | Identify a remote machine | |
1019 | .Ar name . | |
1020 | The auto-login process searches the | |
1021 | .Pa .netrc | |
1022 | file for a | |
1023 | .Ic machine | |
1024 | token that matches the remote machine specified on the | |
1025 | .Nm ftp | |
1026 | command line or as an | |
1027 | .Ic open | |
1028 | command argument. | |
1029 | Once a match is made, the subsequent | |
1030 | .Pa .netrc | |
1031 | tokens are processed, | |
1032 | stopping when the end of file is reached or another | |
1033 | .Ic machine | |
1034 | or a | |
1035 | .Ic default | |
1036 | token is encountered. | |
1037 | .It Ic default | |
1038 | This is the same as | |
1039 | .Ic machine | |
1040 | .Ar name | |
1041 | except that | |
1042 | .Ic default | |
1043 | matches any name. | |
1044 | There can be only one | |
1045 | .Ic default | |
1046 | token, and it must be after all | |
1047 | .Ic machine | |
1048 | tokens. | |
1049 | This is normally used as: | |
1050 | .Pp | |
1051 | .Dl default login anonymous password user@site | |
1052 | .Pp | |
1053 | thereby giving the user | |
1054 | .Ar automatic | |
1055 | anonymous ftp login to | |
1056 | machines not specified in | |
1057 | .Pa .netrc . | |
1058 | This can be overridden | |
1059 | by using the | |
1060 | .Fl n | |
1061 | flag to disable auto-login. | |
1062 | .It Ic login Ar name | |
1063 | Identify a user on the remote machine. | |
1064 | If this token is present, the auto-login process will initiate | |
1065 | a login using the specified | |
1066 | .Ar name . | |
1067 | .It Ic password Ar string | |
1068 | Supply a password. | |
1069 | If this token is present, the auto-login process will supply the | |
1070 | specified string if the remote server requires a password as part | |
1071 | of the login process. | |
1072 | Note that if this token is present in the | |
1073 | .Pa .netrc | |
1074 | file for any user other | |
1075 | than | |
1076 | .Ar anonymous , | |
1077 | .Nm ftp | |
1078 | will abort the auto-login process if the | |
1079 | .Pa .netrc | |
1080 | is readable by | |
1081 | anyone besides the user. | |
1082 | .It Ic account Ar string | |
1083 | Supply an additional account password. | |
1084 | If this token is present, the auto-login process will supply the | |
1085 | specified string if the remote server requires an additional | |
1086 | account password, or the auto-login process will initiate an | |
1087 | .Dv ACCT | |
1088 | command if it does not. | |
1089 | .It Ic macdef Ar name | |
1090 | Define a macro. | |
1091 | This token functions like the | |
1092 | .Nm ftp | |
1093 | .Ic macdef | |
1094 | command functions. | |
1095 | A macro is defined with the specified name; its contents begin with the | |
1096 | next | |
1097 | .Pa .netrc | |
1098 | line and continue until a null line (consecutive new-line | |
1099 | characters) is encountered. | |
1100 | If a macro named | |
1101 | .Ic init | |
1102 | is defined, it is automatically executed as the last step in the | |
1103 | auto-login process. | |
1104 | .El | |
1105 | .Sh ENVIRONMENT | |
1106 | .Nm Ftp | |
1107 | utilizes the following environment variables. | |
1108 | .Bl -tag -width Fl | |
1109 | .It Ev HOME | |
1110 | For default location of a | |
1111 | .Pa .netrc | |
1112 | file, if one exists. | |
1113 | .It Ev SHELL | |
1114 | For default shell. | |
1115 | .El | |
1116 | .Sh SEE ALSO | |
1117 | .Xr ftpd 8 | |
1118 | .Sh HISTORY | |
1119 | The | |
1120 | .Nm ftp | |
1121 | command appeared in | |
1122 | .Bx 4.2 . | |
1123 | .Sh BUGS | |
1124 | Correct execution of many commands depends upon proper behavior | |
1125 | by the remote server. | |
1126 | .Pp | |
1127 | An error in the treatment of carriage returns | |
1128 | in the | |
1129 | .Bx 4.2 | |
1130 | ascii-mode transfer code | |
1131 | has been corrected. | |
1132 | This correction may result in incorrect transfers of binary files | |
1133 | to and from | |
1134 | .Bx 4.2 | |
1135 | servers using the ascii type. | |
1136 | Avoid this problem by using the binary image type. |