Depending on what software you have installed the best way to get you external IP is running the following command
# echo $(wget -qO - https://api.ipify.org) OR # echo $(curl -s https://api.ipify.org)
while getting the internal IP can be achieved with
# ifconfig | grep -w inet | awk '{ print $2}' OR # ip a s | grep -w inet | awk '{ print $2}'