Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.
nc -q -1 local host ${PORT} ${CMD}

In Ubuntu, nc may be used as above, with the -q option. See manpage.

  • -q after EOF on stdin, wait the specified number of seconds and then quit. If seconds is negative, wait forever.

However, this option is not available in Redhat 5. See manpage. How do I achieve the equivalent of nc -q in Redhat 5?

share|improve this question
What version of netcat are you using? Did you compile from source, or install using your package manager? You might want to try compiling netcat from source, or attempting to compile the Ubuntu version on your Redhat machine. Also, it would be helpful to explain why you need this behaviour (specifically why you need to wait X seconds after EOF), as it might help to suggest alternative solutions. – Breakthrough Jun 22 at 5:17

1 Answer 1

What do you want that option for? If you explain the use case, maybe we can come up with an alternative.

For example, maybe

while 1; do
    nc localhost ${PORT}

is sufficient?

I think the man pages is from RHEL5, but not 100% sure.

share|improve this answer

Your Answer


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.