I don't want to have to type curl --socks5 socks5://<proxy name>:<proxy port> <url> every time I want to make a request to another website. How can I configure cURL to do this by default?
1 Answer
How can I configure cURL to do this by default?
Add the command option to the curl Default config file:
Config file
You can easily end up with curl command lines that use a very large number of command-line options, making them rather hard to work with. Sometimes the length of the command line you want to enter even hits the maximum length your command-line system allows. The Microsoft Windows command prompt being an example of something that has a fairly small maximum line length.
To aid such situations, curl offers a feature we call "config file". It basically allows you to write command-line options in a text file instead and then tell curl to read options from that file in addition to the command line.
...
When curl is invoked, it always (unless -q is used) checks for a default config file and uses it if found. The file name it checks for is
.curlrcon Unix-like systems and_curlrcon Windows.The default config file is checked for in the following places in this order:
curltries to find the "home directory": It first checks for theCURL_HOMEand then theHOMEenvironment variables. Failing that, it usesgetpwuid()on Unix-like systems (which returns the home directory given the current user in your system). On Windows, it then checks for theAPPDATAvariable, or as a last resort the%USERPROFILE%\Application Data.On Windows, if there is no
_curlrcfile in the home directory, it checks for one in the same directory the curl executable is placed. On Unix-like systems, it will simply try to load.curlrcfrom the determined home directory.