Linux command line find ip

For example, we know that Type the following into a terminal window:. The host command by default returns just enough information but you can get a more detailed output by using either the -d or -v switch as follows:. The results from the above command show the domain that was looked up along with any results. It also returns the SOA details for a domain.

SOA stands for Start of Authority. If you register a domain name and then host that domain with a web hosting company , the web hosting company must maintain an SOA for that domain. It provides a way of keeping track of domain names. There are a number of results returned but they all contain the same fields which are as follows:. In general, you will probably only need to use the host command to return either the IP address for a domain name or the domain name for an IP address.

Share Pin Email. Updated October 29, The following results will be displayed:. INT reverse lookup. To return the IP address for a domain name, simply type the following command:. For example, to find the domain name for linux. The results from the host command will be as follows:.

How to find your IP address in Linux

You can do this by typing the following into a terminal window:. B: Outputs are indicative and not real. Z9iT, Sure..

It should work in any linux distribution provided that you have wget installed. As said if you have either curl or lynx already available please use that instead. The commands with ifconfig do only work, if you are not behind a NAT. This proposal using dig is pretty nice unix. The last version without external services only works, if your computer is connected directly to the internet which is rarely the case, otherwise you only get your local IP address.

My favorite has always been : curl ifconfig. You will have to install curl first ; If ifconfig.

Other ways to find the IP address of your system in Linux

Panther Panther Z9iT, I just checked this now. Yes, it would output the external ip in your terminal. The response time from ifconfig.

If you don't have curl but have wget : wget -U curl -qO- ifconfig. AsfandYarQazi - working here. You can try one of the alternates , icanhazip. I had to try many suggested above until I found some that is IPv6-capable. It's a shame that such services are usually still IPv4-only. I've found everything to be annoying and slow, so I wrote my own. It's simple and fast. Pierre Carrier Pierre Carrier 1, 8 8 silver badges 8 8 bronze badges.


  1. Search our Knowledge Base.
  2. birth certificate in boston ma.
  3. burt wolf and his background information?
  4. clark county district court records online.

Woah, that was really fast! I find the icanhazip. Yes, it was indeed faster lately. Just tweaked my solution. Well done. This is really fast.


  • where can i look at free death records.
  • people mobile number search in singapore.
  • marriage license copies houston texas.
  • department of motor vehicles new york locations.
  • Public or private IPs in a jiffy, whatever your OS.
  • free search for berks county warrants.
  • I did one warmup execution, then 10 executions each of this and curl icanhazip. Average for the curl version: ms. Average for the DNS-only version: 9ms. See also: unix. AdamMonsen Thank you for the link.

    The point of using DNS as the answer that you've linked says is that the response is standard and unlikely to change and the service OpenDNS might stick around longer than most of its http alternatives. The time it takes to make the request might be shadowed by the command start up time. I wouldn't be surprised if curl itself is slower than dig. The one i'm using is : wget -O - -q icanhazip.

    I prefer curl icanhazip. Either way curl icanhazip. Type in this exactly, press Enter where indicated: telnet ipecho. Connected to ipecho. Liam Liam 1 1 silver badge 2 2 bronze badges. Another fast one might well be the fastest, relatively curl ipecho. Mohnish Mohnish 2 2 silver badges 4 4 bronze badges. D Mapped address: W. Z where A. Using sed you can reduce the output above to only an IP address: stunclient stun. Working, but not recommended for production use :- P. Victor Klos Victor Klos 2 2 silver badges 5 5 bronze badges. The http query works, which is what I've been using all my life, but I like that there's actually been some thought put into the question.

    I didn't know this. I have a stupid service for this by telnet. Something like this: telnet myip. Dan 7, 5 5 gold badges 47 47 silver badges 76 76 bronze badges. Gelma Gelma 97 1 1 silver badge 3 3 bronze badges. This combined with checkip. You should try getting the IP address of the router grammatically.

    Find How Linux Get IP Address From Command

    Wilf Wilf The -s component means silent i. If you have installed lynx in Ubuntu type lynx bot. Binny Binny 3 3 bronze badges. Eliran Malka Eliran Malka 16 16 silver badges 34 34 bronze badges. Maybe I am a little late, but inxi can do it fairly easy. Terrance Terrance Simply issue a traceroute for any website or service.. This answer is too inaccurate to be useful. In my corporate environment I don't get my IP address at all.

    The only way it works is if you understand how your local routers and switches are crafted, and even then it may not be on line 2 depending on the number of local hops you jump through. There's no way to make a coherent algorithm out of this technique, and there are many other solutions here that are simpler and will get you the proper answer every time.