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 is online now
    Join Date
    Mar 2013

    Command to show/discover Linux server public IP address


    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..


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

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

    Is this useful / helpfull? Yes | No
    You can use this command:
    dig +short

+ Post New Thread

Similar Threads

  1. Replies: 0
    Last Post: 05-30-2017, 10:57 AM
  2. Replies: 0
    Last Post: 03-21-2016, 02:05 PM
  3. Replies: 0
    Last Post: 09-20-2015, 09:41 PM
  4. Replies: 0
    Last Post: 11-22-2014, 04: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, 09: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