There are many different ways to get the IP of the current server on linux machines which causes a lot of conflict across the different variations. Not all operating systems use the same command and sometimes the command used is not built in as part of the operating system. If you are running the minimal install of Centos 7 you will find that the standard command “ifconfig” does not exist. You could install this if you wish, but there are methods to obtain this using the tools you have available already. There are 2 possible ways to get the IP address.
This will dump out quite a bit of info, the import part being the IP address of the server. This can be a bit messy, but is a more reliable method of obtaining the servers IP. If you want a quick an easy way of finding out what it is, you can run the following command to display just the IP. This is not as reliable and will sometimes return a blank value for a server that has not been configured correctly.