Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Is there some easy way in linux to listen for data on network and save them to a text file?

Thank you.

like image 379
Martin Petercak Avatar asked Jan 19 '12 23:01

Martin Petercak


2 Answers

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.

like image 155
TomT the Weatherman Avatar answered Nov 14 '22 04:11

TomT the Weatherman


Also available is TCPDump.

sudo tcpdump -i eth0 -vvvvtttAXns 1500 'port 10000'
like image 41
Mike Mackintosh Avatar answered Nov 14 '22 04:11

Mike Mackintosh