assign ip on linux code example
Example 1: display ip address linux
#private ip
hostname -I
or
ifconfig
or
ip addr show
#public ip
curl ifconfig.me
Example 2: new ip linux
Get new ip from DHCP (If not working, check your connection to router)
//Release ip
sudo dhclient -r [Interface name](optional)
//Renew ip
sudo dhclient [Interface name](optional)