title: How to get ip address of a server on Centos 7 in bash
body: <p>Previously I used the following command in bash to find the main ip of my server</p>
  
  <pre><code>ipaddr=$(/sbin/ifconfig|grep inet|head -1|sed 's/\:/ /'|awk '{print $3}' | grep -v '127.0.0.1')
  </code></pre>
  
  <p>But in centos7 it no longer works since ifconfig isn't available and the command no longer works even if I install <code>ifconfig</code> using <code>yum install net-tools</code></p>
  
  <p>What is the equivalent command for centos 7</p>
  
  <p>Thanks a lot</p>