get ip address in linux cli 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: show ip address linux
$ hostname -I
#private ip
hostname -I
or
ifconfig
or
ip addr show
#public ip
curl ifconfig.me
$ hostname -I