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
    Administrator Fli's Avatar
    Join Date
    Mar 2013
    Posts
    2,422
    Post Thanks / Like
    Blog Entries
    1

    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
    Post Thanks / Like


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

+ Post New Thread

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