# Monitor network traffic from console



## ivand58 (Feb 8, 2011)

Hi All, 

how can I make ifconfig to show me the network traffic from console? Or how can I check the network traffic without installing additional package like wireshark?


----------



## SirDice (Feb 8, 2011)

tcpdump(1) mate. No need to install anything, it's in the base.


----------



## dbi (Feb 8, 2011)

What does "monitor" mean? For me it is to determine the speeds from host A to Host B.

`netstat  1`

I like very much "iftop'. It can be installed from ports.


For dumping/sniffing/inspecting the  packet contents (what wireshark does) you can use "tcpdump" like *SirDice* suggested or install "ngrep" from ports.


----------



## ivand58 (Feb 8, 2011)

dbi said:
			
		

> What does "monitor" mean?


Actually I need to know how many bytes are send and received.


----------



## Beastie (Feb 8, 2011)

ivand58 said:
			
		

> Actually I need to know how many bytes are send and received.


`% systat -ifstat`


----------



## vokoda (Feb 16, 2011)

..or if you mean bytes/packet, output of:

[CMD=]tcpdump -v[/CMD]

includes the total length.


----------



## alfikmik (Aug 1, 2017)

also U  can cuse
`bmon`
`trafshow3`
`iftop`
`slurm`


----------



## Jov (Aug 1, 2017)

also:
pftop
ntop


----------



## ankur (Nov 21, 2017)

Beastie said:


> `% systat -ifstat`


I am not able to redirect the output of systat -ifstat to a file .I need extract some values.Can some one help me ?


----------



## SirDice (Nov 21, 2017)

Use netstat(1) to get them.


----------



## ankur (Nov 21, 2017)

SirDice said:


> Use netstat(1) to get them.


Thanks.What about systat -vmstat command.Is there any way to getting the disk i/o on freebsd


----------



## SirDice (Nov 21, 2017)

vmstat(8), iostat(8).


----------



## phoenix (Nov 21, 2017)

And gstat(8).


----------



## ronaldlees (Nov 21, 2017)

ankur : Welcome to the FreeBSD forum!


----------



## ahgu (Mar 15, 2019)

is there a way to display the application that is generating the traffic?


----------



## SirDice (Mar 20, 2019)

ahgu said:


> is there a way to display the application that is generating the traffic?


Not really. Network packets don't contain that information. What exactly are you looking for?


----------



## phoenix (Mar 20, 2019)

ahgu said:


> is there a way to display the application that is generating the traffic?



Sorta, but not really.  And not in a super-duper easy-peasy way.  

You can look at things like net-mgmt/iftop or net/trafshow to see the traffic in action, along with the ports being used to send/receive the traffic.

Then compare that to the output of things like procstat(1), netstat(1), sockstat(1) and the like to get the name of the process that's sending the traffic.  However, that only lists what's currently running, so there's a bit of a race between "finding the port being used to send the data" and "finding the process using that port". If it's a long-running connection/transfer, then you might be able to see it.  But if the sending/receiving process changes ports (new session/connection), then you won't see the old one in the list.


----------

