1

How can I make sure the result of the following command:

nc eth0 &> capture.txt

would capture the data + errors transmitted via eth0?

  • 2
    you want tcpdump not nc, and it's -i eth0 – Creek Aug 15 '14 at 17:03
  • @Creek please post that as an answer. – derobert Aug 15 '14 at 17:04
  • nc will not serve the purpose at all? what if i can not install tcpdump, am i stuck then? – Sean Aug 15 '14 at 17:10
  • 1
    @Sean not necessarily, you can create an iptables LOG rule which will log high level packet info to syslog – Creek Aug 15 '14 at 17:27
7

you want tcpdump not nc, and the syntax would be

tcpdump -i eth0

netcat is only for basic TCP/IP testing. tcpdump utilizes the libpcap library which allows for lowlevel interactions with packets and the likes

2

You should use tcpdump with the -w switch.

tcpdump -i INTERFACE -w FILENAME

Replace INTERFACE with the interface you want to listen and FILENAME with the location of the file to which you need to capture the output.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.