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