Announcement

Collapse
No announcement yet.

How to get list of IP addresses assigned to the server quickly

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to get list of IP addresses assigned to the server quickly

    Yes we will use the convention ifconfig command but the trick lies below which simply lists all the IP assigned to the particular server or the VPS.

    Use the below one liner:

    $ /sbin/ifconfig | grep 'inet addr' | awk '{print $2}' | cut -c6-

    Example:

    [[email protected] ~]# /sbin/ifconfig | grep 'inet addr' | awk '{print $2}' | cut -c6-
    127.0.0.1
    127.0.0.2
    127.0.0.3

  • #2
    Re: How to get list of IP addresses assigned to the server quickly

    Hi PerryK,

    Nice trick.......this is the really useful command....cheers.....

    Comment


    • #3
      Re: How to get list of IP addresses assigned to the server quickly

      Originally posted by EUK-PerryK View Post
      $ /sbin/ifconfig | grep 'inet addr' | awk '{print $2}' | cut -c6-
      This could be exceptionally handy for those of use that use nginx and need to regenerate vhost entries. Can you use your scripting skills to combine the command with the following?

      perl -pi -w -e 's/server_name(.*) IP here/server_name$1/g;' *

      Regards,
      EJ
      sigpicManaged osCmax hosting
      (I'm not social )

      Comment

      Working...
      X