Knowledge Base

Commands to Get Private IP Address

  1. ifconfig -a*
  2. /sbin/ip addr or /sbin/ip a
  3. hostname -I | awk '{print $1}'
  4. /sbin/ip route get 1.2.3.4 | awk '{print $7}'
  5. nmcli -p device show
  6. /sbin/ip -4 addr show eth0

*ifconfig is part a of net-tools which is not installed by default. To install net-tools:

sudo apt install net-tools