4a32512758cc385c972bdfb0062ac5345e011618
[platform/upstream/curl.git] / docs / cmdline-opts / config.d
1 Long: config
2 Arg: <file>
3 Help: Read config from a file
4 Short: K
5 ---
6 Specify which config file to read curl arguments from. The config file is a
7 text file in which command line arguments can be written which then will be
8 used as if they were written on the actual command line.
9
10 Options and their parameters must be specified on the same config file line,
11 separated by whitespace, colon, or the equals sign. Long option names can
12 optionally be given in the config file without the initial double dashes and
13 if so, the colon or equals characters can be used as separators. If the option
14 is specified with one or two dashes, there can be no colon or equals character
15 between the option and its parameter.
16
17 If the parameter is to contain whitespace, the parameter must be enclosed
18 within quotes. Within double quotes, the following escape sequences are
19 available: \\\\, \\", \\t, \\n, \\r and \\v. A backslash preceding any other
20 letter is ignored. If the first column of a config line is a '#' character,
21 the rest of the line will be treated as a comment. Only write one option per
22 physical line in the config file.
23
24 Specify the filename to --config as '-' to make curl read the file from stdin.
25
26 Note that to be able to specify a URL in the config file, you need to specify
27 it using the --url option, and not by simply writing the URL on its own
28 line. So, it could look similar to this:
29
30 url = "https://curl.haxx.se/docs/"
31
32 When curl is invoked, it always (unless --disable is used) checks for a
33 default config file and uses it if found. The default config file is checked
34 for in the following places in this order:
35
36 1) curl tries to find the "home dir": It first checks for the CURL_HOME and
37 then the HOME environment variables. Failing that, it uses getpwuid() on
38 Unix-like systems (which returns the home dir given the current user in your
39 system). On Windows, it then checks for the APPDATA variable, or as a last
40 resort the '%USERPROFILE%\\Application Data'.
41
42 2) On windows, if there is no _curlrc file in the home dir, it checks for one
43 in the same dir the curl executable is placed. On Unix-like systems, it will
44 simply try to load .curlrc from the determined home dir.
45
46 .nf
47 # --- Example file ---
48 # this is a comment
49 url = "example.com"
50 output = "curlhere.html"
51 user-agent = "superagent/1.0"
52
53 # and fetch another URL too
54 url = "example.com/docs/manpage.html"
55 -O
56 referer = "http://nowhereatall.example.com/"
57 # --- End of example file ---
58 .fi
59
60 This option can be used multiple times to load multiple config files.