DEV Community

Eldad Assis
Eldad Assis

Posted on

Get http code with wget

Sometimes I don't have curl available for me in a given environment. Some distributions don't provide it with the default installed utilities and I might not have the privileges to install it.
In such cases, I use wget, which is usually installed.

wget --spider -S -T 2 2>&1 | grep "^  HTTP/" | awk '{print $2}' | tail -1

Run wget --help to see details about the parameters I use here.

Top comments (0)