List the network devices on your system easily
The ethstats command available on a Linux system allows you to show the network interfaces installed in your machine and the data transfer rates if they are connected to a network and they are not idle.
Install this script using this command.
ubuntu ~ $ sudo apt install ethstats |
Example usage of this command is shown below. This shows the amount of data transferred over the network. I was only using an SSH connection in this example, this does not show much data transferred.
ubuntu ~ $ ethstats total: 0.00 Mb/s In 0.00 Mb/s Out - 1.0 p/s In 0.0 p/s Out eth0: 0.00 Mb/s In 0.00 Mb/s Out - 1.0 p/s In 0.0 p/s Out tun1194: 0.00 Mb/s In 0.00 Mb/s Out - 0.0 p/s In 0.0 p/s Out total: 0.00 Mb/s In 0.00 Mb/s Out - 0.2 p/s In 0.9 p/s Out eth0: 0.00 Mb/s In 0.00 Mb/s Out - 0.2 p/s In 0.9 p/s Out tun1194: 0.00 Mb/s In 0.00 Mb/s Out - 0.0 p/s In 0.0 p/s Out total: 0.00 Mb/s In 0.00 Mb/s Out - 0.2 p/s In 0.9 p/s Out eth0: 0.00 Mb/s In 0.00 Mb/s Out - 0.2 p/s In 0.9 p/s Out tun1194: 0.00 Mb/s In 0.00 Mb/s Out - 0.0 p/s In 0.0 p/s Out total: 0.00 Mb/s In 0.00 Mb/s Out - 0.2 p/s In 0.2 p/s Out eth0: 0.00 Mb/s In 0.00 Mb/s Out - 0.2 p/s In 0.2 p/s Out tun1194: 0.00 Mb/s In 0.00 Mb/s Out - 0.0 p/s In 0.0 p/s Out total: 0.00 Mb/s In 0.00 Mb/s Out - 0.2 p/s In 0.2 p/s Out eth0: 0.00 Mb/s In 0.00 Mb/s Out - 0.2 p/s In 0.2 p/s Out tun1194: 0.00 Mb/s In 0.00 Mb/s Out - 0.0 p/s In 0.0 p/s Out ^C |
This is another useful Linux command to try out occasionally. The dstat utility may also show the same information. The below example will show a live-updating feed of network packets transferred to and fro.
ubuntu ~ $ dstat --net -net/total- recv send 0 0 80B 562B 40B 244B 40B 244B 40B 244B 40B 244B 40B 244B 40B 244B^C |
This is how to list the currently active network device(s) and the IP address of the device.
┌──[jason@11000000.10101000.00000001.00000011]─[~] └──╼ ╼ $ ip a | grep "inet " |awk 'NR==2{print $2,$9}' 192.168.1.3/24 enp0s25 |
A very simple one-liner.
That’s great!