Windows and Linux

How many times in a day do you have a hostname and you want to know the IP address? Hostname to IP address and IP address to hostname conversion is one of the frequent things which we need to do for many things when dealing with networking commands in Unix. For one command we need an IP address for others we need a hostname even from bash script sometimes we require a hostname and sometimes we look for an IP address.Read more: linux online training

Networking commands are not as popular as find command or grep command but they are equally important and if you working in Windows or UNIX environment you must learn them and they should also be included in any list of 

By the way, In this hostname to IP address tutorial, I will show you how to get the IP address from host name or computer name in Unix or Linux and how to get hostname if you have an IP address. If you are looking for a way to do it via the Java program then you can also see my post on how to find the IP address of the local host in Java.Read more: linux online training



Finding IP address from hostname in UNIX and Linux Example

If you are working in a UNIX network and have lots of machines in LAN (Local Area Network),  many times you want to know the IP address of computers from the hostname. 

Here are the top 4 ways of getting an IP address from hostname in Linux or UNIX machine

1) IP address using hostname command in Unix/Linux


This is the easiest way of finding the IP address of your computer but the limitation is that sometimes this option may or may not available in your UNIX machine e.g. I hardly find this command on Solaris and IBM AIX machines but they are mostly available on Linux Servers. also, a limitation of the hostname is that you can not find the IP address of any other machine. It's like finding IP address of the localhost Read more: linux online training


It can also be used to find the IP address of your own host or any other machine in the network. In the above example of nslookup, we have displayed IP address associated with trading_system. If you want to find hostname from IP address you can just provide IP address instead of host

It can also be used to find the IP address of your own host or any other machine in the network. In the above example of nslookup, we have displayed IP address associated with trading_system. If you want to find hostname from IP address you can just provide IP address instead of host

Read more: linux online training

Comments