Tech, Gadgets, Photography, Social Media and Poor Spelling

TekTip: nettop the command not the hardware…


I found this article on the osxdaily website, the article refers to running nettop on OSX however it’s a *nix command so will also be in the package repository (if not preinstalled) on your favorite distro. I’ve tested all of the command options on Sabayon and they work fine..


*nix systems include an excellent command line network utility called “nettop” that allows users to monitor all network activity, traffic, and routes from a PC 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 computers 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. If command line tools are not your thing, install Windows..

Using nettop to Monitor Network Traffic & Connections

Getting started with nettop is easy enough. Open a Terminal and at the command prompt, type “nettop” to immediately see active network connections and traffic:


Use the down arrow key to scroll down and you’ll soon start to identify processes that you’ll recognize by name, coinciding with apps or processes that are currently in use.

Nettop network traffic and activity

For example, you may see an active SSH connection along with the IP you are connected to, and things are particularly busy when you come across web browsers like Safari or Chrome, especially if you’re on a webpage with AJAX, ads, or cookies, because nettop will show you all communication going on between the browser and the remote servers.

To see the most amount of information, you’ll want to increase the size of the window as large as possible and consider decreasing the font size of the terminal window if you can’t see all that you want to. Hitting the “p” button to put the output displayed by nettop into human readable format is also very helpful for most of us.

nettop showing all network traffic

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:

state packets in bytes in packets out
ssh.83411 5742633 5438 MiB 112280
tcp4<-> Established 5742633 5438 MiB 112280
Google Chrome.99481 26448 6934 KiB 18187
tcp4<->181.82-static.reverse.ip Established 7 523 B 1
tcp4<-> Established 3253 555 KiB 3099
tcp4<-> Established 3512 796 KiB 1366
tcp4<-> Established 10819 3677 KiB 8917
tcp4<-> Established 7981 1866 KiB 3870
tcp4<-> Established 313 9177 B 310
tcp4<-> Established 521 14 KiB 514
udp4 *:*<->*:*

You can also use nettop to just view routing table information if you don’t want to see specific sockets and processes

nettop -m route

The routing information will show the connections from hardware to destination IP, for example, you may see en0 (wi-fi) to the local network IP to a remote server, and you will also see loopback information.

Using the -m flag you can also limit nettop to only show TCP or UDP sockets, with nettop -m tcp and nettop -m udp

There are other ways to see similar information from the command line, including lsof, open_ports.



One comment on “TekTip: nettop the command not the hardware…

  1. Pingback: Links 11/6/2013: More on PRISM and Snowden, Linux Mint Increasingly Praised | Techrights

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: