openbsd_man_ftp.html (83176B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="UTF-8"/> 5 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 6 <link rel="stylesheet" href="/mandoc.css" type="text/css" media="all"> 7 <title>ftp(1) - OpenBSD manual pages</title> 8 </head> 9 <body> 10 <header> 11 <section> 12 <h1><a href="https://www.openbsd.org/">OpenBSD</a> manual page server</h1> 13 </section> 14 <form role="search" action="/" method="get" autocomplete="off" autocapitalize="none"> 15 <fieldset> 16 <legend>Manual Page Search Parameters</legend> 17 <label>Search query: 18 <input type="search" name="query" value="ftp" size="40"> 19 </label> 20 <button type="submit" name="apropos" value="0">man</button> 21 <button type="submit" name="apropos" value="1">apropos</button> 22 <br/> 23 <select name="sec" aria-label="Manual section"> 24 <option value="0">All Sections</option> 25 <option value="1">1 - General Commands</option> 26 <option value="2">2 - System Calls</option> 27 <option value="3">3 - Library Functions</option> 28 <option value="3p">3p - Perl Library</option> 29 <option value="4">4 - Device Drivers</option> 30 <option value="5">5 - File Formats</option> 31 <option value="6">6 - Games</option> 32 <option value="7">7 - Miscellaneous Information</option> 33 <option value="8">8 - System Manager's Manual</option> 34 <option value="9">9 - Kernel Developer's Manual</option> 35 </select> 36 <select name="arch" aria-label="CPU architecture"> 37 <option value="default" selected="selected">All Architectures</option> 38 <option>amd64</option> 39 <option>alpha</option> 40 <option>armv7</option> 41 <option>arm64</option> 42 <option>hppa</option> 43 <option>i386</option> 44 <option>landisk</option> 45 <option>loongson</option> 46 <option>luna88k</option> 47 <option>macppc</option> 48 <option>mips64</option> 49 <option>octeon</option> 50 <option>powerpc64</option> 51 <option>riscv64</option> 52 <option>sparc64</option> 53 <option>amiga</option> 54 <option>arc</option> 55 <option>armish</option> 56 <option>arm32</option> 57 <option>atari</option> 58 <option>aviion</option> 59 <option>beagle</option> 60 <option>cats</option> 61 <option>hppa64</option> 62 <option>hp300</option> 63 <option>ia64</option> 64 <option>mac68k</option> 65 <option>mvme68k</option> 66 <option>mvme88k</option> 67 <option>mvmeppc</option> 68 <option>palm</option> 69 <option>pc532</option> 70 <option>pegasos</option> 71 <option>pmax</option> 72 <option>powerpc</option> 73 <option>sgi</option> 74 <option>socppc</option> 75 <option>solbourne</option> 76 <option>sparc</option> 77 <option>sun3</option> 78 <option>vax</option> 79 <option>wgrisc</option> 80 <option>x68k</option> 81 <option>zaurus</option> 82 </select> 83 <select name="manpath" aria-label="Manual path"> 84 <option selected="selected">OpenBSD-current</option> 85 <option>OpenBSD-7.2</option> 86 <option>OpenBSD-7.1</option> 87 <option>OpenBSD-7.0</option> 88 <option>OpenBSD-6.9</option> 89 <option>OpenBSD-6.8</option> 90 <option>OpenBSD-6.7</option> 91 <option>OpenBSD-6.6</option> 92 <option>OpenBSD-6.5</option> 93 <option>OpenBSD-6.4</option> 94 <option>OpenBSD-6.3</option> 95 <option>OpenBSD-6.2</option> 96 <option>OpenBSD-6.1</option> 97 <option>OpenBSD-6.0</option> 98 <option>OpenBSD-5.9</option> 99 <option>OpenBSD-5.8</option> 100 <option>OpenBSD-5.7</option> 101 <option>OpenBSD-5.6</option> 102 <option>OpenBSD-5.5</option> 103 <option>OpenBSD-5.4</option> 104 <option>OpenBSD-5.3</option> 105 <option>OpenBSD-5.2</option> 106 <option>OpenBSD-5.1</option> 107 <option>OpenBSD-5.0</option> 108 <option>OpenBSD-4.9</option> 109 <option>OpenBSD-4.8</option> 110 <option>OpenBSD-4.7</option> 111 <option>OpenBSD-4.6</option> 112 <option>OpenBSD-4.5</option> 113 <option>OpenBSD-4.4</option> 114 <option>OpenBSD-4.3</option> 115 <option>OpenBSD-4.2</option> 116 <option>OpenBSD-4.1</option> 117 <option>OpenBSD-4.0</option> 118 <option>OpenBSD-3.9</option> 119 <option>OpenBSD-3.8</option> 120 <option>OpenBSD-3.7</option> 121 <option>OpenBSD-3.6</option> 122 <option>OpenBSD-3.5</option> 123 <option>OpenBSD-3.4</option> 124 <option>OpenBSD-3.3</option> 125 <option>OpenBSD-3.2</option> 126 <option>OpenBSD-3.1</option> 127 <option>OpenBSD-3.0</option> 128 <option>OpenBSD-2.9</option> 129 <option>OpenBSD-2.8</option> 130 <option>OpenBSD-2.7</option> 131 <option>OpenBSD-2.6</option> 132 <option>OpenBSD-2.5</option> 133 <option>OpenBSD-2.4</option> 134 <option>OpenBSD-2.3</option> 135 <option>OpenBSD-2.2</option> 136 </select> 137 </fieldset> 138 </form> 139 </header> 140 <hr> 141 <div class="head" role="doc-pageheader" aria-label="Manual header 142 line"><span class="head-ltitle">FTP(1)</span> <span class="head-vol">General 143 Commands Manual</span> <span class="head-rtitle">FTP(1)</span></div> 144 <main class="manual-text"> 145 <section class="Sh"> 146 <h2 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h2> 147 <p class="Pp"><code class="Nm">ftp</code> — 148 <span class="Nd" role="doc-subtitle">Internet file transfer 149 program</span></p> 150 </section> 151 <section class="Sh"> 152 <h2 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h2> 153 <table class="Nm"> 154 <tr> 155 <td><code class="Nm">ftp</code></td> 156 <td>[<code class="Fl">-46AadEegiMmnptVv</code>] [<code class="Fl">-D</code> 157 <var class="Ar">title</var>] [<code class="Fl">-k</code> 158 <var class="Ar">seconds</var>] [<code class="Fl">-P</code> 159 <var class="Ar">port</var>] [<code class="Fl">-r</code> 160 <var class="Ar">seconds</var>] [<code class="Fl">-s</code> 161 <var class="Ar">sourceaddr</var>] [<var class="Ar">host</var> 162 [<var class="Ar">port</var>]]</td> 163 </tr> 164 </table> 165 <br/> 166 <table class="Nm"> 167 <tr> 168 <td><code class="Nm">ftp</code></td> 169 <td>[<code class="Fl">-C</code>] [<code class="Fl">-N</code> 170 <var class="Ar">name</var>] [<code class="Fl">-o</code> 171 <var class="Ar">output</var>] [<code class="Fl">-s</code> 172 <var class="Ar">sourceaddr</var>] 173 ftp://[<var class="Ar">user</var>:<var class="Ar">password</var><span class="No">@</span>]<var class="Ar">host</var>[:<var class="Ar">port</var>]<span class="No">/</span><var class="Ar">file</var>[/] 174 <var class="Ar">...</var></td> 175 </tr> 176 </table> 177 <br/> 178 <table class="Nm"> 179 <tr> 180 <td><code class="Nm">ftp</code></td> 181 <td>[<code class="Fl">-CTu</code>] [<code class="Fl">-c</code> 182 <var class="Ar">cookie</var>] [<code class="Fl">-N</code> 183 <var class="Ar">name</var>] [<code class="Fl">-o</code> 184 <var class="Ar">output</var>] [<code class="Fl">-S</code> 185 <var class="Ar">ssl_options</var>] [<code class="Fl">-s</code> 186 <var class="Ar">sourceaddr</var>] [<code class="Fl">-U</code> 187 <var class="Ar">useragent</var>] [<code class="Fl">-w</code> 188 <var class="Ar">seconds</var>] 189 http[s]://[<var class="Ar">user</var>:<var class="Ar">password</var><span class="No">@</span>]<var class="Ar">host</var>[:<var class="Ar">port</var>]<span class="No">/</span><var class="Ar">file</var> 190 <var class="Ar">...</var></td> 191 </tr> 192 </table> 193 <br/> 194 <table class="Nm"> 195 <tr> 196 <td><code class="Nm">ftp</code></td> 197 <td>[<code class="Fl">-C</code>] [<code class="Fl">-N</code> 198 <var class="Ar">name</var>] [<code class="Fl">-o</code> 199 <var class="Ar">output</var>] [<code class="Fl">-s</code> 200 <var class="Ar">sourceaddr</var>] file:<var class="Ar">file ...</var></td> 201 </tr> 202 </table> 203 <br/> 204 <table class="Nm"> 205 <tr> 206 <td><code class="Nm">ftp</code></td> 207 <td>[<code class="Fl">-C</code>] [<code class="Fl">-N</code> 208 <var class="Ar">name</var>] [<code class="Fl">-o</code> 209 <var class="Ar">output</var>] [<code class="Fl">-s</code> 210 <var class="Ar">sourceaddr</var>] 211 <var class="Ar">host</var>:/<var class="Ar">file</var>[/] 212 <var class="Ar">...</var></td> 213 </tr> 214 </table> 215 </section> 216 <section class="Sh"> 217 <h2 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h2> 218 <p class="Pp"><code class="Nm">ftp</code> is the user interface to the Internet 219 standard File Transfer Protocol (FTP). The program allows a user to transfer 220 files to and from a remote network site.</p> 221 <p class="Pp">The latter four usage formats will fetch a file using either the 222 FTP, HTTP, or HTTPS protocols into the current directory. This is ideal for 223 scripts. Refer to <a class="Sx" href="#AUTO_FETCHING_FILES">AUTO-FETCHING 224 FILES</a> below for more information.</p> 225 <p class="Pp">The options are as follows:</p> 226 <dl class="Bl-tag"> 227 <dt id="4"><a class="permalink" href="#4"><code class="Fl">-4</code></a></dt> 228 <dd>Forces <code class="Nm">ftp</code> to use IPv4 addresses only.</dd> 229 <dt id="6"><a class="permalink" href="#6"><code class="Fl">-6</code></a></dt> 230 <dd>Forces <code class="Nm">ftp</code> to use IPv6 addresses only.</dd> 231 <dt id="A"><a class="permalink" href="#A"><code class="Fl">-A</code></a></dt> 232 <dd>Force active mode FTP. By default, <code class="Nm">ftp</code> will try to 233 use passive mode FTP and fall back to active mode if passive is not 234 supported by the server. This option causes <code class="Nm">ftp</code> to 235 always use an active connection. It is only useful for connecting to very 236 old servers that do not implement passive mode properly.</dd> 237 <dt id="a"><a class="permalink" href="#a"><code class="Fl">-a</code></a></dt> 238 <dd>Causes <code class="Nm">ftp</code> to bypass the normal login procedure 239 and use an anonymous login instead.</dd> 240 <dt id="C"><a class="permalink" href="#C"><code class="Fl">-C</code></a></dt> 241 <dd>Continue a previously interrupted file transfer. 242 <code class="Nm">ftp</code> will continue transferring from an offset 243 equal to the length of <var class="Ar">file</var>. 244 <p class="Pp">Resuming HTTP(S) transfers are only supported if the remote 245 server supports the “Range” header.</p> 246 </dd> 247 <dt id="c"><a class="permalink" href="#c"><code class="Fl">-c</code></a> 248 <var class="Ar">cookie</var></dt> 249 <dd>Load a Netscape-like cookiejar file for HTTP and HTTPS transfers. With 250 this option relevant cookies from the jar are sent with each HTTP(S) 251 request. Setting the <code class="Ev">http_cookies</code> environment 252 variable has the same effect. If both the 253 <code class="Ev">http_cookies</code> environment variable is set and the 254 <code class="Fl">-c</code> argument is given, the latter takes 255 precedence.</dd> 256 <dt id="D"><a class="permalink" href="#D"><code class="Fl">-D</code></a> 257 <var class="Ar">title</var></dt> 258 <dd>Specify a short <var class="Ar">title</var> for the start of the progress 259 bar.</dd> 260 <dt id="d"><a class="permalink" href="#d"><code class="Fl">-d</code></a></dt> 261 <dd>Enables debugging.</dd> 262 <dt id="E"><a class="permalink" href="#E"><code class="Fl">-E</code></a></dt> 263 <dd>Disables EPSV/EPRT command on IPv4 connections.</dd> 264 <dt id="e"><a class="permalink" href="#e"><code class="Fl">-e</code></a></dt> 265 <dd>Disables command line editing. Useful for Emacs ange-ftp.</dd> 266 <dt id="g"><a class="permalink" href="#g"><code class="Fl">-g</code></a></dt> 267 <dd>Disables file name globbing.</dd> 268 <dt id="i"><a class="permalink" href="#i"><code class="Fl">-i</code></a></dt> 269 <dd>Turns off interactive prompting during multiple file transfers.</dd> 270 <dt id="k"><a class="permalink" href="#k"><code class="Fl">-k</code></a> 271 <var class="Ar">seconds</var></dt> 272 <dd>When greater than zero, sends a byte after each 273 <var class="Ar">seconds</var> period over the control connection during 274 long transfers, so that incorrectly configured network equipment won't 275 aggressively drop it. The FTP protocol supports a 276 <code class="Dv">NOOP</code> command that can be used for that purpose. 277 This assumes the FTP server can deal with extra commands coming over the 278 control connection during a transfer. Well-behaved servers queue those 279 commands, and process them after the transfer. By default, 280 <code class="Nm">ftp</code> will send a byte every 60 seconds.</dd> 281 <dt id="M"><a class="permalink" href="#M"><code class="Fl">-M</code></a></dt> 282 <dd>Causes <code class="Nm">ftp</code> to never display the progress meter in 283 cases where it would do so by default.</dd> 284 <dt id="m"><a class="permalink" href="#m"><code class="Fl">-m</code></a></dt> 285 <dd>Causes <code class="Nm">ftp</code> to always display the progress meter in 286 cases where it would not do so by default.</dd> 287 <dt id="N"><a class="permalink" href="#N"><code class="Fl">-N</code></a> 288 <var class="Ar">name</var></dt> 289 <dd>Use this alternative name instead of <code class="Nm">ftp</code> in some 290 error reports.</dd> 291 <dt id="n"><a class="permalink" href="#n"><code class="Fl">-n</code></a></dt> 292 <dd>Restrains <code class="Nm">ftp</code> from attempting 293 “auto-login” upon initial connection. If auto-login is 294 enabled, <code class="Nm">ftp</code> will check the 295 <span class="Pa">.netrc</span> file (see below) in the user's home 296 directory for an entry describing an account on the remote machine. If no 297 entry exists, <code class="Nm">ftp</code> will prompt for the remote 298 machine login name (default is the user identity on the local machine) 299 and, if necessary, prompt for a password and an account with which to log 300 in.</dd> 301 <dt id="o"><a class="permalink" href="#o"><code class="Fl">-o</code></a> 302 <var class="Ar">output</var></dt> 303 <dd>When fetching a single file or URL, save the contents in 304 <var class="Ar">output</var>. To make the contents go to stdout, use 305 ‘-’ for <var class="Ar">output</var>.</dd> 306 <dt id="P"><a class="permalink" href="#P"><code class="Fl">-P</code></a> 307 <var class="Ar">port</var></dt> 308 <dd>Sets the port number to <var class="Ar">port</var>.</dd> 309 <dt id="p"><a class="permalink" href="#p"><code class="Fl">-p</code></a></dt> 310 <dd>Enable passive mode operation for use behind connection filtering 311 firewalls. This option has been deprecated as <code class="Nm">ftp</code> 312 now tries to use passive mode by default, falling back to active mode if 313 the server does not support passive connections.</dd> 314 <dt id="r"><a class="permalink" href="#r"><code class="Fl">-r</code></a> 315 <var class="Ar">seconds</var></dt> 316 <dd>Retry to connect if failed, pausing for number of 317 <var class="Ar">seconds</var>.</dd> 318 <dt id="S"><a class="permalink" href="#S"><code class="Fl">-S</code></a> 319 <var class="Ar">ssl_options</var></dt> 320 <dd>SSL/TLS options to use with HTTPS transfers. The following settings are 321 available: 322 <dl class="Bl-tag"> 323 <dt id="cafile"><a class="permalink" href="#cafile"><code class="Cm">cafile</code></a>=<var class="Ar">/path/to/cert.pem</var></dt> 324 <dd>PEM encoded file containing CA certificates used for certificate 325 validation.</dd> 326 <dt id="capath"><a class="permalink" href="#capath"><code class="Cm">capath</code></a>=<var class="Ar">/path/to/certs/</var></dt> 327 <dd>Directory containing PEM encoded CA certificates used for certificate 328 validation. Such a directory can be prepared using the c_rehash script 329 distributed with OpenSSL.</dd> 330 <dt id="ciphers"><a class="permalink" href="#ciphers"><code class="Cm">ciphers</code></a>=<var class="Ar">cipher_list</var></dt> 331 <dd>Specify the list of ciphers that will be used by 332 <code class="Nm">ftp</code>. See the 333 <a class="Xr" href="/openssl.1" aria-label="openssl, section 334 1">openssl(1)</a> <code class="Cm">ciphers</code> subcommand.</dd> 335 <dt id="depth"><a class="permalink" href="#depth"><code class="Cm">depth</code></a>=<var class="Ar">max_depth</var></dt> 336 <dd>Maximum depth of the certificate chain allowed when performing 337 validation.</dd> 338 <dt id="do"><a class="permalink" href="#do"><code class="Cm">do</code></a></dt> 339 <dd>Perform server certificate validation.</dd> 340 <dt id="dont"><a class="permalink" href="#dont"><code class="Cm">dont</code></a></dt> 341 <dd>Don't perform server certificate validation.</dd> 342 <dt id="muststaple"><a class="permalink" href="#muststaple"><code class="Cm">muststaple</code></a></dt> 343 <dd>Require the server to present a valid OCSP stapling in the TLS 344 handshake.</dd> 345 <dt id="noverifytime"><a class="permalink" href="#noverifytime"><code class="Cm">noverifytime</code></a></dt> 346 <dd>Disable validation of certificate times and OCSP validation.</dd> 347 <dt id="protocols"><a class="permalink" href="#protocols"><code class="Cm">protocols</code></a>=<var class="Ar">protocol_list</var></dt> 348 <dd>Specify the TLS protocols that will be supported by 349 <code class="Nm">ftp</code> (see 350 <a class="Xr" href="/tls_config_parse_protocols.3" aria-label="tls_config_parse_protocols, 351 section 3">tls_config_parse_protocols(3)</a> for details).</dd> 352 <dt id="session"><a class="permalink" href="#session"><code class="Cm">session</code></a>=<var class="Ar">/path/to/session</var></dt> 353 <dd>Specify a file to use for TLS session data. If this file has a 354 non-zero length, the session data will be read from this file and the 355 client will attempt to resume the TLS session with the server. Upon 356 completion of a successful TLS handshake this file will be updated 357 with new session data, if available. This file will be created if it 358 does not already exist.</dd> 359 </dl> 360 <p class="Pp">By default, server certificate validation is performed, and if 361 it fails <code class="Nm">ftp</code> will abort. If no 362 <code class="Cm">cafile</code> or <code class="Cm">capath</code> setting 363 is provided, <span class="Pa">/etc/ssl/cert.pem</span> will be used.</p> 364 </dd> 365 <dt id="s"><a class="permalink" href="#s"><code class="Fl">-s</code></a> 366 <var class="Ar">sourceaddr</var></dt> 367 <dd>Set the source address for connections, which is useful on machines with 368 multiple interfaces.</dd> 369 <dt id="T"><a class="permalink" href="#T"><code class="Fl">-T</code></a></dt> 370 <dd>Send an “If-Modified-Since” header to the remote to 371 determine if the remote file's timestamp has changed.</dd> 372 <dt id="t"><a class="permalink" href="#t"><code class="Fl">-t</code></a></dt> 373 <dd>Enables packet tracing.</dd> 374 <dt id="U"><a class="permalink" href="#U"><code class="Fl">-U</code></a> 375 <var class="Ar">useragent</var></dt> 376 <dd>Set <var class="Ar">useragent</var> as the User-Agent for HTTP(S) URL 377 requests. If not specified, the default User-Agent is “OpenBSD 378 ftp”.</dd> 379 <dt id="u"><a class="permalink" href="#u"><code class="Fl">-u</code></a></dt> 380 <dd>Disable setting the local file's timestamps based on the 381 “Last-Modified” header. By default the local file's 382 timestamps are set to match those from the remote.</dd> 383 <dt id="V"><a class="permalink" href="#V"><code class="Fl">-V</code></a></dt> 384 <dd>Disable verbose mode, overriding the default of enabled when input is from 385 a terminal.</dd> 386 <dt id="v"><a class="permalink" href="#v"><code class="Fl">-v</code></a></dt> 387 <dd>Enable verbose mode. This is the default if input is from a terminal. 388 Forces <code class="Nm">ftp</code> to show all responses from the remote 389 server, as well as report on data transfer statistics.</dd> 390 <dt id="w"><a class="permalink" href="#w"><code class="Fl">-w</code></a> 391 <var class="Ar">seconds</var></dt> 392 <dd>Wait for <var class="Ar">seconds</var> for the remote server to connect 393 before giving up.</dd> 394 </dl> 395 <p class="Pp">The host with which <code class="Nm">ftp</code> is to communicate 396 may be specified on the command line. If this is done, 397 <code class="Nm">ftp</code> will immediately attempt to establish a 398 connection to an FTP server on that host; otherwise, 399 <code class="Nm">ftp</code> will enter its command interpreter and await 400 instructions from the user. When <code class="Nm">ftp</code> is awaiting 401 commands, the prompt “ftp>” is provided to the user. The 402 following commands are recognized by <code class="Nm">ftp</code>:</p> 403 <dl class="Bl-tag"> 404 <dt id="!"><a class="permalink" href="#!"><code class="Ic">!</code></a> 405 [<var class="Ar">command</var> [<var class="Ar">arg ...</var>]]</dt> 406 <dd>Invoke an interactive shell on the local machine. If there are arguments, 407 the first is taken to be a command to execute directly, with the rest of 408 the arguments as its arguments.</dd> 409 <dt id="$"><a class="permalink" href="#$"><code class="Ic">$</code></a> 410 <var class="Ar">macro-name</var> [<var class="Ar">arg ...</var>]</dt> 411 <dd>Execute the macro <var class="Ar">macro-name</var> that was defined with 412 the <code class="Ic">macdef</code> command. Arguments are passed to the 413 macro unglobbed.</dd> 414 <dt id="?"><a class="permalink" href="#?"><code class="Ic">?</code></a> 415 [<var class="Ar">command</var>]</dt> 416 <dd>A synonym for <code class="Ic">help</code>.</dd> 417 <dt id="account"><a class="permalink" href="#account"><code class="Ic">account</code></a> 418 [<var class="Ar">password</var>]</dt> 419 <dd>Supply a supplemental password required by a remote system for access to 420 resources once a login has been successfully completed. If no argument is 421 included, the user will be prompted for an account password in a 422 non-echoing input mode.</dd> 423 <dt id="append"><a class="permalink" href="#append"><code class="Ic">append</code></a> 424 <var class="Ar">local-file</var> [<var class="Ar">remote-file</var>]</dt> 425 <dd>Append a local file to a file on the remote machine. If 426 <var class="Ar">remote-file</var> is left unspecified, the local file name 427 is used in naming the remote file after being altered by any 428 <code class="Ic">ntrans</code> or <code class="Ic">nmap</code> setting. 429 File transfer uses the current settings for <code class="Ic">type</code>, 430 <code class="Ic">format</code>, <code class="Ic">mode</code>, and 431 <code class="Ic">structure</code>.</dd> 432 <dt id="ascii"><a class="permalink" href="#ascii"><code class="Ic">ascii</code></a></dt> 433 <dd>Set the file transfer <code class="Ic">type</code> to network ASCII.</dd> 434 <dt id="bell"><a class="permalink" href="#bell"><code class="Ic">bell</code></a> 435 [<code class="Ic">on</code> | <code class="Ic">off</code>]</dt> 436 <dd>Arrange that a bell be sounded after each file transfer command is 437 completed.</dd> 438 <dt id="binary"><a class="permalink" href="#binary"><code class="Ic">binary</code></a></dt> 439 <dd>Set the file transfer <code class="Ic">type</code> to support binary image 440 transfer. This is the default type.</dd> 441 <dt id="bye"><a class="permalink" href="#bye"><code class="Ic">bye</code></a></dt> 442 <dd>Terminate the FTP session with the remote server and exit 443 <code class="Nm">ftp</code>. An end-of-file will also terminate the 444 session and exit.</dd> 445 <dt id="case"><a class="permalink" href="#case"><code class="Ic">case</code></a> 446 [<code class="Ic">on</code> | <code class="Ic">off</code>]</dt> 447 <dd>Toggle remote computer file name case mapping during 448 <code class="Ic">mget</code> commands. When <code class="Ic">case</code> 449 is on (default is off), remote computer file names with all letters in 450 upper case are written in the local directory with the letters mapped to 451 lower case.</dd> 452 <dt id="cd"><a class="permalink" href="#cd"><code class="Ic">cd</code></a> 453 <var class="Ar">remote-directory</var></dt> 454 <dd>Change the working directory on the remote machine to 455 <var class="Ar">remote-directory</var>.</dd> 456 <dt id="cdup"><a class="permalink" href="#cdup"><code class="Ic">cdup</code></a></dt> 457 <dd>Change the remote machine working directory to the parent of the current 458 remote machine working directory.</dd> 459 <dt id="chmod"><a class="permalink" href="#chmod"><code class="Ic">chmod</code></a> 460 <var class="Ar">mode file</var></dt> 461 <dd>Change the permission modes of <var class="Ar">file</var> on the remote 462 system to <var class="Ar">mode</var>.</dd> 463 <dt id="close"><a class="permalink" href="#close"><code class="Ic">close</code></a></dt> 464 <dd>Terminate the FTP session with the remote server and return to the command 465 interpreter. Any defined macros are erased.</dd> 466 <dt id="cr"><a class="permalink" href="#cr"><code class="Ic">cr</code></a> 467 [<code class="Ic">on</code> | <code class="Ic">off</code>]</dt> 468 <dd>Toggle carriage return stripping during ASCII type file retrieval. Records 469 are denoted by a carriage return/linefeed sequence during ASCII type file 470 transfer. When <code class="Ic">cr</code> is on (the default), carriage 471 returns are stripped from this sequence to conform with the 472 <span class="Ux">UNIX</span> single linefeed record delimiter. Records on 473 non-UNIX remote systems may contain single linefeeds; when an ASCII type 474 transfer is made, these linefeeds may be distinguished from a record 475 delimiter only when <code class="Ic">cr</code> is off.</dd> 476 <dt id="debug"><a class="permalink" href="#debug"><code class="Ic">debug</code></a> 477 [<code class="Ic">on</code> | <code class="Ic">off</code> | 478 <var class="Ar">debuglevel</var>]</dt> 479 <dd>Toggle debugging mode. If an optional <var class="Ar">debuglevel</var> is 480 specified, it is used to set the debugging level. When debugging is on, 481 <code class="Nm">ftp</code> prints each command sent to the remote 482 machine, preceded by the string 483 ‘<code class="Li">--></code>’.</dd> 484 <dt id="delete"><a class="permalink" href="#delete"><code class="Ic">delete</code></a> 485 <var class="Ar">remote-file</var></dt> 486 <dd>Delete the file <var class="Ar">remote-file</var> on the remote 487 machine.</dd> 488 <dt id="dir"><a class="permalink" href="#dir"><code class="Ic">dir</code></a> 489 [<var class="Ar">remote-directory</var> 490 [<var class="Ar">local-file</var>]]</dt> 491 <dd>A synonym for <code class="Ic">ls</code>.</dd> 492 <dt id="disconnect"><a class="permalink" href="#disconnect"><code class="Ic">disconnect</code></a></dt> 493 <dd>A synonym for <code class="Ic">close</code>.</dd> 494 <dt id="edit"><a class="permalink" href="#edit"><code class="Ic">edit</code></a> 495 [<code class="Ic">on</code> | <code class="Ic">off</code>]</dt> 496 <dd>Toggle command line editing, and context sensitive command and file 497 completion. This is automatically enabled if input is from a terminal, and 498 disabled otherwise.</dd> 499 <dt id="epsv4"><a class="permalink" href="#epsv4"><code class="Ic">epsv4</code></a> 500 [<code class="Ic">on</code> | <code class="Ic">off</code>]</dt> 501 <dd>Toggle use of EPSV/EPRT command on IPv4 connection.</dd> 502 <dt id="exit"><a class="permalink" href="#exit"><code class="Ic">exit</code></a></dt> 503 <dd>A synonym for <code class="Ic">bye</code>.</dd> 504 <dt id="form"><a class="permalink" href="#form"><code class="Ic">form</code></a> 505 <var class="Ar">format</var></dt> 506 <dd>Set the file transfer <code class="Ic">form</code> to 507 <var class="Ar">format</var>. The default format is 508 “file”.</dd> 509 <dt id="ftp"><a class="permalink" href="#ftp"><code class="Ic">ftp</code></a> 510 <var class="Ar">host</var> [<var class="Ar">port</var>]</dt> 511 <dd>A synonym for <code class="Ic">open</code>.</dd> 512 <dt id="gate"><a class="permalink" href="#gate"><code class="Ic">gate</code></a> 513 [<code class="Ic">on</code> | <code class="Ic">off</code> | 514 <var class="Ar">host</var> [<var class="Ar">port</var>]]</dt> 515 <dd>Toggle gate-ftp mode. This will not be permitted if the gate-ftp server 516 hasn't been set (either explicitly by the user, or from the 517 <code class="Ev">FTPSERVER</code> environment variable). If 518 <var class="Ar">host</var> is given, then gate-ftp mode will be enabled, 519 and the gate-ftp server will be set to <var class="Ar">host</var>. If 520 <var class="Ar">port</var> is also given, that will be used as the port to 521 connect to on the gate-ftp server.</dd> 522 <dt id="get"><a class="permalink" href="#get"><code class="Ic">get</code></a> 523 <var class="Ar">remote-file</var> [<var class="Ar">local-file</var>]</dt> 524 <dd>Retrieve the <var class="Ar">remote-file</var> and store it on the local 525 machine. If the local file name is not specified, it is given the same 526 name it has on the remote machine, subject to alteration by the current 527 <code class="Ic">case</code>, <code class="Ic">ntrans</code>, and 528 <code class="Ic">nmap</code> settings. The current settings for 529 <code class="Ic">type</code>, <code class="Ic">form</code>, 530 <code class="Ic">mode</code>, and <code class="Ic">structure</code> are 531 used while transferring the file.</dd> 532 <dt id="glob"><a class="permalink" href="#glob"><code class="Ic">glob</code></a> 533 [<code class="Ic">on</code> | <code class="Ic">off</code>]</dt> 534 <dd>Toggle filename expansion for <code class="Ic">mdelete</code>, 535 <code class="Ic">mget</code> and <code class="Ic">mput</code>. If globbing 536 is turned off with <code class="Ic">glob</code>, the file name arguments 537 are taken literally and not expanded. Globbing for 538 <code class="Ic">mput</code> is done as in 539 <a class="Xr" href="/csh.1" aria-label="csh, section 1">csh(1)</a>. For 540 <code class="Ic">mdelete</code> and <code class="Ic">mget</code>, each 541 remote file name is expanded separately on the remote machine and the 542 lists are not merged. Expansion of a directory name is likely to be 543 different from expansion of the name of an ordinary file: the exact result 544 depends on the foreign operating system and FTP server, and can be 545 previewed by doing “mls remote-files -”. Note: 546 <code class="Ic">mget</code> and <code class="Ic">mput</code> are not 547 meant to transfer entire directory subtrees of files. That can be done by 548 transferring a <a class="Xr" href="/tar.1" aria-label="tar, section 549 1">tar(1)</a> archive of the subtree (in binary mode).</dd> 550 <dt id="hash"><a class="permalink" href="#hash"><code class="Ic">hash</code></a> 551 [<code class="Ic">on</code> | <code class="Ic">off</code> | 552 <var class="Ar">size</var>]</dt> 553 <dd>Toggle hash mark (‘<code class="Li">#</code>’) printing for 554 each data block transferred. The size of a data block defaults to 1024 555 bytes. This can be changed by specifying <var class="Ar">size</var> in 556 bytes.</dd> 557 <dt id="help"><a class="permalink" href="#help"><code class="Ic">help</code></a> 558 [<var class="Ar">command</var>]</dt> 559 <dd>Print an informative message about the meaning of 560 <var class="Ar">command</var>. If no argument is given, 561 <code class="Nm">ftp</code> prints a list of the known commands.</dd> 562 <dt id="idle"><a class="permalink" href="#idle"><code class="Ic">idle</code></a> 563 [<var class="Ar">seconds</var>]</dt> 564 <dd>Set the inactivity timer on the remote server to 565 <var class="Ar">seconds</var> seconds. If <var class="Ar">seconds</var> is 566 omitted, the current inactivity timer is printed.</dd> 567 <dt id="lcd"><a class="permalink" href="#lcd"><code class="Ic">lcd</code></a> 568 [<var class="Ar">local-directory</var>]</dt> 569 <dd>Change the working directory on the local machine. If no 570 <var class="Ar">local-directory</var> is specified, the user's home 571 directory is used.</dd> 572 <dt id="less"><a class="permalink" href="#less"><code class="Ic">less</code></a> 573 <var class="Ar">file</var></dt> 574 <dd>A synonym for <code class="Ic">page</code>.</dd> 575 <dt id="lpwd"><a class="permalink" href="#lpwd"><code class="Ic">lpwd</code></a></dt> 576 <dd>Print the working directory on the local machine.</dd> 577 <dt id="ls"><a class="permalink" href="#ls"><code class="Ic">ls</code></a> 578 [<var class="Ar">remote-directory</var> 579 [<var class="Ar">local-file</var>]]</dt> 580 <dd>Print a listing of the contents of a directory on the remote machine. The 581 listing includes any system-dependent information that the server chooses 582 to include; for example, most <span class="Ux">UNIX</span> systems will 583 produce output from the command ‘<code class="Li">ls 584 -l</code>’. If <var class="Ar">remote-directory</var> is left 585 unspecified, the current working directory is used. If interactive 586 prompting is on, <code class="Nm">ftp</code> will prompt the user to 587 verify that the last argument is indeed the target local file for 588 receiving <code class="Ic">ls</code> output. If no local file is 589 specified, or if <var class="Ar">local-file</var> is ‘-’, 590 the output is sent to the terminal.</dd> 591 <dt id="macdef"><a class="permalink" href="#macdef"><code class="Ic">macdef</code></a> 592 <var class="Ar">macro-name</var></dt> 593 <dd>Define a macro. Subsequent lines are stored as the macro 594 <var class="Ar">macro-name</var>; a null line (consecutive newline 595 characters in a file or carriage returns from the terminal) terminates 596 macro input mode. There is a limit of 16 macros and 4096 total characters 597 in all defined macros. Macro names can be a maximum of 8 characters. 598 Macros are only applicable to the current session they are defined in (or 599 if defined outside a session, to the session invoked with the next 600 <code class="Ic">open</code> command), and remain defined until a 601 <code class="Ic">close</code> command is executed. To invoke a macro, use 602 the <code class="Ic">$</code> command (see above). 603 <p class="Pp">The macro processor interprets 604 ‘<code class="Li">$</code>’ and 605 ‘<code class="Li">\</code>’ as special characters. A 606 ‘<code class="Li">$</code>’ followed by a number (or 607 numbers) is replaced by the corresponding argument on the macro 608 invocation command line. A ‘<code class="Li">$</code>’ 609 followed by an ‘i’ tells the macro processor that the 610 executing macro is to be looped. On the first pass 611 ‘<code class="Li">$i</code>’ is replaced by the first 612 argument on the macro invocation command line, on the second pass it is 613 replaced by the second argument, and so on. A 614 ‘<code class="Li">\</code>’ followed by any character is 615 replaced by that character. Use the 616 ‘<code class="Li">\</code>’ to prevent special treatment 617 of the ‘<code class="Li">$</code>’.</p> 618 </dd> 619 <dt id="mdelete"><a class="permalink" href="#mdelete"><code class="Ic">mdelete</code></a> 620 [<var class="Ar">remote-files</var>]</dt> 621 <dd>Delete the <var class="Ar">remote-files</var> on the remote machine.</dd> 622 <dt id="mdir"><a class="permalink" href="#mdir"><code class="Ic">mdir</code></a> 623 <var class="Ar">remote-files local-file</var></dt> 624 <dd>A synonym for <code class="Ic">mls</code>.</dd> 625 <dt id="mget"><a class="permalink" href="#mget"><code class="Ic">mget</code></a> 626 [<code class="Fl">-cnr</code>] [<code class="Fl">-d</code> 627 <var class="Ar">depth</var>] <var class="Ar">remote-files</var></dt> 628 <dd>Expand the <var class="Ar">remote-files</var> on the remote machine and do 629 a <code class="Ic">get</code> for each file name thus produced. See 630 <code class="Ic">glob</code> for details on the filename expansion. 631 Resulting file names will then be processed according to 632 <code class="Ic">case</code>, <code class="Ic">ntrans</code>, and 633 <code class="Ic">nmap</code> settings. Files are transferred into the 634 local working directory, which can be changed with 635 ‘<code class="Li">lcd directory</code>’; new local 636 directories can be created with ‘<code class="Li">! mkdir 637 directory</code>’. 638 <p class="Pp">The options are as follows:</p> 639 <dl class="Bl-tag"> 640 <dt id="c~2"><a class="permalink" href="#c~2"><code class="Fl">-c</code></a></dt> 641 <dd>Use <code class="Ic">reget</code> instead of 642 <code class="Ic">get</code>.</dd> 643 <dt id="d~2"><a class="permalink" href="#d~2"><code class="Fl">-d</code></a> 644 <var class="Ar">depth</var></dt> 645 <dd>Specify the maximum recursion level <var class="Ar">depth</var>. The 646 default is 0, which means unlimited.</dd> 647 <dt id="n~2"><a class="permalink" href="#n~2"><code class="Fl">-n</code></a></dt> 648 <dd>Use <code class="Ic">newer</code> instead of 649 <code class="Ic">get</code>.</dd> 650 <dt id="r~2"><a class="permalink" href="#r~2"><code class="Fl">-r</code></a></dt> 651 <dd>Recursively descend the directory tree, transferring all files and 652 directories.</dd> 653 </dl> 654 </dd> 655 <dt id="mkdir"><a class="permalink" href="#mkdir"><code class="Ic">mkdir</code></a> 656 <var class="Ar">directory-name</var></dt> 657 <dd>Make a directory on the remote machine.</dd> 658 <dt id="mls"><a class="permalink" href="#mls"><code class="Ic">mls</code></a> 659 <var class="Ar">remote-files local-file</var></dt> 660 <dd>Like <code class="Ic">ls</code>, except multiple remote files may be 661 specified, and the <var class="Ar">local-file</var> must be specified. If 662 interactive prompting is on, <code class="Nm">ftp</code> will prompt the 663 user to verify that the last argument is indeed the target local file for 664 receiving <code class="Ic">mls</code> output.</dd> 665 <dt id="mode"><a class="permalink" href="#mode"><code class="Ic">mode</code></a> 666 [<var class="Ar">mode-name</var>]</dt> 667 <dd>Set the file transfer <code class="Ic">mode</code> to 668 <var class="Ar">mode-name</var>. The default mode is 669 “stream” mode.</dd> 670 <dt id="modtime"><a class="permalink" href="#modtime"><code class="Ic">modtime</code></a> 671 <var class="Ar">file</var></dt> 672 <dd>Show the last modification time of <var class="Ar">file</var> on the 673 remote machine.</dd> 674 <dt id="more"><a class="permalink" href="#more"><code class="Ic">more</code></a> 675 <var class="Ar">file</var></dt> 676 <dd>A synonym for <code class="Ic">page</code>.</dd> 677 <dt id="mput"><a class="permalink" href="#mput"><code class="Ic">mput</code></a> 678 [<code class="Fl">-cr</code>] [<code class="Fl">-d</code> 679 <var class="Ar">depth</var>] <var class="Ar">local-files</var></dt> 680 <dd>Expand wild cards in the list of local files given as arguments and do a 681 <code class="Ic">put</code> for each file in the resulting list. See 682 <code class="Ic">glob</code> for details of filename expansion. Resulting 683 file names will then be processed according to 684 <code class="Ic">ntrans</code> and <code class="Ic">nmap</code> settings. 685 <p class="Pp">The options are as follows:</p> 686 <dl class="Bl-tag"> 687 <dt id="c~3"><a class="permalink" href="#c~3"><code class="Fl">-c</code></a></dt> 688 <dd>Use <code class="Ic">reput</code> instead of 689 <code class="Ic">put</code>.</dd> 690 <dt id="d~3"><a class="permalink" href="#d~3"><code class="Fl">-d</code></a> 691 <var class="Ar">depth</var></dt> 692 <dd>Specify the maximum recursion level <var class="Ar">depth</var>. The 693 default is 0, which means unlimited.</dd> 694 <dt id="r~3"><a class="permalink" href="#r~3"><code class="Fl">-r</code></a></dt> 695 <dd>Recursively descend the directory tree, transferring all files and 696 directories.</dd> 697 </dl> 698 </dd> 699 <dt id="msend"><a class="permalink" href="#msend"><code class="Ic">msend</code></a> 700 [<code class="Fl">-c</code>] <var class="Ar">local-files</var></dt> 701 <dd>A synonym for <code class="Ic">mput</code>.</dd> 702 <dt id="newer"><a class="permalink" href="#newer"><code class="Ic">newer</code></a> 703 <var class="Ar">remote-file</var> [<var class="Ar">local-file</var>]</dt> 704 <dd>Get the file only if the modification time of the remote file is more 705 recent than the file on the current system. If the file does not exist on 706 the current system, the remote file is considered 707 <code class="Ic">newer</code>. Otherwise, this command is identical to 708 <var class="Ar">get</var>.</dd> 709 <dt id="nlist"><a class="permalink" href="#nlist"><code class="Ic">nlist</code></a> 710 [<var class="Ar">remote-directory</var> 711 [<var class="Ar">local-file</var>]]</dt> 712 <dd>Print a list of the files in a directory on the remote machine. If 713 <var class="Ar">remote-directory</var> is left unspecified, the current 714 working directory is used. If interactive prompting is on, 715 <code class="Nm">ftp</code> will prompt the user to verify that the last 716 argument is indeed the target local file for receiving 717 <code class="Ic">nlist</code> output. If no local file is specified, or if 718 <var class="Ar">local-file</var> is ‘-’, the output is sent 719 to the terminal. Note that on some servers, the 720 <code class="Ic">nlist</code> command will only return information on 721 normal files (not directories or special files).</dd> 722 <dt id="nmap"><a class="permalink" href="#nmap"><code class="Ic">nmap</code></a> 723 [<var class="Ar">inpattern outpattern</var>]</dt> 724 <dd>Set or unset the filename mapping mechanism. If no arguments are 725 specified, the filename mapping mechanism is unset. If arguments are 726 specified, remote filenames are mapped during <code class="Ic">mput</code> 727 commands and <code class="Ic">put</code> commands issued without a 728 specified remote target filename. If arguments are specified, local 729 filenames are mapped during <code class="Ic">mget</code> commands and 730 <code class="Ic">get</code> commands issued without a specified local 731 target filename. This command is useful when connecting to a non-UNIX 732 remote computer with different file naming conventions or practices. 733 <p class="Pp">The mapping follows the pattern set by 734 <var class="Ar">inpattern</var> and <var class="Ar">outpattern</var>. 735 <var class="Ar">inpattern</var> is a template for incoming filenames 736 (which may have already been processed according to the 737 <code class="Ic">ntrans</code> and <code class="Ic">case</code> 738 settings). Variable templating is accomplished by including the 739 sequences ‘<code class="Li">$1</code>’, 740 ‘<code class="Li">$2</code>’, ..., 741 ‘<code class="Li">$9</code>’ in 742 <var class="Ar">inpattern</var>. Use 743 ‘<code class="Li">\</code>’ to prevent this special 744 treatment of the ‘<code class="Li">$</code>’ character. 745 All other characters are treated literally, and are used to determine 746 the <code class="Ic">nmap</code> <var class="Ar">inpattern</var> 747 variable values.</p> 748 <p class="Pp">For example, given <var class="Ar">inpattern</var> $1.$2 and 749 the remote file name "mydata.data", $1 would have the value 750 "mydata", and $2 would have the value "data". The 751 <var class="Ar">outpattern</var> determines the resulting mapped 752 filename. The sequences ‘<code class="Li">$1</code>’, 753 ‘<code class="Li">$2</code>’, ..., 754 ‘<code class="Li">$9</code>’ are replaced by any value 755 resulting from the <var class="Ar">inpattern</var> template. The 756 sequence ‘<code class="Li">$0</code>’ is replaced by the 757 original filename. Additionally, the sequence 758 ‘[<var class="Ar">seq1</var>, <var class="Ar">seq2</var>]’ 759 is replaced by <var class="Ar">seq1</var> if <var class="Ar">seq1</var> 760 is not a null string; otherwise it is replaced by 761 <var class="Ar">seq2</var>. For example:</p> 762 <p class="Pp"></p> 763 <div class="Bd Bd-indent"><code class="Li">nmap $1.$2.$3 764 [$1,$2].[$2,file]</code></div> 765 <p class="Pp">This command would yield the output filename 766 <span class="Pa">myfile.data</span> for input filenames 767 <span class="Pa">myfile.data</span> and 768 <span class="Pa">myfile.data.old</span>; 769 <span class="Pa">myfile.file</span> for the input filename 770 <span class="Pa">myfile</span>; and 771 <span class="Pa">myfile.myfile</span> for the input filename 772 <span class="Pa">.myfile</span>. Spaces may be included in 773 <var class="Ar">outpattern</var> by quoting them, as in the following 774 example:</p> 775 <div class="Bd Pp Bd-indent Li"> 776 <pre>nmap $1.$2 "$1 $2"</pre> 777 </div> 778 <p class="Pp">Use the ‘<code class="Li">\</code>’ character to 779 prevent special treatment of the 780 ‘<code class="Li">$</code>’, 781 ‘<code class="Li">[</code>’, 782 ‘<code class="Li">]</code>’, and 783 ‘<code class="Li">,</code>’ characters.</p> 784 </dd> 785 <dt id="ntrans"><a class="permalink" href="#ntrans"><code class="Ic">ntrans</code></a> 786 [<var class="Ar">inchars</var> [<var class="Ar">outchars</var>]]</dt> 787 <dd>Set or unset the filename character translation mechanism. If no arguments 788 are specified, the filename character translation mechanism is unset. If 789 arguments are specified, characters in remote filenames are translated 790 during <code class="Ic">mput</code> commands and 791 <code class="Ic">put</code> commands issued without a specified remote 792 target filename. If arguments are specified, characters in local filenames 793 are translated during <code class="Ic">mget</code> commands and 794 <code class="Ic">get</code> commands issued without a specified local 795 target filename. This command is useful when connecting to a non-UNIX 796 remote computer with different file naming conventions or practices. 797 Characters in a filename matching a character in 798 <var class="Ar">inchars</var> are replaced with the corresponding 799 character in <var class="Ar">outchars</var>. If the character's position 800 in <var class="Ar">inchars</var> is longer than the length of 801 <var class="Ar">outchars</var>, the character is deleted from the file 802 name.</dd> 803 <dt id="open"><a class="permalink" href="#open"><code class="Ic">open</code></a> 804 <var class="Ar">host</var> [<var class="Ar">port</var>]</dt> 805 <dd>Establish a connection to the specified <var class="Ar">host</var> FTP 806 server. An optional port number may be supplied, in which case 807 <code class="Nm">ftp</code> will attempt to contact an FTP server at that 808 port. If the <code class="Ic">auto-login</code> option is on (default), 809 <code class="Nm">ftp</code> will also attempt to automatically log the 810 user in to the FTP server (see below).</dd> 811 <dt id="page"><a class="permalink" href="#page"><code class="Ic">page</code></a> 812 <var class="Ar">file</var></dt> 813 <dd>Retrieve <code class="Ic">file</code> and display with the program defined 814 in <code class="Ev">PAGER</code> (defaulting to 815 <a class="Xr" href="/more.1" aria-label="more, section 1">more(1)</a> if 816 <code class="Ev">PAGER</code> is null or not defined).</dd> 817 <dt id="passive"><a class="permalink" href="#passive"><code class="Ic">passive</code></a> 818 [<code class="Ic">on</code> | <code class="Ic">off</code>]</dt> 819 <dd>Toggle passive mode. If passive mode is turned on (default is on), 820 <code class="Nm">ftp</code> will send a <code class="Dv">EPSV</code> 821 command for all data connections instead of the usual 822 <code class="Dv">PORT</code> command. The <code class="Dv">PASV</code> 823 command requests that the remote server open a port for the data 824 connection and return the address of that port. The remote server listens 825 on that port and the client connects to it. When using the more 826 traditional <code class="Dv">PORT</code> command, the client listens on a 827 port and sends that address to the remote server, who connects back to it. 828 Passive mode is useful when using <code class="Nm">ftp</code> through a 829 gateway router or host that controls the directionality of traffic. (Note 830 that though FTP servers are required to support the 831 <code class="Dv">PASV</code> command by RFC 1123, some do not.)</dd> 832 <dt id="preserve"><a class="permalink" href="#preserve"><code class="Ic">preserve</code></a> 833 [<code class="Ic">on</code> | <code class="Ic">off</code>]</dt> 834 <dd>Toggle preservation of modification times on retrieved files.</dd> 835 <dt id="progress"><a class="permalink" href="#progress"><code class="Ic">progress</code></a> 836 [<code class="Ic">on</code> | <code class="Ic">off</code>]</dt> 837 <dd>Toggle display of transfer progress bar. The progress bar will be disabled 838 for a transfer that has <var class="Ar">local-file</var> as 839 ‘-’ or a command that starts with ‘|’. Refer 840 to <a class="Sx" href="#FILE_NAMING_CONVENTIONS">FILE NAMING 841 CONVENTIONS</a> for more information.</dd> 842 <dt id="prompt"><a class="permalink" href="#prompt"><code class="Ic">prompt</code></a> 843 [<code class="Ic">on</code> | <code class="Ic">off</code>]</dt> 844 <dd>Toggle interactive prompting. Interactive prompting occurs during multiple 845 file transfers to allow the user to selectively retrieve or store files. 846 If prompting is turned off (default is on), any 847 <code class="Ic">mget</code> or <code class="Ic">mput</code> will transfer 848 all files, and any <code class="Ic">mdelete</code> will delete all files. 849 <p class="Pp">When prompting is on, the following commands are available at 850 a prompt:</p> 851 <div class="Bd-indent"> 852 <dl class="Bl-tag"> 853 <dt><code class="Ic">?</code></dt> 854 <dd>Print help message.</dd> 855 <dt id="a~2"><a class="permalink" href="#a~2"><code class="Ic">a</code></a></dt> 856 <dd>Answer “yes” to the current file and automatically 857 answer “yes” to any remaining files for the current 858 command.</dd> 859 <dt id="n~3"><a class="permalink" href="#n~3"><code class="Ic">n</code></a></dt> 860 <dd>Do not transfer the file.</dd> 861 <dt id="p~2"><a class="permalink" href="#p~2"><code class="Ic">p</code></a></dt> 862 <dd>Answer “yes” to the current file and turn off prompt 863 mode (as if “prompt off” had been given).</dd> 864 <dt id="q"><a class="permalink" href="#q"><code class="Ic">q</code></a></dt> 865 <dd>Answer “no” to the current file and automatically answer 866 “no” to any remaining files for the current 867 command.</dd> 868 <dt id="y"><a class="permalink" href="#y"><code class="Ic">y</code></a></dt> 869 <dd>Transfer the file.</dd> 870 </dl> 871 </div> 872 </dd> 873 <dt id="proxy"><a class="permalink" href="#proxy"><code class="Ic">proxy</code></a> 874 <var class="Ar">command</var></dt> 875 <dd>Execute an FTP command on a secondary control connection. This command 876 allows simultaneous connection to two remote FTP servers for transferring 877 files between the two servers. The first <code class="Ic">proxy</code> 878 command should be an <code class="Ic">open</code>, to establish the 879 secondary control connection. Enter the command <code class="Ic">proxy 880 ?</code> to see other FTP commands executable on the secondary connection. 881 The following commands behave differently when prefaced by 882 <code class="Ic">proxy</code>: <code class="Ic">open</code> will not 883 define new macros during the auto-login process; 884 <code class="Ic">close</code> will not erase existing macro definitions; 885 <code class="Ic">get</code> and <code class="Ic">mget</code> transfer 886 files from the host on the primary control connection to the host on the 887 secondary control connection; and <code class="Ic">put</code>, 888 <code class="Ic">mput</code>, and <code class="Ic">append</code> transfer 889 files from the host on the secondary control connection to the host on the 890 primary control connection. Third party file transfers depend upon support 891 of the FTP protocol <code class="Dv">PASV</code> command by the server on 892 the secondary control connection.</dd> 893 <dt id="put"><a class="permalink" href="#put"><code class="Ic">put</code></a> 894 <var class="Ar">local-file</var> [<var class="Ar">remote-file</var>]</dt> 895 <dd>Store a local file on the remote machine. If 896 <var class="Ar">remote-file</var> is left unspecified, the local file name 897 is used after processing according to any <code class="Ic">ntrans</code> 898 or <code class="Ic">nmap</code> settings in naming the remote file. File 899 transfer uses the current settings for <code class="Ic">type</code>, 900 <code class="Ic">format</code>, <code class="Ic">mode</code>, and 901 <code class="Ic">structure</code>.</dd> 902 <dt id="pwd"><a class="permalink" href="#pwd"><code class="Ic">pwd</code></a></dt> 903 <dd>Print the name of the current working directory on the remote 904 machine.</dd> 905 <dt id="quit"><a class="permalink" href="#quit"><code class="Ic">quit</code></a></dt> 906 <dd>A synonym for <code class="Ic">bye</code>.</dd> 907 <dt id="quote"><a class="permalink" href="#quote"><code class="Ic">quote</code></a> 908 <var class="Ar">arg ...</var></dt> 909 <dd>The arguments specified are sent, verbatim, to the remote FTP server.</dd> 910 <dt id="recv"><a class="permalink" href="#recv"><code class="Ic">recv</code></a> 911 <var class="Ar">remote-file</var> [<var class="Ar">local-file</var>]</dt> 912 <dd>A synonym for <code class="Ic">get</code>.</dd> 913 <dt id="reget"><a class="permalink" href="#reget"><code class="Ic">reget</code></a> 914 <var class="Ar">remote-file</var> [<var class="Ar">local-file</var>]</dt> 915 <dd>Reget acts like get, except that if <var class="Ar">local-file</var> 916 exists and is smaller than <var class="Ar">remote-file</var>, 917 <var class="Ar">local-file</var> is presumed to be a partially transferred 918 copy of <var class="Ar">remote-file</var> and the transfer is continued 919 from the apparent point of failure. This command is useful when 920 transferring very large files over networks that are prone to dropping 921 connections.</dd> 922 <dt id="rename"><a class="permalink" href="#rename"><code class="Ic">rename</code></a> 923 <var class="Ar">from-name to-name</var></dt> 924 <dd>Rename the file <var class="Ar">from-name</var> on the remote machine to 925 the file <var class="Ar">to-name</var>.</dd> 926 <dt id="reput"><a class="permalink" href="#reput"><code class="Ic">reput</code></a> 927 <var class="Ar">local-file</var> [<var class="Ar">remote-file</var>]</dt> 928 <dd>Reput acts like put, except that if <var class="Ar">remote-file</var> 929 exists and is smaller than <var class="Ar">local-file</var>, 930 <var class="Ar">remote-file</var> is presumed to be a partially 931 transferred copy of <var class="Ar">local-file</var> and the transfer is 932 continued from the apparent point of failure. This command is useful when 933 transferring very large files over networks that are prone to dropping 934 connections.</dd> 935 <dt id="reset"><a class="permalink" href="#reset"><code class="Ic">reset</code></a></dt> 936 <dd>Clear reply queue. This command re-synchronizes command/reply sequencing 937 with the remote FTP server. Resynchronization may be necessary following a 938 violation of the FTP protocol by the remote server.</dd> 939 <dt id="restart"><a class="permalink" href="#restart"><code class="Ic">restart</code></a> 940 <var class="Ar">marker</var></dt> 941 <dd>Restart the immediately following <code class="Ic">get</code> or 942 <code class="Ic">put</code> at the indicated <var class="Ar">marker</var>. 943 On <span class="Ux">UNIX</span> systems, <var class="Ar">marker</var> is 944 usually a byte offset into the file.</dd> 945 <dt id="rhelp"><a class="permalink" href="#rhelp"><code class="Ic">rhelp</code></a> 946 [<var class="Ar">command-name</var>]</dt> 947 <dd>Request help from the remote FTP server. If a 948 <var class="Ar">command-name</var> is specified, it is supplied to the 949 server as well.</dd> 950 <dt id="rmdir"><a class="permalink" href="#rmdir"><code class="Ic">rmdir</code></a> 951 <var class="Ar">directory-name</var></dt> 952 <dd>Delete a directory on the remote machine.</dd> 953 <dt id="rstatus"><a class="permalink" href="#rstatus"><code class="Ic">rstatus</code></a> 954 [<var class="Ar">file</var>]</dt> 955 <dd>With no arguments, show status of remote machine. If 956 <var class="Ar">file</var> is specified, show status of 957 <var class="Ar">file</var> on remote machine.</dd> 958 <dt id="runique"><a class="permalink" href="#runique"><code class="Ic">runique</code></a> 959 [<code class="Ic">on</code> | <code class="Ic">off</code>]</dt> 960 <dd>Toggle storing of files on the local system with unique filenames. If a 961 file already exists with a name equal to the target local filename for a 962 <code class="Ic">get</code> or <code class="Ic">mget</code> command, a 963 “.1” is appended to the name. If the resulting name matches 964 another existing file, a “.2” is appended to the original 965 name. If this process continues up to “.99”, an error 966 message is printed, and the transfer does not take place. The generated 967 unique filename will be reported. Note that 968 <code class="Ic">runique</code> will not affect local files generated from 969 a shell command (see below). The default value is off.</dd> 970 <dt id="send"><a class="permalink" href="#send"><code class="Ic">send</code></a> 971 <var class="Ar">local-file</var> [<var class="Ar">remote-file</var>]</dt> 972 <dd>A synonym for <code class="Ic">put</code>.</dd> 973 <dt id="sendport"><a class="permalink" href="#sendport"><code class="Ic">sendport</code></a> 974 [<code class="Ic">on</code> | <code class="Ic">off</code>]</dt> 975 <dd>Toggle the use of <code class="Dv">PORT</code> commands. By default, 976 <code class="Nm">ftp</code> will attempt to use a 977 <code class="Dv">PORT</code> command when establishing a connection for 978 each data transfer. The use of <code class="Dv">PORT</code> commands can 979 prevent delays when performing multiple file transfers. If the 980 <code class="Dv">PORT</code> command fails, <code class="Nm">ftp</code> 981 will use the default data port. When the use of 982 <code class="Dv">PORT</code> commands is disabled, no attempt will be made 983 to use <code class="Dv">PORT</code> commands for each data transfer. This 984 is useful for certain FTP implementations which do ignore 985 <code class="Dv">PORT</code> commands but, incorrectly, indicate they've 986 been accepted.</dd> 987 <dt id="site"><a class="permalink" href="#site"><code class="Ic">site</code></a> 988 <var class="Ar">arg ...</var></dt> 989 <dd>The arguments specified are sent, verbatim, to the remote FTP server as a 990 <code class="Dv">SITE</code> command.</dd> 991 <dt id="size"><a class="permalink" href="#size"><code class="Ic">size</code></a> 992 <var class="Ar">file</var></dt> 993 <dd>Return size of <var class="Ar">file</var> on remote machine.</dd> 994 <dt id="status"><a class="permalink" href="#status"><code class="Ic">status</code></a></dt> 995 <dd>Show the current status of <code class="Nm">ftp</code>.</dd> 996 <dt id="sunique"><a class="permalink" href="#sunique"><code class="Ic">sunique</code></a> 997 [<code class="Ic">on</code> | <code class="Ic">off</code>]</dt> 998 <dd>Toggle storing of files on remote machine under unique file names. The 999 remote FTP server must support the FTP protocol 1000 <code class="Dv">STOU</code> command for successful completion. The remote 1001 server will report the unique name. Default value is off.</dd> 1002 <dt id="system"><a class="permalink" href="#system"><code class="Ic">system</code></a></dt> 1003 <dd>Show the type of operating system running on the remote machine.</dd> 1004 <dt id="trace"><a class="permalink" href="#trace"><code class="Ic">trace</code></a> 1005 [<code class="Ic">on</code> | <code class="Ic">off</code>]</dt> 1006 <dd>Toggle packet tracing.</dd> 1007 <dt id="type"><a class="permalink" href="#type"><code class="Ic">type</code></a> 1008 [<var class="Ar">type-name</var>]</dt> 1009 <dd>Set the file transfer <code class="Ic">type</code> to 1010 <var class="Ar">type-name</var>. If no type is specified, the current type 1011 is printed. The default type is “binary”.</dd> 1012 <dt id="umask"><a class="permalink" href="#umask"><code class="Ic">umask</code></a> 1013 [<var class="Ar">newmask</var>]</dt> 1014 <dd>Set the default umask on the remote server to 1015 <var class="Ar">newmask</var>. If <var class="Ar">newmask</var> is 1016 omitted, the current umask is printed.</dd> 1017 <dt id="user"><a class="permalink" href="#user"><code class="Ic">user</code></a> 1018 <var class="Ar">username</var> [<var class="Ar">password</var> 1019 [<var class="Ar">account</var>]]</dt> 1020 <dd>Identify yourself to the remote FTP server. If the 1021 <var class="Ar">password</var> is not specified and the server requires 1022 it, <code class="Nm">ftp</code> will prompt the user for it (after 1023 disabling local echo). If an <var class="Ar">account</var> field is not 1024 specified, and the FTP server requires it, the user will be prompted for 1025 it. If an <var class="Ar">account</var> field is specified, an account 1026 command will be relayed to the remote server after the login sequence is 1027 completed if the remote server did not require it for logging in. Unless 1028 <code class="Nm">ftp</code> is invoked with “auto-login” 1029 disabled, this process is done automatically on initial connection to the 1030 FTP server.</dd> 1031 <dt id="verbose"><a class="permalink" href="#verbose"><code class="Ic">verbose</code></a> 1032 [<code class="Ic">on</code> | <code class="Ic">off</code>]</dt> 1033 <dd>Toggle verbose mode. In verbose mode, all responses from the FTP server 1034 are displayed to the user. In addition, if verbose is on, when a file 1035 transfer completes, statistics regarding the efficiency of the transfer 1036 are reported. By default, verbose is on.</dd> 1037 </dl> 1038 <p class="Pp">Command arguments which have embedded spaces may be quoted with 1039 quote (‘<code class="Li">"</code>’) marks.</p> 1040 <p class="Pp">Commands which toggle settings can take an explicit 1041 <code class="Ic">on</code> or <code class="Ic">off</code> argument to force 1042 the setting appropriately.</p> 1043 <p class="Pp">If <code class="Nm">ftp</code> receives a 1044 <code class="Dv">SIGINFO</code> (see the “status” argument of 1045 <a class="Xr" href="/stty.1" aria-label="stty, section 1">stty(1)</a>) 1046 signal whilst a transfer is in progress, the current transfer rate 1047 statistics will be written to the standard error output, in the same format 1048 as the standard completion message.</p> 1049 </section> 1050 <section class="Sh"> 1051 <h2 class="Sh" id="AUTO-FETCHING_FILES"><a class="permalink" href="#AUTO-FETCHING_FILES">AUTO-FETCHING 1052 FILES</a></h2> 1053 <p class="Pp">In addition to standard commands, this version of 1054 <code class="Nm">ftp</code> supports an auto-fetch feature. To enable 1055 auto-fetch, simply pass the list of hostnames/files on the command line.</p> 1056 <p class="Pp">The following formats are valid syntax for an auto-fetch 1057 element:</p> 1058 <dl class="Bl-tag"> 1059 <dt><var class="Ar">host</var>:/<var class="Ar">file</var>[/]</dt> 1060 <dd>“Classic” <code class="Nm">ftp</code> format.</dd> 1061 <dt>ftp://[<var class="Ar">user</var>:<var class="Ar">password</var><span class="No">@</span>]<var class="Ar">host</var>[:<var class="Ar">port</var>]<span class="No">/</span><var class="Ar">file</var>[/]</dt> 1062 <dd> An FTP URL, retrieved using the FTP protocol if 1063 <code class="Ev">ftp_proxy</code> isn't defined. Otherwise, transfer using 1064 HTTP via the proxy defined in <code class="Ev">ftp_proxy</code>. If a 1065 <var class="Ar">user</var> and <var class="Ar">password</var> are given 1066 and <code class="Ev">ftp_proxy</code> isn't defined, log in as 1067 <var class="Ar">user</var> with a password of 1068 <var class="Ar">password</var>.</dd> 1069 <dt>http://[<var class="Ar">user</var>:<var class="Ar">password</var><span class="No">@</span>]<var class="Ar">host</var>[:<var class="Ar">port</var>]<span class="No">/</span><var class="Ar">file</var></dt> 1070 <dd> An HTTP URL, retrieved using the HTTP protocol. If 1071 <code class="Ev">http_proxy</code> is defined, it is used as a URL to an 1072 HTTP proxy server. If a <var class="Ar">user</var> and 1073 <var class="Ar">password</var> are given and 1074 <code class="Ev">http_proxy</code> isn't defined, log in as 1075 <var class="Ar">user</var> with a password of 1076 <var class="Ar">password</var> using Basic authentication.</dd> 1077 <dt>https://[<var class="Ar">user</var>:<var class="Ar">password</var><span class="No">@</span>]<var class="Ar">host</var>[:<var class="Ar">port</var>]<span class="No">/</span><var class="Ar">file</var></dt> 1078 <dd> An HTTPS URL, retrieved using the HTTPS protocol. If 1079 <code class="Ev">http_proxy</code> is defined, this HTTPS proxy server 1080 will be used to fetch the file using the CONNECT method. If a 1081 <var class="Ar">user</var> and <var class="Ar">password</var> are given 1082 and <code class="Ev">http_proxy</code> isn't defined, log in as 1083 <var class="Ar">user</var> with a password of 1084 <var class="Ar">password</var> using Basic authentication.</dd> 1085 <dt>file:<var class="Ar">file</var></dt> 1086 <dd><var class="Ar">file</var> is retrieved from a mounted file system.</dd> 1087 </dl> 1088 <p class="Pp">If a classic format or an FTP URL format has a trailing 1089 ‘/’, then <code class="Nm">ftp</code> will connect to the site 1090 and <code class="Ic">cd</code> to the directory given as the path, and leave 1091 the user in interactive mode ready for further input.</p> 1092 <p class="Pp">If <var class="Ar">file</var> contains a glob character and 1093 globbing is enabled (see <code class="Ic">glob</code>), then the equivalent 1094 of <code class="Ic">mget</code> <var class="Ar">file</var> is performed.</p> 1095 <p class="Pp">If no <code class="Fl">-o</code> option is specified, and the 1096 directory component of <var class="Ar">file</var> contains no globbing 1097 characters, then it is stored in the current directory as the 1098 <a class="Xr" href="/basename.1" aria-label="basename, section 1099 1">basename(1)</a> of <var class="Ar">file</var>. If 1100 <code class="Fl">-o</code> <var class="Ar">output</var> is specified, then 1101 <var class="Ar">file</var> is stored as <var class="Ar">output</var>. 1102 Otherwise, the remote name is used as the local name.</p> 1103 </section> 1104 <section class="Sh"> 1105 <h2 class="Sh" id="ABORTING_A_FILE_TRANSFER"><a class="permalink" href="#ABORTING_A_FILE_TRANSFER">ABORTING 1106 A FILE TRANSFER</a></h2> 1107 <p class="Pp">To abort a file transfer, use the terminal interrupt key (usually 1108 Ctrl-C). Sending transfers will be immediately halted. Receiving transfers 1109 will be halted by sending an FTP protocol <code class="Dv">ABOR</code> 1110 command to the remote server, and discarding any further data received. The 1111 speed at which this is accomplished depends upon the remote server's support 1112 for <code class="Dv">ABOR</code> processing. If the remote server does not 1113 support the <code class="Dv">ABOR</code> command, an 1114 ‘<code class="Li">ftp></code>’ prompt will not appear until 1115 the remote server has completed sending the requested file.</p> 1116 <p class="Pp">The terminal interrupt key sequence will be ignored when 1117 <code class="Nm">ftp</code> has completed any local processing and is 1118 awaiting a reply from the remote server. A long delay in this mode may 1119 result from the ABOR processing described above, or from unexpected behavior 1120 by the remote server, including violations of the FTP protocol. If the delay 1121 results from unexpected remote server behavior, the local 1122 <code class="Nm">ftp</code> program must be killed by hand.</p> 1123 </section> 1124 <section class="Sh"> 1125 <h2 class="Sh" id="FILE_NAMING_CONVENTIONS"><a class="permalink" href="#FILE_NAMING_CONVENTIONS">FILE 1126 NAMING CONVENTIONS</a></h2> 1127 <p class="Pp">Files specified as arguments to <code class="Nm">ftp</code> 1128 commands are processed according to the following rules.</p> 1129 <ol class="Bl-enum"> 1130 <li>If ‘-’ is specified as a local file name, the standard input 1131 (for reading) or standard output (for writing) is used.</li> 1132 <li>If the first character of a local file name is ‘|’, the 1133 remainder of the argument is interpreted as a shell command. 1134 <code class="Nm">ftp</code> then forks a shell, using 1135 <a class="Xr" href="/popen.3" aria-label="popen, section 3">popen(3)</a> 1136 with the argument supplied, and reads (writes) from the standard output 1137 (standard input). If the shell command includes spaces, the argument must 1138 be quoted; e.g., "ls -lt". A particularly useful example of this 1139 mechanism is: "ls . |more".</li> 1140 <li>Failing the above checks, if “globbing” is enabled, local 1141 file names are expanded according to the rules used in the 1142 <a class="Xr" href="/csh.1" aria-label="csh, section 1">csh(1)</a> 1143 <code class="Ic">glob</code> command. If the <code class="Nm">ftp</code> 1144 command expects a single local file (e.g., <code class="Ic">put</code>), 1145 only the first filename generated by the “globbing” 1146 operation is used.</li> 1147 <li>For <code class="Ic">mget</code> commands and <code class="Ic">get</code> 1148 commands with unspecified local file names, the local filename is the 1149 remote filename, which may be altered by a <code class="Ic">case</code>, 1150 <code class="Ic">ntrans</code>, or <code class="Ic">nmap</code> setting. 1151 The resulting filename may then be altered if 1152 <code class="Ic">runique</code> is on.</li> 1153 <li>For <code class="Ic">mput</code> commands and <code class="Ic">put</code> 1154 commands with unspecified remote file names, the remote filename is the 1155 local filename, which may be altered by a <code class="Ic">ntrans</code> 1156 or <code class="Ic">nmap</code> setting. The resulting filename may then 1157 be altered by the remote server if <code class="Ic">sunique</code> is 1158 on.</li> 1159 </ol> 1160 </section> 1161 <section class="Sh"> 1162 <h2 class="Sh" id="FILE_TRANSFER_PARAMETERS"><a class="permalink" href="#FILE_TRANSFER_PARAMETERS">FILE 1163 TRANSFER PARAMETERS</a></h2> 1164 <p class="Pp">The FTP specification specifies many parameters which may affect a 1165 file transfer. The <code class="Ic">type</code> may be one of 1166 “ascii”, “binary”, or “image”. 1167 <code class="Nm">ftp</code> supports the ASCII and image types of file 1168 transfer.</p> 1169 <p class="Pp"><code class="Nm">ftp</code> supports only the default values for 1170 the remaining file transfer parameters: <code class="Ic">mode</code>, 1171 <code class="Ic">form</code>, and <code class="Ic">struct</code>.</p> 1172 </section> 1173 <section class="Sh"> 1174 <h2 class="Sh" id="THE_.netrc_FILE"><a class="permalink" href="#THE_.netrc_FILE">THE 1175 .netrc FILE</a></h2> 1176 <p class="Pp">The <span class="Pa">.netrc</span> file contains login and 1177 initialization information used by the auto-login process. It resides in the 1178 user's home directory. The following tokens are recognized; they may be 1179 separated by spaces, tabs, or new-lines:</p> 1180 <dl class="Bl-tag"> 1181 <dt id="machine"><a class="permalink" href="#machine"><code class="Ic">machine</code></a> 1182 <var class="Ar">name</var></dt> 1183 <dd>Identify a remote machine <var class="Ar">name</var>. The auto-login 1184 process searches the <span class="Pa">.netrc</span> file for a 1185 <code class="Ic">machine</code> token that matches the remote machine 1186 specified on the <code class="Nm">ftp</code> command line or as an 1187 <code class="Ic">open</code> command argument. Once a match is made, the 1188 subsequent <span class="Pa">.netrc</span> tokens are processed, stopping 1189 when the end of file is reached or another <code class="Ic">machine</code> 1190 or a <code class="Ic">default</code> token is encountered.</dd> 1191 <dt id="default"><a class="permalink" href="#default"><code class="Ic">default</code></a></dt> 1192 <dd>This is the same as <code class="Ic">machine</code> 1193 <var class="Ar">name</var> except that <code class="Ic">default</code> 1194 matches any name. There can be only one <code class="Ic">default</code> 1195 token, and it must be after all <code class="Ic">machine</code> tokens. 1196 This is normally used as: 1197 <p class="Pp"></p> 1198 <div class="Bd Bd-indent"><code class="Li">default login anonymous password 1199 user@site</code></div> 1200 <p class="Pp">thereby giving the user <var class="Ar">automatic</var> 1201 anonymous FTP login to machines not specified in 1202 <span class="Pa">.netrc</span>. This can be overridden by using the 1203 <code class="Fl">-n</code> flag to disable auto-login.</p> 1204 </dd> 1205 <dt id="login"><a class="permalink" href="#login"><code class="Ic">login</code></a> 1206 <var class="Ar">name</var></dt> 1207 <dd>Identify a user on the remote machine. If this token is present, the 1208 auto-login process will initiate a login using the specified 1209 <var class="Ar">name</var>.</dd> 1210 <dt id="password"><a class="permalink" href="#password"><code class="Ic">password</code></a> 1211 <var class="Ar">string</var></dt> 1212 <dd>Supply a password. If this token is present, the auto-login process will 1213 supply the specified string if the remote server requires a password as 1214 part of the login process. Note that if this token is present in the 1215 <span class="Pa">.netrc</span> file for any user other than 1216 <var class="Ar">anonymous</var>, <code class="Nm">ftp</code> will abort 1217 the auto-login process if the <span class="Pa">.netrc</span> is readable 1218 by anyone besides the user.</dd> 1219 <dt id="account~2"><a class="permalink" href="#account~2"><code class="Ic">account</code></a> 1220 <var class="Ar">string</var></dt> 1221 <dd>Supply an additional account password. If this token is present, the 1222 auto-login process will supply the specified string if the remote server 1223 requires an additional account password, or the auto-login process will 1224 initiate an <code class="Dv">ACCT</code> command if it does not.</dd> 1225 <dt id="macdef~2"><a class="permalink" href="#macdef~2"><code class="Ic">macdef</code></a> 1226 <var class="Ar">name</var></dt> 1227 <dd>Define a macro. This token functions like the <code class="Nm">ftp</code> 1228 <code class="Ic">macdef</code> command functions. A macro is defined with 1229 the specified name; its contents begin with the next 1230 <span class="Pa">.netrc</span> line and continue until a null line 1231 (consecutive new-line characters) is encountered. Like the other tokens in 1232 the <span class="Pa">.netrc</span> file, a <code class="Ic">macdef</code> 1233 is applicable only to the <code class="Ic">machine</code> definition 1234 preceding it. A <code class="Ic">macdef</code> entry cannot be utilized by 1235 multiple <code class="Ic">machine</code> definitions; rather, it must be 1236 defined following each <code class="Ic">machine</code> it is intended to 1237 be used with. If a macro named <code class="Ic">init</code> is defined, it 1238 is automatically executed as the last step in the auto-login process.</dd> 1239 </dl> 1240 </section> 1241 <section class="Sh"> 1242 <h2 class="Sh" id="COMMAND_LINE_EDITING"><a class="permalink" href="#COMMAND_LINE_EDITING">COMMAND 1243 LINE EDITING</a></h2> 1244 <p class="Pp"><code class="Nm">ftp</code> supports interactive command line 1245 editing, via the <a class="Xr" href="/editline.3" aria-label="editline, 1246 section 3">editline(3)</a> library. It is enabled with the 1247 <code class="Ic">edit</code> command, and is enabled by default if input is 1248 from a tty. Previous lines can be recalled and edited with the arrow keys, 1249 and other GNU Emacs-style editing keys may be used as well.</p> 1250 <p class="Pp">The <a class="Xr" href="/editline.3" aria-label="editline, section 1251 3">editline(3)</a> library is configured with a 1252 <span class="Pa">.editrc</span> file - refer to 1253 <a class="Xr" href="/editrc.5" aria-label="editrc, section 5">editrc(5)</a> 1254 for more information.</p> 1255 <p class="Pp">An extra key binding is available to <code class="Nm">ftp</code> 1256 to provide context sensitive command and filename completion (including 1257 remote file completion). To use this, bind a key to the 1258 <a class="Xr" href="/editline.3" aria-label="editline, section 1259 3">editline(3)</a> command <code class="Ic">ftp-complete</code>. By default, 1260 this is bound to the TAB key.</p> 1261 </section> 1262 <section class="Sh"> 1263 <h2 class="Sh" id="ENVIRONMENT"><a class="permalink" href="#ENVIRONMENT">ENVIRONMENT</a></h2> 1264 <p class="Pp"><code class="Nm">ftp</code> utilizes the following environment 1265 variables:</p> 1266 <dl class="Bl-tag"> 1267 <dt id="FTPMODE"><a class="permalink" href="#FTPMODE"><code class="Ev">FTPMODE</code></a></dt> 1268 <dd>Overrides the default operation mode. Recognized values are: 1269 <p class="Pp"></p> 1270 <div class="Bd-indent"> 1271 <dl class="Bl-tag Bl-compact"> 1272 <dt>passive</dt> 1273 <dd>passive mode FTP only</dd> 1274 <dt>active</dt> 1275 <dd>active mode FTP only</dd> 1276 <dt>auto</dt> 1277 <dd>automatic determination of passive or active (this is the 1278 default)</dd> 1279 <dt>gate</dt> 1280 <dd>gate-ftp mode</dd> 1281 </dl> 1282 </div> 1283 </dd> 1284 <dt id="FTPSERVER"><a class="permalink" href="#FTPSERVER"><code class="Ev">FTPSERVER</code></a></dt> 1285 <dd>Host to use as gate-ftp server when <code class="Ic">gate</code> is 1286 enabled.</dd> 1287 <dt id="FTPSERVERPORT"><a class="permalink" href="#FTPSERVERPORT"><code class="Ev">FTPSERVERPORT</code></a></dt> 1288 <dd>Port to use when connecting to gate-ftp server when 1289 <code class="Ic">gate</code> is enabled. Default is port returned by a 1290 <code class="Fn">getservbyname</code>() lookup of 1291 “ftpgate/tcp”.</dd> 1292 <dt id="HOME"><a class="permalink" href="#HOME"><code class="Ev">HOME</code></a></dt> 1293 <dd>For default location of a <span class="Pa">.netrc</span> file, if one 1294 exists.</dd> 1295 <dt id="PAGER"><a class="permalink" href="#PAGER"><code class="Ev">PAGER</code></a></dt> 1296 <dd>Used by <code class="Ic">page</code> to display files.</dd> 1297 <dt id="SHELL"><a class="permalink" href="#SHELL"><code class="Ev">SHELL</code></a></dt> 1298 <dd>For default shell.</dd> 1299 <dt id="ftp_proxy"><a class="permalink" href="#ftp_proxy"><code class="Ev">ftp_proxy</code></a></dt> 1300 <dd>URL of FTP proxy to use when making FTP URL requests (if not defined, use 1301 the standard FTP protocol).</dd> 1302 <dt id="http_proxy"><a class="permalink" href="#http_proxy"><code class="Ev">http_proxy</code></a></dt> 1303 <dd>URL of HTTP proxy to use when making HTTP or HTTPS URL requests.</dd> 1304 <dt id="http_cookies"><a class="permalink" href="#http_cookies"><code class="Ev">http_cookies</code></a></dt> 1305 <dd>Path of a Netscape-like cookiejar file to use when making HTTP or HTTPS 1306 URL requests.</dd> 1307 </dl> 1308 </section> 1309 <section class="Sh"> 1310 <h2 class="Sh" id="PORT_ALLOCATION"><a class="permalink" href="#PORT_ALLOCATION">PORT 1311 ALLOCATION</a></h2> 1312 <p class="Pp">For active mode data connections, <code class="Nm">ftp</code> will 1313 listen to a random high TCP port. The interval of ports used are 1314 configurable using <a class="Xr" href="/sysctl.8" aria-label="sysctl, 1315 section 8">sysctl(8)</a> variables 1316 <var class="Va">net.inet.ip.porthifirst</var> and 1317 <var class="Va">net.inet.ip.porthilast</var>.</p> 1318 </section> 1319 <section class="Sh"> 1320 <h2 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE 1321 ALSO</a></h2> 1322 <p class="Pp"><a class="Xr" href="/basename.1" aria-label="basename, section 1323 1">basename(1)</a>, <a class="Xr" href="/csh.1" aria-label="csh, section 1324 1">csh(1)</a>, <a class="Xr" href="/more.1" aria-label="more, section 1325 1">more(1)</a>, <a class="Xr" href="/stty.1" aria-label="stty, section 1326 1">stty(1)</a>, <a class="Xr" href="/tar.1" aria-label="tar, section 1327 1">tar(1)</a>, <a class="Xr" href="/tftp.1" aria-label="tftp, section 1328 1">tftp(1)</a>, <a class="Xr" href="/editline.3" aria-label="editline, 1329 section 3">editline(3)</a>, 1330 <a class="Xr" href="/getservbyname.3" aria-label="getservbyname, section 1331 3">getservbyname(3)</a>, <a class="Xr" href="/popen.3" aria-label="popen, 1332 section 3">popen(3)</a>, <a class="Xr" href="/editrc.5" aria-label="editrc, 1333 section 5">editrc(5)</a>, 1334 <a class="Xr" href="/services.5" aria-label="services, section 1335 5">services(5)</a>, <a class="Xr" href="/ftp-proxy.8" aria-label="ftp-proxy, 1336 section 8">ftp-proxy(8)</a>, <a class="Xr" href="/ftpd.8" aria-label="ftpd, 1337 section 8">ftpd(8)</a></p> 1338 </section> 1339 <section class="Sh"> 1340 <h2 class="Sh" id="STANDARDS"><a class="permalink" href="#STANDARDS">STANDARDS</a></h2> 1341 <p class="Pp"><cite class="Rs"><span class="RsA">J. Postel</span> and 1342 <span class="RsA">J. Reynolds</span>, <span class="RsT">FILE TRANSFER 1343 PROTOCOL (FTP)</span>, <span class="RsR">RFC 959</span>, 1344 <span class="RsD">October 1985</span>.</cite></p> 1345 <p class="Pp"><cite class="Rs"><span class="RsA">P. Hethmon</span>, 1346 <span class="RsT">Extensions to FTP</span>, <span class="RsR">RFC 1347 3659</span>, <span class="RsD">March 2007</span>.</cite></p> 1348 </section> 1349 <section class="Sh"> 1350 <h2 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h2> 1351 <p class="Pp">The <code class="Nm">ftp</code> command appeared in 1352 <span class="Ux">4.2BSD</span>.</p> 1353 </section> 1354 <section class="Sh"> 1355 <h2 class="Sh" id="BUGS"><a class="permalink" href="#BUGS">BUGS</a></h2> 1356 <p class="Pp">Correct execution of many commands depends upon proper behavior by 1357 the remote server.</p> 1358 <p class="Pp">In the recursive mode of <code class="Ic">mget</code>, files and 1359 directories starting with whitespace are ignored because the list cannot be 1360 parsed any other way.</p> 1361 </section> 1362 </main> 1363 <div class="foot" role="doc-pagefooter" aria-label="Manual footer 1364 line"><span class="foot-left"></span><span class="foot-date">September 15, 1365 2022</span> <span class="foot-os">OpenBSD-current</span></div> 1366 </body> 1367 </html>