config.d 2.7 KB

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