1 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 2 SPDX-License-Identifier: curl 3 Long: config 4 Arg: <file> 5 Help: Read config from a file 6 Short: K 7 Category: curl 8 Example: --config file.txt $URL 9 Added: 4.10 10 See-also: disable 11 Multi: append 12 --- 13 Specify a text file to read curl arguments from. The command line arguments 14 found in the text file are used as if they were provided on the command 15 line. 16 17 Options and their parameters must be specified on the same line in the file, 18 separated by whitespace, colon, or the equals sign. Long option names can 19 optionally be given in the config file without the initial double dashes and 20 if so, the colon or equals characters can be used as separators. If the option 21 is specified with one or two dashes, there can be no colon or equals character 22 between the option and its parameter. 23 24 If the parameter contains whitespace or starts with a colon (:) or equals sign 25 (=), it must be specified enclosed within double quotes (\&"). Within double 26 quotes the following escape sequences are available: \\\\, \\", \\t, \\n, \\r 27 and \\v. A backslash preceding any other letter is ignored. 28 29 If the first non-blank column of a config line is a '#' character, that line 30 is treated as a comment. 31 32 Only write one option per physical line in the config file. A single line is 33 required to be no more than 10 megabytes (since 8.2.0). 34 35 Specify the filename to --config as '-' to make curl read the file from stdin. 36 37 Note that to be able to specify a URL in the config file, you need to specify 38 it using the --url option, and not by simply writing the URL on its own 39 line. So, it could look similar to this: 40 41 url = "https://curl.se/docs/" 42 43 # --- Example file --- 44 # this is a comment 45 url = "example.com" 46 output = "curlhere.html" 47 user-agent = "superagent/1.0" 48 49 # and fetch another URL too 50 url = "example.com/docs/manpage.html" 51 -O 52 referer = "http://nowhereatall.example.com/" 53 # --- End of example file --- 54 55 When curl is invoked, it (unless --disable is used) checks for a default 56 config file and uses it if found, even when --config is used. The default 57 config file is checked for in the following places in this order: 58 59 1) **"$CURL_HOME/.curlrc"** 60 61 2) **"$XDG_CONFIG_HOME/curlrc"** (Added in 7.73.0) 62 63 3) **"$HOME/.curlrc"** 64 65 4) Windows: **"%USERPROFILE%\\.curlrc"** 66 67 5) Windows: **"%APPDATA%\\.curlrc"** 68 69 6) Windows: **"%USERPROFILE%\\Application Data\\.curlrc"** 70 71 7) Non-Windows: use getpwuid to find the home directory 72 73 8) On Windows, if it finds no *.curlrc* file in the sequence described above, it 74 checks for one in the same dir the curl executable is placed. 75 76 On Windows two filenames are checked per location: *.curlrc* and *_curlrc*, 77 preferring the former. Older versions on Windows checked for *_curlrc* only. 78