get only ip not ipv6 linux code example
Example 1: show ip address linux
$ hostname -I
Example 2: get your ip address from terminal
for local ip :
hostname -I
for Public ip :
curl icanhazip.com
$ hostname -I
for local ip :
hostname -I
for Public ip :
curl icanhazip.com