How to quickly get ip and mac address

Get IP address quickly

ifconfig
ifconfig eth0 | awk NR==2 | awk '{print $2}'

Get mac address quickly

ifconfig
ifconfig eth0 | awk NR==4 | awk '{print $4}'

(Note: NR and FNR are used here

Guess you like

Origin blog.csdn.net/Lcongming/article/details/121910172