Listen on a network port and save data to a text file [closed] Listen on a network port and save data to a text file [closed] linux linux

Listen on a network port and save data to a text file [closed]


Netcat is your friend here.

nc -l localhost 10000 > log.txt

Netcat will listen for a connection on port 10000, redirect anything received to log.txt.


Also available is TCPDump.

sudo tcpdump -i eth0 -vvvvtttAXns 1500 'port 10000'


Other tools are Ethereal (man page) or Wireshark and it's console variant tshark.

In any case please be aware that you are following local and company rules.