Tag Archives: interface

Simple shell script to know your Linux systems Interface IP’s

Below is the simple shell script  which tells simply scan all interface in Linux system and tells which interface  have what IP assigned.

#!/bin/bash

ip r l |grep kernel|awk ‘{print $3}’|paste -sd” “|while read line
do
ARRAY=$line

for i  in $ARRAY
do
IPREAD=`ip r l |grep ‘kernel’|grep $i|awk ‘{print $9}’`

echo “Interface:$i having $IPREAD IP assigned”
done

done

Sample Output:

Interface: wlan0   having  192.168.X.X   IP  assigned
Interface: virbr0   having  192.168.X.X   IP assigned

 

 

 

 

 

 

 

 

 

Advertisements