您的位置:首页 > 运维架构

nettop加指令

2016-03-23 14:06 1296 查看
Mac OS X includes an excellent command line network utility called “nettop” that allows users to monitor all network activity, traffic, and routes from a Mac to the outside world, both through local (LAN) and wide area (WAN) connections. If you’re unfamiliar
with networking tools like this, you can think of nettop as a network centric task manager, displaying active networking connections, sockets and routes, their respective names and process id, the state of the connection and whether the connection is established,
waiting, or listening, and information about individual process data transfer. It’s a bit like the standard ‘top’ and ‘htop’ commands which show process and resource information, but rather than showing CPU and RAM usage, it will show live network transfer
information like packets sent and received, packet size, and total data transferred.

nettop has a wide variety of uses, but it can be particularly helpful when trying to determine what is using the Macs internet connection and networking interfaces, what is communicating with what and how much data is being transferred, and it’s also just
a great utility for network troubleshooting. Command line tools aren’t for everyone though, and for users who would like to view similar network information in a more traditional OS X app format,

进入控制界面后,把terminal的界面放到最大哦否则看不到全部信息

nettop

Once in nettop you can adjust the output a bit to see more or less information for specific processes and their network communications. Basic nettop commands are:

p – changes to and from human readable format (i.e.: kilobytes and megabytes rather than pure byte count)

d – show delta count (i.e.: active change in packet count rather than total packets

Up & Down arrow keys – navigate up and down in the list

Right & Left arrow keys – expand or collapse specific process or routing groups

q – quit out of nettop

Formatting is easy to follow, despite what the pasted sample block looks like below:

如果在输入阶段就需要过滤可以考虑的参数

-m Set the mode

Without any parameters, nettop will monitor all tcp and udp sockets.

tcp - only tcp sockets will be monitored

udp - only udp sockets will be monitored

route - instead of sockets, the routing table will be monitored

-n Disable address to name resolution

-c Be gentle on the CPU - draw less often
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: