This is our old Q&A Site. Please post any new questions and answers at ask.wireshark.org.

hi i,m new to tcpdump, i run it from linux terminal with this script but it only listens, it doesn't capture anything although it should, is there command like -k in wireshark , that makes tcpdump start capturing immediately ??

#!/bin/bash
tcpdump -i eth1 -s0 -c 700 -w ~/new.pcap "tcp"
sleep 3
iperf -c 192.168.1.2  &
sleep 6
killall tcpdump &
killall iperf

asked 17 Jun '15, 02:59

yas1234's gravatar image

yas1234
16182023
accept rate: 0%

converted to question 17 Jun '15, 03:32

grahamb's gravatar image

grahamb ♦
19.8k330206

Please don't tack new questions as an "Answer" to an existing unrelated question. Please read the FAQ for more info on using this site.

(17 Jun '15, 03:33) grahamb ♦

@yas1234: BTW, if I look at your question history, it seems like you don't fully understand how this site is supposed to work.

It's pretty simple:

  • You ask a question
  • people post their answers
  • if an answer is O.K. for you, you mark the answer as "accepted"

You have asked quite a few questions in the past, with good answers, but you never accepted one of those answers. Please read the FAQ of this site and make yourself familiar with the site rules.

https://ask.wireshark.org/faq/

Thanks!

(17 Jun '15, 04:24) Kurt Knochner ♦

You don't send the tcpdump command to the background (no & at the end of the command), and thus the other commands will be executed only after tcpdump was stopped (I guess after you pressed CTRL-C)!

is there command like -k in wireshark , that makes tcpdump start capturing immediately ??

No, tcpdump starts to capture traffic, as soon as you start it.

BTW: If you add the & to the tcpdump command, and you still don't see any traffic, you are either listening on the wrong interface (eth1) or the iperf command does not generate any traffic.

Regards
Kurt

permanent link

answered 17 Jun '15, 04:21

Kurt%20Knochner's gravatar image

Kurt Knochner ♦
24.8k1039237
accept rate: 15%

edited 17 Jun '15, 06:21

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×549
×97

question asked: 17 Jun '15, 02:59

question was seen: 2,450 times

last updated: 17 Jun '15, 06:21

p​o​w​e​r​e​d by O​S​Q​A