Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top
netcat [...] -e program
nc [...] -e program

Is supposed to run program as a server (as far as its stdin and stdout are concerned). netcat on Mac OS X does not seem to have this -e option.

Why is that and is there a way to enable it?

share|improve this question

It looks like you found one of many netcat-rewrites floating around the net. The One True Netcat uses -e to specify IPSEC parameters. Chances are you found a version that someone modified, or wrote from scratch, which is different than what most others call netcat.

You'll have to find the source for that version and compile it. If you don't want to do that, it may be possible to do some tricks with redirection and/or a wrapper to set up the FDs properly before exec()ing a program.

share|improve this answer
What's the OG netcat? GNU version? – xyz Jan 18 '10 at 21:45
Ncat (part of nmap 5) attempts to collect the best features of the various netcat variants in a modern, standardized reimplementation. – Gerald Combs Jan 19 '10 at 0:01

I don't have the -e flag on any version of netcat I checked (SLES11/Debian Lenny/Ubuntu Karmic, 10.5.8, 10.6.2). Don't you just need to set netcat to listening mode and user proper redirection of stdin/stdout?

edit: Karmic has the -eflag.

share|improve this answer
Ubuntu 9.10 man netcat: "-e filename specify filename to exec after connect (use with caution). See the -c option for enhanced functionality." – Dennis Williamson Jan 18 '10 at 20:30
Seems I overlooked it, you are ofc right! – pfo Jan 18 '10 at 20:38

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.