Advertisement: Linux VPS for $4/month - based on OpenVZ, credit card accepted, automatic setup.
+ Post New Thread
Results 1 to 2 of 2

Thread: Command to show/discover Linux server public IP address

  1. #1
    Fli
    Fli is online now
    Administrator Fli's Avatar
    Join Date
    Mar 2013
    Posts
    2,464

    Command to show/discover Linux server public IP address



    Hello,

    how on any Linux distribution i can get an IP address of the server i am working on? Which command to use , how to discover server IP on Linux?

    i mean by command and output is plain IP not anything else..

    Update:

    working for VPS & dedi:
    Code:
    hostname -i
    curl http://myip.dnsomatic.com
    curl http://cpanel.com/showip.shtml
    this worked on dedi servers:
    Code:
    /sbin/ifconfig|grep inet|sed 's/\:/ /'|awk 'NR==1 {print $3}'
    Works for VPS & dedi and is independent, default Linux based:
    Code:
    ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1'|head -n 1

  2. #2
    Junior Member Hostfinch's Avatar
    Join Date
    Jul 2018
    Posts
    14


    Is this useful / helpfull? Yes | No
    You can use this command:
    dig +short myip.opendns.com @resolver1.opendns.com

+ Post New Thread

Similar Threads

  1. Replies: 0
    Last Post: 05-30-2017, 09:57 AM
  2. Replies: 0
    Last Post: 03-21-2016, 01:05 PM
  3. Replies: 0
    Last Post: 09-20-2015, 08:41 PM
  4. Replies: 0
    Last Post: 11-22-2014, 03:42 PM
  5. How to read linux bash command output and discover if match.
    By Fli in forum Programming, scripting
    Replies: 0
    Last Post: 10-25-2013, 08:17 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
 Protected by : ZB BLOCK  &  StopForumSpam