Linux: How to get a machine's IP address? [duplicate]
Solution 1:
Here are ways to get your Linux machine IP address:
/sbin/ifconfig
If you know the name of your Network Interface card, you can specify it in the command and get the results for that specific NIC:
/sbin/ifconfig eth0
Another command is:
/sbin/ip addr
If you know the name of your Network Interface card, you can specify it in the command and get the results for that specific NIC:
/sbin/ip addr show eth0
I think this is the best way:
hostname -i
Bare in mind that in some servers you might have more than one Network Interfacr Cards...