Find the answer to your Linux question:
Results 1 to 2 of 2
Hello, I have a question regarding TCPDUMP. I'm looking to run a TCPDUMP command with either of the following options: - I want to capture x number of packets (somewhere ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Sep 2005
    Posts
    21

    TCPDUMP help -- option question


    Hello,

    I have a question regarding TCPDUMP. I'm looking to run a TCPDUMP command with either of the following options:

    - I want to capture x number of packets (somewhere between 1 to 10 packets)

    or

    - I want to capture for x number of seconds (I will want to capture for 1 second or less). Is it possible to capture for a time period of less than whole numbers (i.e. 0.5 seconds or 0.3 seconds, etc)?

    Thanks in advance!

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,753
    You can specify the number of packets to capture with the -c count option, but as far as I know, there is no capture time argument. The only timing related option is -G rotate_seconds one which specifies the amount of time it will dump to a log file before rotating the logs and start a new one. That said, you can send a SIGINT signal to the tcpdump program which will signal it to stop, and that can be done with a script that would sleep some period of time and then signal tcpdump. The sleep command only supports seconds, but the usleep command supports microseconds.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •