Posts

Showing posts from November, 2021

Getting netmask in Linux

  https://stackoverflow.com/questions/33150176/get-subnet-mask-in-linux-using-bash there are couple of ways to achieve this: first: to print the mask in format 255.255.255.0, you can use this: /sbin/ifconfig wlan0 | awk '/Mask:/{ print $4;} ' second: we can use ip command to get the mask in format 192.168.1.1/24 ip -o -f inet addr show | awk '/scope global/ {print $4}'