config.d 2.6 KB

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