Using cURL to get just the HTTP status code

There are a few ways to accomplish getting just the HTTP status code for a URL using cURL, but many of them still download the asset (not useful when you want to make sure a list of MP4 files exists!). Here’s the one I use:

curl -LI -o /dev/null -w "%{http_code}" "${link}" -s

This article was updated on 2023-10-17

I'm nabeards. I'm a full stack JavaScript developer. I travel full time, a.k.a., Professional Wanderer, a.k.a., Digital Nomad.