summaryrefslogtreecommitdiffstats
path: root/usr.bin/fetch/fetch.1
blob: 55c1a3bba3c394d7788040250ab412c4c48355c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
.\" $FreeBSD$
.Dd July 2, 1996
.Dt FETCH 1
.Os
.Sh NAME
.Nm fetch
.Nd retrieve a file by Uniform Resource Locator
.Sh SYNOPSIS
.Nm fetch
.Op Fl MPmnpqr
.Op Fl o Ar file
.Ar URL
.Nm fetch
.Op Fl MPmnpqr
.Op Fl o Ar file
.Op Fl c Ar dir
.Fl f Ar file
.Fl h Ar host
.Sh DESCRIPTION
.Nm fetch
allows a user to transfer files from a remote network site using
either the
.Em ftp
or the
.Em http
protocol. In the first form of the command, the
.Ar URL
may be of the form 
.Em http://site.domain/path/to/the/file
or
.Em ftp://site.domain/path/to/the/file. 
For compatibility with 
.Xr tftp 1
the form 
.Em site.domain:/path/to/the/file
is also accepted.
To denote a local filename to be copied or linked to (see
.Fl l
flag), the
.Em file:/path/to/the/file
URL form is used.

The second form of the command can be used to get a file using the
.Em ftp
protocol, specifying the file name and the remote host with the 
.Fl h
and the 
.Fl f
flags.
.Pp
The following options are available:
.Bl -tag -width Fl -compact
.It Fl M
.It Fl m
Mirror mode: Set the modification time of the file so that it is
identical to the modification time of the file at the remote host.
If the file already exists on the local host and is identical (as
gauged by size and modification time), no transfer is done.
.It Fl n
Don't preserve the modtime of the transfered file, use the current time.
.It Fl P
.It Fl p
Use passive mode if you are behind a firewall.
.It Fl c Ar dir
Change to directory
.Ar dir
at remote host before starting the transfer.
.It Fl f Ar file
Retrieve 
.Ar file
on the remote host.
.It Fl h Ar host
Set the
.Ar host
for transfer.
.It Fl l
If target is a
.Ar file:/
style of URL, make a link to the target rather than trying
to copy it.
.It Fl T Ar seconds
Set timeout value to
.Ar seconds.
Overrides the environment variables
.Ev FTP_TIMEOUT
for ftp transfers or
.Ev HTTP_TIMEOUT 
for http transfers if set.
.It Fl q
Quiet mode. Do not report transfer progress on the terminal.
.It Fl v
Verbose mode - display FTP connection information in painful detail.
.It Fl r
Reget. Use this flag to restart an interrupted transfer.
.It Fl o Ar file
Set the output file name to 
.Ar file
.El
.Sh ENVIRONMENT
A transfer using the
.Em ftp
protocol will be aborted after the delay specified by the
.Ev FTP_TIMEOUT 
variable. The default is 300 (seconds)

A transfer using the
.Em http
protocol will be aborted after the delay specified by the
.Ev HTTP_TIMEOUT
variable. The default is 300 (seconds)

.Ev FTP_LOGIN
is the login name for the remote host. Default is
.Em anonymous

.Ev FTP_PASSWORD
is the password for the remote host. Default is
.Em <yourname>@

.Ev FTP_PASSIVE_MODE
will force the use of passive mode FTP for firewalls.

If
.Ev HTTP_PROXY
is set to a value of the form
.Em host:port
it specifies the address of a http proxy. The proxy will be used
for all ftp and http requests. This is useful if you are behind
an application firewall.
.Sh SEE ALSO
.Xr tftp 1 ,
.Xr ftp 1
.Sh HISTORY
The 
.Nm fetch
command appeared in
.Fx 2.1.5 .
OpenPOWER on IntegriCloud