Skip to content

Instantly share code, notes, and snippets.

@dzintars
Last active January 4, 2022 17:18
Show Gist options
  • Save dzintars/2670cadf4d6ca4e969b786391d226bfc to your computer and use it in GitHub Desktop.
Save dzintars/2670cadf4d6ca4e969b786391d226bfc to your computer and use it in GitHub Desktop.
#!/bin/bash
# Author: Dzintars Klavins
# This script will delete all network connections and devices.
# WARNING!!! Network connection will be lost!
# Delete all existing connections.
# All credits to: https://www.rene-pickhardt.de/index.html%3Fp=1955.html
for i in `nmcli c | \
grep -o -- "[0-9a-fA-F]\{8\}-[0-9a-fA-F]\{4\}-[0-9a-fA-F]\{4\}-[0-9a-fA-F]\{4\}-[0-9a-fA-F]\{12\}"` ; \
do nmcli connection delete uuid $i ; \
done
# Delete all devices.
for i in `nmcli d | \
grep -o -- "[0-9a-fA-F]\{8\}-[0-9a-fA-F]\{4\}-[0-9a-fA-F]\{4\}-[0-9a-fA-F]\{4\}-[0-9a-fA-F]\{12\}"` ; \
do nmcli device delete uuid $i ; \
done
nmcli device -show
nmcli connection -show
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment