5th December
2008
This is lifted from http://bashcurescancer.com/shell-function-which-webserver-does-that-site-run.html.
Handy shell function you can put in your .bashrc. Quickly find out what server a host is running.
what-http-server() { curl -s -I $(for h in "$@"; do printf "http://%s " "$h"; done) | awk -F': ' '/^Server:/ {print $2}'; }
Now try what-http-server kernel.org google.com hotmail.com.
Identica
Twitter
LinkedIn
Here’s a diet version for a single host:
$ curl -sI google.com | grep Server
Here’s a version with only alphabet letters and dashes & pipes:
$ lessecho google.com wpi.edu | xargs curl -sI | grep Server
(lessecho comes with less, xargs with findutils, at least in Debian/Ubuntu)
thus:
what-http-server() { lessecho $@ | xargs curl -sI | grep Server }