• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 Long: config
2 Arg: <file>
3 Help: Read config from a file
4 Short: K
5 Category: curl
6 Example: --config file.txt $URL
7 Added: 4.10
8 ---
9 Specify a text file to read curl arguments from. The command line arguments
10 found in the text file will be used as if they were provided on the command
11 line.
12 
13 Options and their parameters must be specified on the same line in the file,
14 separated by whitespace, colon, or the equals sign. Long option names can
15 optionally be given in the config file without the initial double dashes and
16 if so, the colon or equals characters can be used as separators. If the option
17 is specified with one or two dashes, there can be no colon or equals character
18 between the option and its parameter.
19 
20 If the parameter contains whitespace (or starts with : or =), the parameter
21 must be enclosed within quotes. Within double quotes, the following escape
22 sequences are available: \\\\, \\", \\t, \\n, \\r and \\v. A backslash
23 preceding any other letter is ignored.
24 
25 If the first column of a config line is a '#' character, the rest of the line
26 will be treated as a comment.
27 
28 Only write one option per physical line in the config file.
29 
30 Specify the filename to --config as '-' to make curl read the file from stdin.
31 
32 Note that to be able to specify a URL in the config file, you need to specify
33 it using the --url option, and not by simply writing the URL on its own
34 line. So, it could look similar to this:
35 
36 url = "https://curl.se/docs/"
37 
38 When curl is invoked, it (unless --disable is used) checks for a default
39 config file and uses it if found, even when this option is used. The default
40 config file is checked for in the following places in this order:
41 
42 1) Use the CURL_HOME environment variable if set
43 
44 2) Use the XDG_CONFIG_HOME environment variable if set (Added in 7.73.0)
45 
46 3) Use the HOME environment variable if set
47 
48 4) Non-windows: use getpwuid to find the home directory
49 
50 5) Windows: use APPDATA if set
51 
52 6) Windows: use "USERPROFILE\\Application Data" if set
53 
54 7) On windows, if there is no .curlrc file in the home dir, it checks for one
55 in the same dir the curl executable is placed. On Unix-like systems, it will
56 simply try to load .curlrc from the determined home dir.
57 
58 .nf
59 # --- Example file ---
60 # this is a comment
61 url = "example.com"
62 output = "curlhere.html"
63 user-agent = "superagent/1.0"
64 
65 # and fetch another URL too
66 url = "example.com/docs/manpage.html"
67 -O
68 referer = "http://nowhereatall.example.com/"
69 # --- End of example file ---
70 .fi
71 
72 This option can be used multiple times to load multiple config files.
73