Downloading a File Using cURL

A coworker was trying to user cURL to get a file and was getting tired of having to redirect the output and save to the same name:

curl https://octodex.github.com/images/okal-eltocat.jpg > okal-eltocat.jpg

After searching through the man page for cURL I found that you can add the —remote-name flag, allowing you to have the command be just:

curl --remote-name https://octodex.github.com/images/okal-eltocat.jpg

Or if wanting use the short version, for manually typing it in at the command line, outside of a script:

curl -O https://octodex.github.com/images/okal-eltocat.jpg

I figured I would write this up here for my future reference, and anybody else who might find this useful.

–Proctor