If you are connected to a VPN, this command will return a list of established VPN connections:
nmcli con status | grep -oP '^(([^\s]+\s){1,}[\s]{2,}){4}yes.+$'
This command will list the IDs of any established vpn connections (one per line):
nmcli con status | grep -oP '^(([^\s]+\s){1,}[\s]{2,}){4}yes.+$' | grep -oP '^.*?(?=\s{2,})'
So to disconnect all VPN connections you could do it based on this ID like this:
nmcli con status | grep -oP '^(([^\s]+\s){1,}[\s]{2,}){4}yes.+$' | grep -oP '^.*?(?=\s{2,})' | sed 's/^/\x27/' | sed 's/$/\x27/' | xargs -L1 nmcli con down id
However, perhaps it is better to do this using the UUIDs.
You can list the UUIDs of all established VPN connections like this:
nmcli con status | grep -oP '^(([^\s]+\s){1,}[\s]{2,}){4}yes.+$' | grep -oP '(?<=[\s]{2})[^\s]+(?=(\s+[^\s]+){2}\s+yes.*)'
So you can disconnect all established VPN connections by UUID like this:
nmcli con status | grep -oP '^(([^\s]+\s){1,}[\s]{2,}){4}yes.+$' | grep -oP '(?<=[\s]{2})[^\s]+(?=(\s+[^\s]+){2}\s+yes.*)' | xargs -L1 nmcli con down uuid
Perhaps this logic could be added to nmcli, so that this following proposed option would concisely achieve the same results:
nmcli con down allvpn
If you are connected to a VPN, this command will return a list of established VPN connections: s]+\s){ 1,}[\s] {2,}){4} yes.+$'
nmcli con status | grep -oP '^(([^\
This command will list the IDs of any established vpn connections (one per line): s]+\s){ 1,}[\s] {2,}){4} yes.+$' | grep -oP '^.*?(?=\s{2,})'
nmcli con status | grep -oP '^(([^\
So to disconnect all VPN connections you could do it based on this ID like this: s]+\s){ 1,}[\s] {2,}){4} yes.+$' | grep -oP '^.*?(?=\s{2,})' | sed 's/^/\x27/' | sed 's/$/\x27/' | xargs -L1 nmcli con down id
nmcli con status | grep -oP '^(([^\
However, perhaps it is better to do this using the UUIDs.
You can list the UUIDs of all established VPN connections like this: s]+\s){ 1,}[\s] {2,}){4} yes.+$' | grep -oP '(?<=[\ s]{2})[ ^\s]+(? =(\s+[^ \s]+){2} \s+yes. *)'
nmcli con status | grep -oP '^(([^\
So you can disconnect all established VPN connections by UUID like this: s]+\s){ 1,}[\s] {2,}){4} yes.+$' | grep -oP '(?<=[\ s]{2})[ ^\s]+(? =(\s+[^ \s]+){2} \s+yes. *)' | xargs -L1 nmcli con down uuid
nmcli con status | grep -oP '^(([^\
Perhaps this logic could be added to nmcli, so that this following proposed option would concisely achieve the same results:
nmcli con down allvpn