nc
Section: (pj)
Updated: 2022-01-20
Index
Return to Main Contents
USAGE
nc [hostname] [port] is like telnet: it goes there.
But error messages go to stderr, so scripting is easier.
nc -l [port] listens.
You can still pump data into stdin, and it will go to whoever connects.
This is handy to see what your browser/application is sending.
-q 0 means quit zero seconds after reading EOF on stdin.
That is useful with -l if you are just piping something
hardcoded.
A complete example:
-
nc -q 0 -l 8011 <<EOF
HTTP/1.1 200 OK
Content-Type: text/plain
hello world!
EOF
AUTHORS
Paul A. Jungwirth.
Index
- USAGE
-
- AUTHORS
-
This document was created by
man2html,
using the manual pages.
Time: 21:16:02 GMT, January 04, 2026