Celeb Glow
updates | April 03, 2026

nmcli, how to get "connection.id" or "general.name" of device

I am writing a script on 16.04; to show connection identification, especially for VPN connections, by listing active connections with

ip -o link sh up | awk 'BEGIN{FS=": "} $2!="lo" {print $2}'

and getting:

enp0s25
ppp0

Now I want to get/return the Connection NAME, the same as from:

#: nmcli con sh --active
NAME UUID TYPE DEVICE
VPN-pptp-01 22222222-2222-f48f-99d0-817335722def vpn enp0s25
enp0s25 11111111-1111-43c9-9577-112ae6f11abc 802-3-ethernet enp0s25

using the previously return active device ID, especially for ppp0 (from above)

How can this be done using nmcli or perhaps D-Bus?

1 Answer

You can use the following command:

nmcli -t -f NAME c show --active
2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy