Option for nmcli command to get only the name of the NetworkManager connection profiles

I know that by the execution of the command:

nmcli con show

I get the list of all connection profiles present in the Linux system. For example if I execute the previous command in my Linux Mint system I obtain:

$ nmcli con show
NAME             UUID                                  TYPE      DEVICE   
lan0             b89ebc2f-8702-32d1-8dbf-e8d4cf226ce1  ethernet  enp0s25  
lan1             bd0a02cf-65e9-3cf5-8b51-ef05aa204e7c  ethernet  enp5s0f0 
lan2             4b5d75d9-cab9-3ac5-95e5-cbeddf257cc5  ethernet  enp5s0f1 
lan1 with space  63b628f9-7671-41a4-8d2a-be5cfa34c454  ethernet  --       
lan2 with space  1cd1fb7d-0c5d-4105-ba27-c7e6ce7b6ecb  ethernet  --      

In the example the NAME of the connection profiles contain spaces (see lan1 with space and lan2 with space).

My need is to execute the previous command and get only the list of the NAME of the connection without the column UUID, TYPE, DEVICE.

In the previous example my wished output would be:

lan1 with space
lan2 with space

Is there an option for the command nmcli which gives exactly the previous output?

Asked By: frankfalse


Use it with -g (or --get-values) to print only the values for the NAME field:

nmcli -g NAME con
Answered By: don_crissti
Categories: Answers Tags:
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.