Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

how to display the actual network traffic (wireless) in a terminal?

Additionally: Is it possible to add this info to the chart of top?

share|improve this question

11 Answers 11

up vote 109 down vote accepted

Here are some nice tools in the Ubuntu repositories for command line bandwidth monitoring:

bmon - shows multiple interfaces at once

enter image description here

slurm - has nice colored graphs

enter image description here

tcptrack - A favorite. Tells how much bandwidth is being used and also what protocol (service/port) and destination the transmission is taking place to. Very helpful when you want to know exactly what is using up your bandwidth

enter image description here

share|improve this answer
1  
bmon is really cool! has a graph like slurm but not colorful. –  Ethereal Jan 10 '14 at 21:27

It's quite easy! install "iftop" with:

    sudo apt-get install iftop

Then run

    sudo iftop

from any terminal!

Enjoy!

share|improve this answer
    
To see anything, I have to run (Ubuntu using wifi): $ sudo iftop -i wlan0 –  russian_spy Jun 3 at 20:08

Someone should also have mentioned Nethogs, so I'm that one. The thing that's different and maybe is cooler about this one is that it shows traffic per process, like the image shows

enter image description here

Take a look at the page

share|improve this answer
1  
To install: sudo apt-get -y install nethogs then sudo nethogs –  bmaupin Sep 2 '14 at 15:18

iptraf

IPTraf is a console-based network statistics utility for Linux. It gathers a variety of figures such as TCP connection packet and byte counts, interface statistics and activity indicators, TCP/UDP traffic breakdowns, and LAN station packet and byte counts.

Features

An IP traffic monitor that shows information on the IP traffic passing over your network. Includes TCP flag information, packet and byte counts, ICMP details, OSPF packet types. General and detailed interface statistics showing IP, TCP, UDP, ICMP, non-IP and other IP packet counts, IP checksum errors, interface activity, packet size counts. A TCP and UDP service monitor showing counts of incoming and outgoing packets for common TCP and UDP application ports A LAN statistics module that discovers active hosts and shows statistics showing the data activity on them TCP, UDP, and other protocol display filters, allowing you to view only traffic you're interested in. Logging Supports Ethernet, FDDI, ISDN, SLIP, PPP, and loopback interface types. Utilizes the built-in raw socket interface of the Linux kernel, allowing it to be used over a wide range of supported network cards. Full-screen, menu-driven operation.

Protocols Recognized

IP TCP UDP ICMP IGMP IGP IGRP OSPF ARP RARP

Non-IP packets will simply be indicated as "Non-IP" and, on Ethernet LAN's, will be supplied with the appropriate Ethernet addresses.

Supported Interfaces

Local loopback All Linux-supported Ethernet interfaces All Linux-supported FDDI interfaces SLIP Asynchronous PPP Synchronous PPP over ISDN ISDN with Raw IP encapsulation ISDN with Cisco HDLC encapsulation Parallel Line IP

Source http://iptraf.seul.org/about.html

Installation

With apt:

apt-get install iptraf

Or download the source:

http://iptraf.seul.org/download.html

Screenshots

Current Connections:

tcp connections

Current Ports:

enter image description here

Summary of all Interfaces:

enter image description here

Detailed per Interface:

enter image description here

Source http://iptraf.seul.org/shots.html

share|improve this answer
    
Can you please explain how to install and use this program? –  Whaaaaaat Aug 29 '14 at 6:49
    
While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. –  LassePoulsen Aug 29 '14 at 6:59
    
Edit: Quoted the "About" page and added titles –  jpillora Aug 29 '14 at 7:34
    
Edit: Added more screenshots, more links –  jpillora Aug 29 '14 at 7:40

I think ifconfig [interface] will do that. Like:

gevorg@gevorg-TravelMate-3260:~$ ifconfig wlan0
wlan0     Link encap:Ethernet  HWaddr 00:18:de:89:52:71  
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

gevorg@gevorg-TravelMate-3260:~$ ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 00:16:36:bf:92:e3  
          inet addr:192.168.10.100  Bcast:192.168.10.255  Mask:255.255.255.0
          inet6 addr: fe80::216:36ff:febf:92e3/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:342765 errors:0 dropped:0 overruns:0 frame:0
          TX packets:306183 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:373934806 (373.9 MB)  TX bytes:39111569 (39.1 MB)
          Interrupt:16 

It shows RX bytes:73934806 (373.9 MB) and TX bytes:39111569 (39.1 MB).

share|improve this answer
    
but this is only the over-all statistic for this session. I would see if the connection is active or not. –  IndexOutOfBoundsException Feb 17 '13 at 10:38
4  
netstat -t -u -c ? –  geoh Feb 17 '13 at 10:41
tcpdump -i eth0 

That will give you a streaming information of all the data flowing from that interface (your ethernet card). Similar to wireshark.

Use ifconfig to see a list of your machines interfaces.

share|improve this answer

Install ’vnstat’ it can show traffic for an interface. You can install some plotting packages to get some nice graphs.

share|improve this answer

Also you could use iftop utility

share|improve this answer

There is a nice tool called speedometer that displays a graph in the terminal using Unicode block characters, colors, and even adds labels to each peak in the graph.

$ sudo apt-get install speedometer
$ speedometer -l  -r wlan0 -t wlan0 -m $(( 1024 * 1024 * 3 / 2 ))

Screenshot after running the previous command

It has several options, can monitor multiple interfaces, can show multiple graphs in several rows or columns, and can even monitor the download speed of a single file (by watching the file size on disk).

share|improve this answer
    
nice tip. thank you :) –  IndexOutOfBoundsException Jun 20 at 15:48

I recently discovered wavemon which can easily be installed using apt-get install wavemon.

This tool provides information especially on the signal level of the wireless network.

share|improve this answer

If you are looking for something extremely simple, but still useful, try ifstat

$ sudo apt-get install ifstat
$ ifstat
       eth0               wlan0       
 KB/s in  KB/s out   KB/s in  KB/s out
    0.00      0.00      0.96      4.79
    0.00      0.00      0.04      0.14

It monitors all interfaces at once, printing a new line every second. Useful to pipe into another script, or to leave running and observe the bandwidth usage over time. Not as pretty as other tools, but it gets the job done.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.