I need to see whole HTTP packets sent and recieved by an application for debugging purposes. How can this be done in command-line?
tcpdump -w httpdebug.pcap -i eth0 port 80 will sniff all packets heading to or from port 80 on the eth0 interface and output them to
httpdebug.pcap, which you can then read at your leisure, either with tcpdump again (with multiple
-x options, refer to the tcpdump manpage ) in console if you're feeling masochistic, or with wireshark.
I really can't recommend the latter highly enough, as it will let you sort out packets and follow the exact stream you want to see.