My personal cURL cheat sheet
Resuming failed download
Need to make sure filename is the same in order for it to automatically determine the offset. The
-C tells it to use the output file to determine where to continue from.
curl -O -C - https://example.com/dir/filename.bin
-O uses the filename from the end of the path.
curl -O https://example.com/dir/filename.bin
This can be annoying if it has query parameters, because they will end up in the filename.
If you add
-J it lets curl use the filename provided by the server (via the
header) if one is available.
curl -OJ https://example.com/dir/filename.bin?param=value
--data/-d because it doesn't mess with newlines etc.
curl https://example.com/dir/filename.bin --data-binary @filename.bin
-T option will make a PUT request. Advantage over
--data-binary is that it doesn't load the entire
file into memory on the client. You can use
-X POST to force it to use POST.
curl https://example.com/dir/ -T filename.bin