FG
💻 Software

How can I pipe commands to a netcat that will stay alive?

Fresh5 days ago
Mar 15, 2026141032 views
Confidence Score0%
0%

Problem

This results in the command being sent to the remote host and some data being read back. But after a few seconds, the connection closes. The -w parameter did not change anything. I am using netcat v1.10 on SuSE 10.1.

Error Output

echo command | netcat host port

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: How can I pipe commands to a netcat that will stay alive?

Low Risk

This works with the command on OS X (assuming the command that you want to send is in a file): (Essentially, dumps the contents of file on stdout and then waits for you on stdin). By extension, if you want to send the command from the shell itself, …

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment