Skip to main content
edited body
Source Link
Frank N
  • 10.5k
  • 4
  • 90
  • 118

headcurl.cmd (windows version)

curl -sSkv -o NUL %* 2>&1 
  • I don't want a progress bar -s,
  • but I do want errors -S,
  • not bothering about valid https certificates -k,
  • getting high verbosity -v (this is about troubleshooting, is it?),
  • no output (in a clean way).
  • oh, and I want to forward stderr to stdout, so I can grep against the whole thing (since most or all output comes in stderr)
  • %* means [pass on all parameters to this script] (well(https://stackoverflow.com/a/980372/444255), well usually that's just one parameter: the url you are testing

real world-world example (on troubleshooting proxy issues):

C:\depot>headcurl google.ch | grep -i -e http -e cache 
Hostname was NOT found in DNS cache GET HTTP://google.ch/ HTTP/1.1 HTTP/1.1 301 Moved Permanently Location: http://www.google.ch/ Cache-Control: public, max-age=2592000 X-Cache: HIT from company.somewhere.ch X-Cache-Lookup: HIT from company.somewhere.ch:1234 

Linux version

for your .bash_aliases / .bash_rc:

alias headcurl='curl -sSkv -o /dev/null $@ 2>&1' 

headcurl.cmd (windows version)

curl -sSkv -o NUL %* 2>&1 
  • I don't want a progress bar -s,
  • but I do want errors -S,
  • not bothering about valid https certificates -k,
  • getting high verbosity -v (this is about troubleshooting, is it?),
  • no output (in a clean way).
  • oh, and I want to forward stderr to stdout, so I can grep against the whole thing (since most or all output comes in stderr)
  • %* means [pass on all parameters to this script] (well(https://stackoverflow.com/a/980372/444255), well usually that's just one parameter: the url you are testing

real world example (on troubleshooting proxy issues):

C:\depot>headcurl google.ch | grep -i -e http -e cache 
Hostname was NOT found in DNS cache GET HTTP://google.ch/ HTTP/1.1 HTTP/1.1 301 Moved Permanently Location: http://www.google.ch/ Cache-Control: public, max-age=2592000 X-Cache: HIT from company.somewhere.ch X-Cache-Lookup: HIT from company.somewhere.ch:1234 

Linux version

for your .bash_aliases / .bash_rc:

alias headcurl='curl -sSkv -o /dev/null $@ 2>&1' 

headcurl.cmd (windows version)

curl -sSkv -o NUL %* 2>&1 
  • I don't want a progress bar -s,
  • but I do want errors -S,
  • not bothering about valid https certificates -k,
  • getting high verbosity -v (this is about troubleshooting, is it?),
  • no output (in a clean way).
  • oh, and I want to forward stderr to stdout, so I can grep against the whole thing (since most or all output comes in stderr)
  • %* means [pass on all parameters to this script] (well(https://stackoverflow.com/a/980372/444255), well usually that's just one parameter: the url you are testing

real-world example (on troubleshooting proxy issues):

C:\depot>headcurl google.ch | grep -i -e http -e cache 
Hostname was NOT found in DNS cache GET HTTP://google.ch/ HTTP/1.1 HTTP/1.1 301 Moved Permanently Location: http://www.google.ch/ Cache-Control: public, max-age=2592000 X-Cache: HIT from company.somewhere.ch X-Cache-Lookup: HIT from company.somewhere.ch:1234 

Linux version

for your .bash_aliases / .bash_rc:

alias headcurl='curl -sSkv -o /dev/null $@ 2>&1' 
added 2 characters in body
Source Link
Frank N
  • 10.5k
  • 4
  • 90
  • 118

headcurl.cmd (windows version)

curl -sSkv -o NUL %* 2>&1 

real world example (on troubleshooting proxy issues):

C:\depot>headcurl google.ch | grep -i -e http -e cache 
Hostname was NOT found in DNS cache GET HTTP://google.ch/ HTTP/1.1 HTTP/1.1 301 Moved Permanently Location: http://www.google.ch/ Cache-Control: public, max-age=2592000 X-Cache: HIT from company.somewhere.ch X-Cache-Lookup: HIT from company.somewhere.ch:1234 

Linux version

for your .bash_aliases / .bash_rc:

alias headcurl='curl -sSkv -o /dev/null $@ 2>&1' 

headcurl.cmd (windows version)

curl -sSkv -o NUL %* 2>&1 
  • I don't want a progress bar -s,
  • but I do want errors -S,
  • not bothering about valid certificates -k,
  • getting high verbosity -v (this is about troubleshooting, is it?),
  • no output (in a clean way).
  • oh, and I want to [forward STDERR to STDOUT] https://stackoverflow.com/a/1420981/444255), so I can grep against the whole thing (as most or all of the output comes in stderr)...
  • %* means pass on all parameters to this script

real world example (on troubleshooting proxy issues):

C:\depot>headcurl google.ch | grep -i -e http -e cache 
Hostname was NOT found in DNS cache GET HTTP://google.ch/ HTTP/1.1 HTTP/1.1 301 Moved Permanently Location: http://www.google.ch/ Cache-Control: public, max-age=2592000 X-Cache: HIT from company.somewhere.ch X-Cache-Lookup: HIT from company.somewhere.ch:1234 

Linux version

for your .bash_aliases / .bash_rc:

alias headcurl='curl -sSkv -o /dev/null $@ 2>&1' 

headcurl.cmd (windows version)

curl -sSkv -o NUL %* 2>&1 
  • I don't want a progress bar -s,
  • but I do want errors -S,
  • not bothering about valid https certificates -k,
  • getting high verbosity -v (this is about troubleshooting, is it?),
  • no output (in a clean way).
  • oh, and I want to forward stderr to stdout, so I can grep against the whole thing (since most or all output comes in stderr)
  • %* means [pass on all parameters to this script] (well(https://stackoverflow.com/a/980372/444255), well usually that's just one parameter: the url you are testing

real world example (on troubleshooting proxy issues):

C:\depot>headcurl google.ch | grep -i -e http -e cache 
Hostname was NOT found in DNS cache GET HTTP://google.ch/ HTTP/1.1 HTTP/1.1 301 Moved Permanently Location: http://www.google.ch/ Cache-Control: public, max-age=2592000 X-Cache: HIT from company.somewhere.ch X-Cache-Lookup: HIT from company.somewhere.ch:1234 

Linux version

for your .bash_aliases / .bash_rc:

alias headcurl='curl -sSkv -o /dev/null $@ 2>&1' 
Source Link
Frank N
  • 10.5k
  • 4
  • 90
  • 118

headcurl.cmd (windows version)

curl -sSkv -o NUL %* 2>&1 
  • I don't want a progress bar -s,
  • but I do want errors -S,
  • not bothering about valid certificates -k,
  • getting high verbosity -v (this is about troubleshooting, is it?),
  • no output (in a clean way).
  • oh, and I want to [forward STDERR to STDOUT] https://stackoverflow.com/a/1420981/444255), so I can grep against the whole thing (as most or all of the output comes in stderr)...
  • %* means pass on all parameters to this script

real world example (on troubleshooting proxy issues):

C:\depot>headcurl google.ch | grep -i -e http -e cache 
Hostname was NOT found in DNS cache GET HTTP://google.ch/ HTTP/1.1 HTTP/1.1 301 Moved Permanently Location: http://www.google.ch/ Cache-Control: public, max-age=2592000 X-Cache: HIT from company.somewhere.ch X-Cache-Lookup: HIT from company.somewhere.ch:1234 

Linux version

for your .bash_aliases / .bash_rc:

alias headcurl='curl -sSkv -o /dev/null $@ 2>&1'