ifconfig - How to extract netmask using /sbin/ip? -


i want replace ifconfig /sbin/ip. using ifconfig can see lines

inet addr:xx.xxx.x.xx  bcast:xx.xxx.x.xx  mask:255.255.255.0 

and can parse find netmask (255.255.255.0). how can achieve using /sbin/ip?

running ip a you'll output similar running ifconfig. specifically, you'll see line similar yours:

inet xx.xxx.x.xx/24 brd xx.xxx.x.xx 

the /24 denotes subnet mask in slash notation.


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -