Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'd like to send HTTP HEAD request using wget, is it possible?

share|improve this question

4 Answers 4

up vote 30 down vote accepted

It's not wget, but you can do that quite easily by using curl.

curl -I http://www.superuser.com/

Produces this output:

HTTP/1.1 301 Moved Permanently                        
Content-Length: 144                       
Content-Type: text/html; charset=UTF-8     
Location: http://superuser.com/
Date: Sat, 09 Oct 2010 19:11:50 GMT
share|improve this answer
    
This is exactly what I want. –  Xiè Jìléi Oct 11 '10 at 15:23

Try:

wget -S --spider www.example.com

You can also pass -O /dev/null to prevent wget from writing HTTP response to a file.

share|improve this answer
    
-S will show headers, but it executes a GET, not a HEAD. In other words, it will fetch the entire URL. –  Dan Dascalescu Feb 28 at 23:21
    
wget -S --spider http://localhost log created in apache server is 127.0.0.1 - - [04/Mar/2014:15:36:32 +0100] "HEAD / HTTP/1.1" 200 314 "-" "Wget/1.13.4 (linux-gnu)" –  Casual Coder Mar 4 at 14:38

Though not wget, many perl installs with lwp module will have a HEAD command installed.

share|improve this answer

'wget -S' gets file ( Content-Length: 2316, Length: 2316 (2.3K) [text/plain], Saving to: `index.html') 'wget --spider' gets header (Spider mode enabled. Check if remote file exists., Length: unspecified [text/plain] Remote file exists.)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.