Send a raw HTTP HEAD request through netcat
Build a paste-ready command, then review its compatibility and effects before running it.
printf 'HEAD / HTTP/1.0\r\nHost: %s\r\n\r\n' <host> | nc -w 5 <host> 80Complete required fields to copy the generated command.
Compatibility
Linux + macOSVerified for Linux, macOS using posix, bash, zsh syntax.
Operational knowledgereview due 2027-01-19
Requirementsprintfprintf must be installed and available on PATH.Network accessThe target must be reachable from the current environment.
Version supportprintf Current supported releasesVerified for linux, macos using posix, bash, zsh syntax; consult compatibility notes for platform-specific differences.
Expected signalsHTTP/1.0 200 OKRepresentative successful output; values vary with the selected target and system state.
Known errorsprintf: command not foundprintf is missing or is not available on PATH.
Verifyprintf 'HEAD / HTTP/1.0\r\nHost: %s\r\n\r\n' {{host}} | nc -w 5 {{host}} {{port}}The output matches the expected target and exits without an error.Rollback noteNot required: this command is read-only and does not change system state.
Command breakdown
01printfCommandRuns the printf stage of this one-liner.
02'HEAD / HTTP/1.0\r\nHost: %s\r\n\r\n'ArgumentPasses 'HEAD / HTTP/1.0\r\nHost: %s\r\n\r\n' to printf.
03<host>ParameterA value supplied in the Fill parameters section.
04|PipelinePasses the output on the left to the command on the right.
05ncCommandRuns the nc stage of this one-liner.
06-wOptionStops connecting or waiting for network input after the given timeout.
08<host>ParameterA value supplied in the Fill parameters section.
09<port>ParameterA value supplied in the Fill parameters section.
Example input
printf 'HEAD / HTTP/1.0\r\nHost: %s\r\n\r\n' example.com | nc -w 5 example.com 80
Example output
HTTP/1.0 200 OK
Content-Type: text/html
Content-Length: 1256
Connection: close
Illustrative output — exact values vary by system and data.
Official sources
Related commands