I have around 40 machines and I want to know what are their IP Address. One way is to login into those boxes and figure out their IP Address by using ifconfig command but is there any other simple way I can use to figure out that?I can save all machines in a txt file like this and read it from shell script and then what I should do to figure out IP Addresses?machineAmachineBmachineC
figure out ip addresses of all the machines remotely?
linux;shell;ssh
If you are using DNS you can use tool like host, nslookup, dig to resolve the IP from hostnames.You can use this one liner :while IFS= read -r name; do host $name; done <hosts.txtAlso if you want to get only the IP addresses without the hostnames sequentially, you can use grep :while IFS= read -r name; do host $name | grep -o '[[:digit:]][^ ]*$'; done <hosts.txt