Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #256278

Re: what's the right way to resolve localhost's IPs

From Tom Furie <tom@furie.org.uk>
Newsgroups linux.debian.user
Subject Re: what's the right way to resolve localhost's IPs
Date 2023-03-22 22:20 +0100
Message-ID <Gce2d-enkx-7@gated-at.bofh.it> (permalink)
References <GbViV-ebLW-5@gated-at.bofh.it> <GbW5j-ech4-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On Wed, Mar 22, 2023 at 10:06:40AM +0800, Jeremy Ardley wrote:
> You can also output in .json format
> 
> root@debian12:~# ip -j a
> [{"ifindex":1,"ifname":"lo","flags":["LOOPBACK","UP","LOWER_UP"],"mtu":65536,"qdisc":"noqueue","operstate":"UNKNOWN","group":"default","txqlen":1000,"link_type":"loopback","address":"00:00:00:00:00:00","broadcast":"00:00:00:00:00:00","addr_info":[{"family":"inet","local":"127.0.0.1","prefixlen":8,"scope":"host","label":"lo","valid_life_time":4294967295,"preferred_life_time":4294967295},{"family":"inet6","local":"::1","prefixlen":128,"scope":"host","valid_life_time":4294967295,"preferred_life_time":4294967295}]},{"ifindex":2,"ifname":"enp0s3","flags":["BROADCAST","MULTICAST","UP","LOWER_UP"],"mtu":1500,"qdisc":"fq_codel","operstate":"UP","group":"default","txqlen":1000,"link_type":"ether","address":"08:00:27:18:b6:ac","broadcast":"ff:ff:ff:ff:ff:ff","addr_info":[{"family":"inet","local":"10.31.40.166","prefixlen":24,"broadcast":"10.31.40.255","scope":"global","dynamic":true,"label":"enp0s3","valid_life_time":81787,"preferred_life_time":81787},{"family":"inet6","local":"2403:5800:c101:b700:a00:27ff:fe18:b6ac","prefixlen":64,"scope":"global","dynamic":true,"mngtmpaddr":true,"valid_life_time":6638,"preferred_life_time":3037},{"family":"inet6","local":"fe80::a00:27ff:fe18:b6ac","prefixlen":64,"scope":"link","valid_life_time":4294967295,"preferred_life_time":4294967295}]}]
> 
> and if you write a script like this (and make it write protected and
> executable)

Or...

ip -o a | awk '{print $2, $4}'

Cheers,
Tom

-- 
My mother is a fish.
		-- William Faulkner

Back to linux.debian.user | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

what's the right way to resolve localhost's IPs fh@dnsbed.com - 2023-03-22 02:20 +0100
  Re: what's the right way to resolve localhost's IPs Jeremy Ardley <jeremy@ardley.org> - 2023-03-22 03:10 +0100
    Re: what's the right way to resolve localhost's IPs fh@dnsbed.com - 2023-03-22 03:40 +0100
    Re: what's the right way to resolve localhost's IPs Gregory Seidman <gsslist+debian@anthropohedron.net> - 2023-03-22 21:40 +0100
    Re: what's the right way to resolve localhost's IPs Tom Furie <tom@furie.org.uk> - 2023-03-22 22:20 +0100
      Re: what's the right way to resolve localhost's IPs Greg Wooledge <greg@wooledge.org> - 2023-03-22 22:50 +0100
        Re: what's the right way to resolve localhost's IPs Jeremy Ardley <jeremy@ardley.org> - 2023-03-23 00:10 +0100
          Re: what's the right way to resolve localhost's IPs Greg Wooledge <greg@wooledge.org> - 2023-03-23 00:40 +0100
            Re: what's the right way to resolve localhost's IPs Jeremy Ardley <jeremy@ardley.org> - 2023-03-23 01:00 +0100
              Re: what's the right way to resolve localhost's IPs Nicolas George <george@nsup.org> - 2023-03-23 08:50 +0100
                Re: what's the right way to resolve localhost's IPs Jeremy Ardley <jeremy@ardley.org> - 2023-03-23 09:00 +0100
                Re: what's the right way to resolve localhost's IPs Lee <ler762@gmail.com> - 2023-03-23 12:00 +0100
  Re: what's the right way to resolve localhost's IPs Emanuel Berg <incal@dataswamp.org> - 2023-03-30 07:50 +0200
    Re: what's the right way to resolve localhost's IPs fh@dnsbed.com - 2023-03-30 10:10 +0200

csiph-web