Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Is it possible to grep something from the tcpdump summary? Like: tcpdump -nn -c100 | grep "packets dropped by kernel"
But that somehow doesn't work, it only pipes the packets itself, but the summary seems to be written to another stdout or something. I want to grep/awk one of these lines:
0 packets captured
0 packets received by filter
0 packets dropped by kernel
This has the advantage of being self cleaning, as tcpdump should fill the fifo (First In First Out) and cat will empty it again.
I think your option with corrected syntax is shorter
tcpdump -nn -c100 | egrep 'packets\ dropped\ by\ kernel'
Any non alpha-numeric character (.,*&^%$£!#~' etc.) needs an escape before it is treated as an ordinary character in grep's search. egrep uses Posix reg. exp. rules.
Thank you for your reply and your explaination, very helpful. I'm now trying to do the same with the script from the first answer of this topic and it doesn't work with both of your solutions. Any suggestion on this one? Thank you in advance, much appreciated.
The principle is identical, except that business_kid threw an unnecessary tempfile/pipe to the mix. My post demonstrates how it can all be done with a single command. Also, I took the time to add a link so that you can study it in more detail.
And it doesn't help much to just say that something "didn't work". What exactly did you try, and what exactly happened when you tried it? We can't see your screen, so we can't figure out what went wrong unless you give us enough detail to work with.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.