Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to view Linux port traffic

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you how to check the Linux network port traffic, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

The rapid development of Linux, in a short period of time has caught up with Microsoft, let Microsoft also attach importance to this opponent, maybe you are learning Linux, here explain the script problem of viewing Linux port traffic, hope to learn to view Linux port traffic script knowledge. Through this script, it is found that bash is indeed more powerful than the old shell in arithmetic, so you need to start learning bash to take advantage of its powerful capabilities. However, the function of the for statement in bash is quite different from that in c

# cat stream #! / bin/bash # Write by Neil.xu qq:37391319 email: xurongzhong@gmail.com # 2008-8-19 we need to monitor streams of LTS channels So write this script typeset in in_old dif_in dif_in1 dif_out1 typeset out out_old dif_out in_old=$ (cat / proc/net/dev | grep eth0 | sed's = ^. *: ='| awk'{print $1}') out_old=$ (cat / proc/net/dev | grep eth0 | sed's = ^. *: ='| awk'{print $9}') while true do sleep 1 in=$ (cat / proc/net/) Dev | grep eth0 | sed's = ^. *: ='| awk'{print $1}') out=$ (cat / proc/net/dev | grep eth0 | sed's = ^. *: = ='| awk'{print $9}') dif_in=$ ((in-in_old)) dif_in1=$ ((dif_in * 8 / 1024 / 1024) dif_out=$ ((out-out_old) Echo "IN: ${dif_in} bytes OUT: ${dif_out} bytes" dif_out1=$ ((dif_out * 8 / 1024 / 1024)) echo "IN: ${dif_in1} mbps OUT: ${dif_out1} mbps" in_old=$ {in} out_old=$ {out} done Fruit: #. / stream IN: 349179 bytes OUT: 1363936 bytes IN: 2 mbps OUT: 10 mbps IN: 349612 bytes OUT: 1361852 bytes IN: 2 mbps OUT: 10 mbps IN: 348684 bytes OUT: 1358952 bytes IN: 2 mbps OUT: 10 mbps IN: 349998 bytes OUT: 1359092 bytes are all the contents of the article "how to View Linux Port Traffic" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report