How to capture packets for a long time using tcpdump in Linux

Source: Internet
Author: User
Linux with tcpdump long-term packet capture operation method command: tcpdump-ieth1-s0-wk.cap last added is to make this command in the background for long-term execution, otherwise close sshclient tcpdump command will stop on its own. Then log on to linux again and perform the following operations-bash-3.00 # ps-ef | greptcpdumppcap3660101 on Linux. TcpdumpOperation Command for capturing packets for a long time:
Tcpdump-I eth1-s 0-w k. cap &

Add the command to make it run in the background for a long time. otherwise, after the ssh client is disabled
The tcpdump command stops automatically.

Then log on to linux again and perform the following operations-bash-3.00 # ps-ef | grep tcpdump
Pcap 3660 1 0? 00:00:00 tcpdump-I eth1-s 0-wk. cap
Root 3721 3680 0 00:00:00 pts/1 grep tcpdump

-Bash-3.00 # kill 3660

-Bash-3.00 # ls-l
-Rw-r -- 1 root 33714 Mar 29 k. cap

Download the packet to the local device for analysis. Note:-s 0 indicates that the size of captured packets is not limited.
When using this command, you must pay attention to the remaining space (df-h) on the hard disk to avoid the abnormal use of the system due to excessive files.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.