'Is there a way to give a specific file name when saving a file via cURL?

I am pulling files using curl in the mac OS X terminal and want to give them different names. Is there a way to specify a name, such as a "save as" function when using curl?



Solution 1:[1]

curl -o <name> <url> seems to do the trick..

HINT: You can also try with man curl...

Solution 2:[2]

For those who are getting familiar with CURL, here is a more clear and easy to understand use case example:

REMOTE URL

http(s)://my-remote-image.png?token=TOKEN_ID

CURL COMMAND IN ACTION (lowercase "o")

curl -o custom_name_to_be_used.png "http(s)://my-remote-image.png?token=TOKEN_ID"

Solution 3:[3]

Here is how to download a file to another file name, and allow redirects. No need to look for -L in the comments.

curl -L "$URL" -o "$FILENAME"

Example

curl -L https://protonmail.com/download/bridge/protonmail-bridge_2.1.1-1_amd64.deb -o bridge.deb

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Tonny Madsen
Solution 2
Solution 3 Elijah