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