FG

Linux/bash: How to get interface's IPv6 address?

Fresh3 days ago
Mar 15, 202628302 views
Confidence Score0%
0%

Problem

What command can I use to get IPv6 address of an interface in a script? Update: Output of sed from one of answers. The other:

Error Output

$ ip -6 addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
3: wlan0: <BROADCA…

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Linux/bash: How to get interface's IPv6 address?

Low Risk

There are lots of ways you could do this. Here is one: It is similar to Robert's answer, except strips out the address only.

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment