Capture and Save Packets in a File in Linux

0 votes

Hi Guys,

I am trying to save the packets in a file so that I can analyze the external packets. How can I do that?

Oct 4, 2020 in Linux Administration by akhtar
• 38,260 points
6,689 views

1 answer to this question.

0 votes

Hi@akhtar,

You can use tcpdump command to save your packets. You can pass -w in tcpdump command. It will save the output in a file as shown below.

$ tcpdump -w 0001.pcap -i eth0
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
4 packets captured
4 packets received by filter
0 packets dropped by kernel


Hope this will help you!

To know more about it, go for Linux certification course today.

Thanks.

answered Oct 4, 2020 by MD
• 95,460 points

Related Questions In Linux Administration

0 votes
1 answer

How to display captured packets in HEX and ASCII in Linux?

Hi@akhtar, To display the packet value you can ...READ MORE

answered Oct 4, 2020 in Linux Administration by MD
• 95,460 points
32,441 views
0 votes
1 answer

How to capture only TCP packets in Linux?

Hi@akhtar, You can use tcpdump command for this ...READ MORE

answered Oct 4, 2020 in Linux Administration by MD
• 95,460 points
753 views
0 votes
1 answer

Capture packets from destination IP in Linux.

Hi@akhtar, To capture packets from destination IP, say you ...READ MORE

answered Oct 4, 2020 in Linux Administration by MD
• 95,460 points
619 views
0 votes
0 answers

Opening a binary file in VI and XXD

I am attempting to modify the binary ...READ MORE

Apr 13, 2022 in Linux Administration by Rahul
• 9,680 points
1,241 views
0 votes
1 answer
0 votes
1 answer

How do I set variable if a specific package version is installed in CFEngine?

Here is what you can do.Just use packagesmatching to ...READ MORE

answered Jul 12, 2018 in Other DevOps Questions by Atul
• 10,240 points
1,185 views
0 votes
2 answers

Install postgreSQL on Ubuntu

Follow the below commands to install PostgreSQL (PSQL) ...READ MORE

answered Nov 12, 2020 in Database by Prachi
• 140 points
1,275 views
0 votes
1 answer

Access progrs prompt without switching accounts

Use the following to get the postgres prompt ...READ MORE

answered Mar 22, 2019 in Database by Mahi
849 views
0 votes
1 answer

How to check permissions of a file in the Linux system?

Hi@akhtar, If you prefer using the command line, ...READ MORE

answered Aug 13, 2020 in Linux Administration by MD
• 95,460 points
1,750 views
0 votes
1 answer

How to capture Packets from Specific Interface in Linux?

Hi@akhtar, You can use tcpdump command in your ...READ MORE

answered Oct 3, 2020 in Linux Administration by MD
• 95,460 points
1,843 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP