Milestone 2 , Module 5 - How to add both the output of ping and traceroute to the same file?

The milestone says to tcpdump both ping and traceroute to the same file.Wont the second thing(traceroute) overwrite the first one.

Try studying the tcpdump documentation to understand how you can prevent that from happening and will that even happen in the first place. That’ll provide you with a greater learning experience.

tcpdump capture all the packets from the network. those packets could be sent by any of process they are all traced into the specified file.

split your terminal in 3 then run these commands in parallel and make sure your pcap file must be less than 2 MB in size.

Run the tcpdump command , while tcpdump is running run the ping and traceroute command…

Please refer to the following

https://www.tecmint.com/12-tcpdump-commands-a-network-sniffer-tool/

First thing run tcpdump with filters on port or on protocol,It will not increase the file size
check how to write data in a file using tcpdump
now as mention in mile stone first run the ping command after 4-5 ping response
close that command and the run traceroute

@prajjwalmishra07
If you are mentioning about the case where we write the tcpdump of ping to the pcap file first and then redirect the traceroute dump to the same file, thus overwriting the earlier content

  • There are two redirection operators > and >>. The former overwrites the file each time we redirect to the file and the latter appends

  • Also, you can call both the ping and traceroute commands together like we did for Module 2 system requirements scripts

Nb: Saving tcpdump output like this will store it as a text file(even though named .pcap). For the purpose of the milestone, you’ll have to use tcpdump flags to write to file

@prajjwalmishra07 please refer this for understanding tcpdump i hope it will help you

You don’t have to put in the same file. You only have to capture the pings that’s it.