netcat - keep listening for connection in Debian

Debian's implementation of Netcat does have the -k option. However, it's not documented in the manual because it doesn't work in a reliable manner, for some unknown reason.

Luckily, there's ncat, which is yet another implementation of Netcat and is part of the nmap package. This one has a working -k. You can get it by installing nmap. ncat's options and usage are more or less similar to other implementations of Netcat, so your knowledge of other implementations should transfer very well to ncat.


I have the same problem if netcat gets a rst or fin packet, I think.

You could simply call netcat again as soon as it closes using a bash loop.

while true; do nc -lv <listeningport> ; done