I want to count the number of entries starting with the string "tun" that I get as output of the command ifconfig.
For example, if this is my output, I want to count to be 2. I tried to play around with grep, but it is still not solved.
docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 172.0.0.1 netmask 255.255.0.0 broadcast 172.17.255.255
ether 02:42:16:73:86:ba txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
enp0s31f6: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 00:00:00:00:00:00 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 16 memory 0xa1300000-a1320000
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 :: prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 905 bytes 80293 (80.2 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 905 bytes 80293 (80.2 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
tun0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1500
inet 00.00.00.00 netmask 255.255.255.255 destination 192.168.105.77
inet6 :: prefixlen 64 scopeid 0x20<link>
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 100 (UNSPEC)
RX packets 438 bytes 52174 (52.1 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 457 bytes 33911 (33.9 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
tun1: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1500
inet 0.0.0.0 netmask 255.255.255.255 destination 192.168.104.61
inet6 :: prefixlen 64 scopeid 0x20<link>
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 100 (UNSPEC)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 10 bytes 584 (584.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0