Linux / Unix: Look Up IP Addresses

Linux / Unix: Look Up IP Addresses

To find the IP address of a host on a Linux or Unix system, you can use the ping command with the -c option to specify the number of pings to send, followed by the hostname or IP address of the host you want to look up:

refer to:‮‬lautturi.com
ping -c 1 hostname

For example, to look up the IP address of www.example.com, you can run the following command:

ping -c 1 www.example.com

This will send a single ping to the host and display the IP address of the host in the output.

Alternatively, you can use the dig command to look up the IP address of a host. The dig command is a utility for querying DNS name servers for information about host addresses, mail exchanges, and other DNS records. To use dig, simply enter the following command, replacing "hostname" with the hostname you want to look up:

dig hostname

This will return the IP address of the host, as well as other information about the host's DNS record.

You can also use the host command to look up the IP address of a host. The host command is similar to the dig command, but it has a simpler output and is easier to use. To use host, simply enter the following command, replacing "hostname" with the hostname you want to look up:

host hostname

This will return the IP address of the host.

Finally, you can use the nslookup command to look up the IP address of a host. nslookup is a command-line utility that allows you to query the Domain Name System (DNS) to determine the IP address associated with a domain name, or to determine the domain name associated with an IP address. To use nslookup, enter the following command, replacing "hostname" with the hostname you want to look up:

nslookup hostname

This will return the IP address of the host.

Created Time:2017-10-29 22:08:59  Author:lautturi