version 1.28, 2000/02/29 04:52:37 |
version 1.29, 2000/03/07 21:11:09 |
|
|
.Pp |
.Pp |
The latter three usage formats will fetch a file using either the |
The latter three usage formats will fetch a file using either the |
HTTP or FTP protocols into the current directory. |
HTTP or FTP protocols into the current directory. |
This is ideal for scripts. Refer to |
This is ideal for scripts. |
|
Refer to |
.Sx AUTO-FETCHING FILES |
.Sx AUTO-FETCHING FILES |
below for more information. |
below for more information. |
.Pp |
.Pp |
The options are as follows: |
The options are as follows: |
.Bl -tag -width "port " |
.Bl -tag -width "port " |
.It Fl A |
.It Fl A |
Force active mode ftp. By default, |
Force active mode ftp. |
|
By default, |
.Nm |
.Nm |
will try to use passive mode ftp and fall back to active mode |
will try to use passive mode ftp and fall back to active mode |
if passive is not supported by the server. This option causes |
if passive is not supported by the server. |
|
This option causes |
.Nm |
.Nm |
to always use an active connection. It is only useful for connecting |
to always use an active connection. |
|
It is only useful for connecting |
to very old servers that do not implement passive mode properly. |
to very old servers that do not implement passive mode properly. |
.It Fl a |
.It Fl a |
Causes |
Causes |
|
|
.It Fl d |
.It Fl d |
Enables debugging. |
Enables debugging. |
.It Fl e |
.It Fl e |
Disables command line editing. Useful for Emacs ange-ftp. |
Disables command line editing. |
|
Useful for Emacs ange-ftp. |
.It Fl g |
.It Fl g |
Disables file name globbing. |
Disables file name globbing. |
.It Fl i |
.It Fl i |
|
|
When |
When |
.Nm |
.Nm |
is awaiting commands the prompt |
is awaiting commands the prompt |
.Ql ftp> |
.Dq ftp> |
is provided to the user. |
is provided to the user. |
The following commands are recognized |
The following commands are recognized |
by |
by |
|
|
.Ic nmap |
.Ic nmap |
setting. |
setting. |
File transfer uses the current settings for |
File transfer uses the current settings for |
.Ic type , |
.Ic type , |
.Ic format , |
.Ic format , |
.Ic mode , |
.Ic mode , |
and |
and |
.Ic structure . |
.Ic structure . |
.It Ic ascii |
.It Ic ascii |
|
|
.Nm |
.Nm |
prints each command sent to the remote machine, |
prints each command sent to the remote machine, |
preceded by the string |
preceded by the string |
.Ql \-\-> |
.Ql \-\-> . |
.It Ic dir Op Ar remote-directory Op Ar local-file |
.It Ic dir Op Ar remote-directory Op Ar local-file |
Print a listing of the contents of a |
Print a listing of the contents of a |
directory on the remote machine. |
directory on the remote machine. |
|
|
If no local file is specified, or if |
If no local file is specified, or if |
.Ar local-file |
.Ar local-file |
is |
is |
.Sq Fl , |
.Dq - , |
the output is sent to the terminal. |
the output is sent to the terminal. |
.It Ic disconnect |
.It Ic disconnect |
A synonym for |
A synonym for |
|
|
file name is not specified, it is given the same |
file name is not specified, it is given the same |
name it has on the remote machine, subject to |
name it has on the remote machine, subject to |
alteration by the current |
alteration by the current |
.Ic case , |
.Ic case , |
.Ic ntrans , |
.Ic ntrans , |
and |
and |
.Ic nmap |
.Ic nmap |
settings. |
settings. |
The current settings for |
The current settings for |
.Ic type , |
.Ic type , |
.Ic form , |
.Ic form , |
.Ic mode , |
.Ic mode , |
and |
and |
.Ic structure |
.Ic structure |
are used while transferring the file. |
are used while transferring the file. |
|
|
gate-ftp server. |
gate-ftp server. |
.It Ic glob |
.It Ic glob |
Toggle filename expansion for |
Toggle filename expansion for |
.Ic mdelete , |
.Ic mdelete , |
.Ic mget |
.Ic mget |
and |
and |
.Ic mput . |
.Ic mput . |
If globbing is turned off with |
If globbing is turned off with |
.Ic glob , |
.Ic glob , |
the file name arguments |
the file name arguments |
are taken literally and not expanded. |
are taken literally and not expanded. |
Globbing for |
Globbing for |
|
|
For |
For |
.Ic mdelete |
.Ic mdelete |
and |
and |
.Ic mget , |
.Ic mget , |
each remote file name is expanded |
each remote file name is expanded |
separately on the remote machine and the lists are not merged. |
separately on the remote machine and the lists are not merged. |
Expansion of a directory name is likely to be |
Expansion of a directory name is likely to be |
|
|
.Xr tar 1 |
.Xr tar 1 |
archive of the subtree (in binary mode). |
archive of the subtree (in binary mode). |
.It Ic hash Op Ar size |
.It Ic hash Op Ar size |
Toggle hash-sign (``#'') printing for each data block |
Toggle hash mark |
transferred. |
.Pq Ql # |
|
printing for each data block transferred. |
The size of a data block defaults to 1024 bytes. |
The size of a data block defaults to 1024 bytes. |
This can be changed by specifying |
This can be changed by specifying |
.Ar size |
.Ar size |
|
|
If no local file is specified, or if |
If no local file is specified, or if |
.Ar local-file |
.Ar local-file |
is |
is |
.Fl , |
.Dq - , |
the output is sent to the terminal. |
the output is sent to the terminal. |
.It Ic macdef Ar macro-name |
.It Ic macdef Ar macro-name |
Define a macro. |
Define a macro. |
Subsequent lines are stored as the macro |
Subsequent lines are stored as the macro |
.Ar macro-name ; |
.Ar macro-name ; |
a null line (consecutive newline characters |
a null line (consecutive newline characters |
in a file or |
in a file or |
carriage returns from the terminal) terminates macro input mode. |
carriage returns from the terminal) terminates macro input mode. |
|
|
Macros remain defined until a |
Macros remain defined until a |
.Ic close |
.Ic close |
command is executed. |
command is executed. |
The macro processor interprets `$' and `\e' as special characters. |
The macro processor interprets |
A `$' followed by a number (or numbers) is replaced by the |
.Ql $ |
|
and |
|
.Ql \e |
|
as special characters. |
|
A |
|
.Ql $ |
|
followed by a number (or numbers) is replaced by the |
corresponding argument on the macro invocation command line. |
corresponding argument on the macro invocation command line. |
A `$' followed by an `i' tells the macro processor that the |
A |
|
.Ql $ |
|
followed by an |
|
.Sq i |
|
tells the macro processor that the |
executing macro is to be looped. |
executing macro is to be looped. |
On the first pass `$i' is |
On the first pass |
|
.Ql $i |
|
is |
replaced by the first argument on the macro invocation command line, |
replaced by the first argument on the macro invocation command line, |
on the second pass it is replaced by the second argument, and so on. |
on the second pass it is replaced by the second argument, and so on. |
A `\e' followed by any character is replaced by that character. |
A |
Use the `\e' to prevent special treatment of the `$'. |
.Ql \e |
|
followed by any character is replaced by that character. |
|
Use the |
|
.Ql \e |
|
to prevent special treatment of the |
|
.Ql $ . |
.It Ic mdelete Op Ar remote-files |
.It Ic mdelete Op Ar remote-files |
Delete the |
Delete the |
.Ar remote-files |
.Ar remote-files |
on the remote machine. |
on the remote machine. |
.It Ic mdir Ar remote-files local-file |
.It Ic mdir Ar remote-files local-file |
Like |
Like |
.Ic dir , |
.Ic dir , |
except multiple remote files may be specified. |
except multiple remote files may be specified. |
If interactive prompting is on, |
If interactive prompting is on, |
.Nm |
.Nm |
|
|
.Ic glob |
.Ic glob |
for details on the filename expansion. |
for details on the filename expansion. |
Resulting file names will then be processed according to |
Resulting file names will then be processed according to |
.Ic case , |
.Ic case , |
.Ic ntrans , |
.Ic ntrans , |
and |
and |
.Ic nmap |
.Ic nmap |
|
|
Make a directory on the remote machine. |
Make a directory on the remote machine. |
.It Ic mls Ar remote-files local-file |
.It Ic mls Ar remote-files local-file |
Like |
Like |
.Ic ls , |
.Ic ls , |
except multiple remote files may be specified, |
except multiple remote files may be specified, |
and the |
and the |
.Ar local-file |
.Ar local-file |
|
|
.Ic case |
.Ic case |
settings). |
settings). |
Variable templating is accomplished by including the |
Variable templating is accomplished by including the |
sequences `$1', `$2', ..., `$9' in |
sequences |
|
.Ql $1 , |
|
.Ql $2 , |
|
..., |
|
.Ql $9 |
|
in |
.Ar inpattern . |
.Ar inpattern . |
Use `\\' to prevent this special treatment of the `$' character. |
Use |
|
.Ql \e |
|
to prevent this special treatment of the |
|
.Ql $ |
|
character. |
All other characters are treated literally, and are used to determine the |
All other characters are treated literally, and are used to determine the |
.Ic nmap |
.Ic nmap |
.Ar inpattern |
.Ar inpattern |
|
|
The |
The |
.Ar outpattern |
.Ar outpattern |
determines the resulting mapped filename. |
determines the resulting mapped filename. |
The sequences `$1', `$2', ...., `$9' are replaced by any value resulting |
The sequences |
from the |
.Ql $1 , |
|
.Ql $2 , |
|
..., |
|
.Ql $9 |
|
are replaced by any value resulting from the |
.Ar inpattern |
.Ar inpattern |
template. |
template. |
The sequence `$0' is replaced by the original filename. |
The sequence |
|
.Ql $0 |
|
is replaced by the original filename. |
Additionally, the sequence |
Additionally, the sequence |
.Ql Op Ar seq1 , Ar seq2 |
.Ql Op Ar seq1 , Ar seq2 |
is replaced by |
is replaced by |
|
|
.Ed |
.Ed |
.Pp |
.Pp |
would yield |
would yield |
the output filename "myfile.data" for input filenames "myfile.data" and |
the output filename |
"myfile.data.old", "myfile.file" for the input filename "myfile", and |
.Pa myfile.data , |
"myfile.myfile" for the input filename ".myfile". |
for input filenames |
|
.Pa myfile.data |
|
and |
|
.Pa myfile.data.old , |
|
.Pa myfile.file |
|
for the input filename |
|
.Pa myfile , |
|
and |
|
.Pa myfile.myfile |
|
for the input filename |
|
.Pa \&.myfile . |
Spaces may be included in |
Spaces may be included in |
.Ar outpattern , |
.Ar outpattern , |
as in the example: `nmap $1 sed "s/ *$//" > $1' . |
as in the example |
Use the `\e' character to prevent special treatment |
.Pp |
of the `$','[','[', and `,' characters. |
.Bd -literal -offset indent -compact |
|
nmap $1 sed "s/ *$//" > $1 . |
|
.Ed |
|
.Pp |
|
Use the |
|
.Ql \e |
|
character to prevent special treatment |
|
of the |
|
.Ql $ , |
|
.Ql [ , |
|
.Ql \&] , |
|
and |
|
.Ql \&, |
|
characters. |
.It Ic ntrans Op Ar inchars Op Ar outchars |
.It Ic ntrans Op Ar inchars Op Ar outchars |
Set or unset the filename character translation mechanism. |
Set or unset the filename character translation mechanism. |
If no arguments are specified, the filename character |
If no arguments are specified, the filename character |
|
|
If the character's position in |
If the character's position in |
.Ar inchars |
.Ar inchars |
is longer than the length of |
is longer than the length of |
.Ar outchars , |
.Ar outchars , |
the character is deleted from the file name. |
the character is deleted from the file name. |
.It Ic open Ar host Op Ar port |
.It Ic open Ar host Op Ar port |
Establish a connection to the specified |
Establish a connection to the specified |
|
|
.Ev PAGER |
.Ev PAGER |
is null or not defined). |
is null or not defined). |
.It Ic passive |
.It Ic passive |
Toggle passive mode. If passive mode is turned on |
Toggle passive mode. |
(default is on), the ftp client will |
If passive mode is turned on (default is on), the ftp client will |
send a |
send a |
.Dv PASV |
.Dv PASV |
command for all data connections instead of the usual |
command for all data connections instead of the usual |
.Dv PORT |
.Dv PORT |
command. The |
command. |
|
The |
.Dv PASV |
.Dv PASV |
command requests that the remote server open a port for the data connection |
command requests that the remote server open a port for the data connection |
and return the address of that port. The remote server listens on that |
and return the address of that port. |
port and the client connects to it. When using the more traditional |
The remote server listens on that port and the client connects to it. |
|
When using the more traditional |
.Dv PORT |
.Dv PORT |
command, the client listens on a port and sends that address to the remote |
command, the client listens on a port and sends that address to the remote |
server, who connects back to it. Passive mode is useful when using |
server, who connects back to it. |
|
Passive mode is useful when using |
.Nm |
.Nm |
through a gateway router or host that controls the directionality of |
through a gateway router or host that controls the directionality of |
traffic. |
traffic. |
|
|
The progress bar will be disabled for a transfer that has |
The progress bar will be disabled for a transfer that has |
.Ar local-file |
.Ar local-file |
as |
as |
.Sq Fl |
.Dq - |
or a command that starts with |
or a command that starts with |
.Sq \&| . |
.Sq \&| . |
Refer to |
Refer to |
|
|
The first |
The first |
.Ic proxy |
.Ic proxy |
command should be an |
command should be an |
.Ic open , |
.Ic open , |
to establish the secondary control connection. |
to establish the secondary control connection. |
Enter the command "proxy ?" to see other ftp commands executable on the |
Enter the command |
|
.Ic proxy ? |
|
to see other ftp commands executable on the |
secondary connection. |
secondary connection. |
The following commands behave differently when prefaced by |
The following commands behave differently when prefaced by |
.Ic proxy : |
.Ic proxy : |
.Ic open |
.Ic open |
will not define new macros during the auto-login process, |
will not define new macros during the auto-login process, |
.Ic close |
.Ic close |
|
|
.Ic mget |
.Ic mget |
transfer files from the host on the primary control connection |
transfer files from the host on the primary control connection |
to the host on the secondary control connection, and |
to the host on the secondary control connection, and |
.Ic put , |
.Ic put , |
.Ic mput , |
.Ic mput , |
and |
and |
.Ic append |
.Ic append |
|
|
in naming the remote file. |
in naming the remote file. |
File transfer uses the |
File transfer uses the |
current settings for |
current settings for |
.Ic type , |
.Ic type , |
.Ic format , |
.Ic format , |
.Ic mode , |
.Ic mode , |
and |
and |
.Ic structure . |
.Ic structure . |
.It Ic pwd |
.It Ic pwd |
|
|
.Ar local-file |
.Ar local-file |
exists and is |
exists and is |
smaller than |
smaller than |
.Ar remote-file , |
.Ar remote-file , |
.Ar local-file |
.Ar local-file |
is presumed to be |
is presumed to be |
a partially transferred copy of |
a partially transferred copy of |
|
|
.Ic get |
.Ic get |
or |
or |
.Ic mget |
.Ic mget |
command, a ".1" is appended to the name. |
command, a |
|
.Dq \&.1 |
|
is appended to the name. |
If the resulting name matches another existing file, |
If the resulting name matches another existing file, |
a ".2" is appended to the original name. |
a |
If this process continues up to ".99", an error |
.Dq \&.2 |
|
is appended to the original name. |
|
If this process continues up to |
|
.Dq \&.99 , |
|
an error |
message is printed, and the transfer does not take place. |
message is printed, and the transfer does not take place. |
The generated unique filename will be reported. |
The generated unique filename will be reported. |
Note that |
Note that |
|
|
.El |
.El |
.Pp |
.Pp |
Command arguments which have embedded spaces may be quoted with |
Command arguments which have embedded spaces may be quoted with |
quote `"' marks. |
quote |
|
.Pq Ql " |
|
marks. |
.Pp |
.Pp |
Commands which toggle settings can take an explicit |
Commands which toggle settings can take an explicit |
.Ic on |
.Ic on |
|
|
.Bl -enum |
.Bl -enum |
.It |
.It |
If the file name |
If the file name |
.Sq Fl |
.Dq - |
is specified, the stdin |
is specified, the standard input (for reading) |
(for reading) or stdout |
or standard output (for writing) |
(for writing) is used. |
is used. |
.It |
.It |
If the first character of the file name is |
If the first character of the file name is |
.Sq \&| , |
.Sq \&| , |
|
|
.Nm |
.Nm |
then forks a shell, using |
then forks a shell, using |
.Xr popen 3 |
.Xr popen 3 |
with the argument supplied, and reads (writes) from the stdout |
with the argument supplied, and reads (writes) from the standard output |
(stdin). |
(standard input). |
If the shell command includes spaces, the argument |
If the shell command includes spaces, the argument |
must be quoted; e.g. |
must be quoted; e.g., |
\*(Lq" ls -lt"\*(Rq. |
\*(Lq" ls -lt"\*(Rq. |
A particularly |
A particularly |
useful example of this mechanism is: \*(Lqdir \&|more\*(Rq. |
useful example of this mechanism is: \*(Lqdir \&|more\*(Rq. |
.It |
.It |
Failing the above checks, if ``globbing'' is enabled, |
Failing the above checks, if |
|
.Dq globbing |
|
is enabled, |
local file names are expanded |
local file names are expanded |
according to the rules used in the |
according to the rules used in the |
.Xr csh 1 ; |
.Xr csh 1 ; |
c.f. the |
c.f. the |
.Ic glob |
.Ic glob |
command. |
command. |
If the |
If the |
.Nm |
.Nm |
command expects a single local file (.e.g. |
command expects a single local file (e.g., |
.Ic put ) , |
.Ic put ) , |
only the first filename generated by the "globbing" operation is used. |
only the first filename generated by the |
|
.Dq globbing |
|
operation is used. |
.It |
.It |
For |
For |
.Ic mget |
.Ic mget |
|
|
.Ic get |
.Ic get |
commands with unspecified local file names, the local filename is |
commands with unspecified local file names, the local filename is |
the remote filename, which may be altered by a |
the remote filename, which may be altered by a |
.Ic case , |
.Ic case , |
.Ic ntrans , |
.Ic ntrans , |
or |
or |
.Ic nmap |
.Ic nmap |
|
|
.Nm |
.Nm |
supports only the default values for the remaining |
supports only the default values for the remaining |
file transfer parameters: |
file transfer parameters: |
.Ic mode , |
.Ic mode , |
.Ic form , |
.Ic form , |
and |
and |
.Ic struct . |
.Ic struct . |
|
|
.Pa .netrc |
.Pa .netrc |
file for any user other |
file for any user other |
than |
than |
.Ar anonymous , |
.Ar anonymous , |
.Nm |
.Nm |
will abort the auto-login process if the |
will abort the auto-login process if the |
.Pa .netrc |
.Pa .netrc |
|
|
utilizes the following environment variables: |
utilizes the following environment variables: |
.Bl -tag -width "FTPSERVERPORT" |
.Bl -tag -width "FTPSERVERPORT" |
.It Ev FTPMODE |
.It Ev FTPMODE |
Overrides the default operation mode. Recognized values are: |
Overrides the default operation mode. |
|
Recognized values are: |
.Bl -tag -width "passive " |
.Bl -tag -width "passive " |
.It passive |
.It passive |
passive mode ftp only |
passive mode ftp only |