Networking/Computing Tips/Tricks

Rate this content:
5 of 5 - 4 votes
Thank you for rating this article.

If you attend our WLAN Operations course, one of the things we discuss is Active Scanning.  Your system uses your saved Wi-Fi networks to actively scan for those networks (probing).  There are potential security risks in this, especially with free networks.  Most students conclude they should not remember networks in this way. 

The burning question that remains is: How can I view the list of saved networks easily on my Windows or MAC OSx or Linux system?

And perhaps more crucially: How can I delete these remembered networks?

It is actually not very hard.  Let's start with WIndows.


Below I have started Windows Powershell: Start> Powershell will cause Windows to search for the program.  You could use the Windows CMD as well, but I have been trying to train myself to use Powershell instead.

Then I have entered the following command:

netsh wlan show profiles

Here is the result:


Look at all those saved Wi-Fi profiles.  The list was truncated BTW.  This means I am probing for all these!

OK - so I now want to clear them ALL out.  Here is the command:

netsh wlan delete profile *

Again here is a screen shot:


Now if I rerun the show profiles they are all empty:




Open Terminal from your launcher.

In the terminal, enter the following command:

networksetup -listpreferredwirelessnetworks en0

You will get a list of the saved Wireless networks.  Here is a truncated example:

Screen Shot 2017 11 25 at 10.43.38 AM

To delete them all, use the following command:

networksetup -removeallpreferredwirelessnetworks en0

You should see something like this:

Screen Shot 2017 11 25 at 10.47.12 AM

And now you can verify the list is not there:

Screen Shot 2017 11 25 at 10.49.10 AM

You can also verify this by going to Settings> Network> Advanced to see the list is empty:

Screen Shot 2017 11 25 at 10.51.02 AM


Linux (Debian)

Open a Terminal Window.

In the terminal, enter the following command:

ls /etc/NetworkManager/system-connections

You will get a list of the saved Wireless networks.  Here is a truncated example:

2019 10 30 14 37 52

You can then delete these one by one, or delete them all with the following example commands:

cd /etc/NetworkManager/system-connections 
sudo rm {wireless_hotspot_name}

 I did find a script that does this.  You can find the Gihub repository here: 

Just copy the below script into into /usr/local/bin/wireless and remember to run command sudo chmod +x /usr/local/bin/wireless

# Review and Remove Wireless Access Points on DEB based Systems
# Make sure to place script in /usr/local/bin 

# CPR : Jd Daniel :: GabelBombe
# MOD : 2013-12-09 @ 12:27:02

# INP : $ wireless -{flag} {arg}



# If the user is not root
if [ "$(id -u)" != "0" ]; then
  echo "This script must be run as root" 1>&2 ; exit 1

declare -r VERSION='1.2b'
declare -r net_dir='/etc/NetworkManager/system-connections'

function list ()
  cd "${net_dir}"

    export count=$(ls |wc -l) # used in drop function

  files=$(ls) # simple ls

  echo -e "\n\tFound ${count} wireless connections"

    for f in $files; do
        echo -e "\t * $f"

function drop ()
  # make sure that we have a working file and directory...
  cd "${net_dir}" ; [ -f "$OPTARG" ] || { echo -e "\n\tConnection does not exist..." ; exit 1; }

  # confirmation for removal
  printf "\n\tDo you want to delete $OPTARG [y/n] " ; read -r resp

    # strtolower, and rm
    if [ 'y' == "$(echo $resp | awk '{print tolower($0)}')" ]; then
      rm -f ${net_dir}/${OPTARG}

function flush ()
  # make sure that we have a directory with files...
  cd "${net_dir}" ; list ; [ 0 -ge "${count}" ] && { echo -e "\tExiting, Nothing to flush..." ;  exit 1 ; }

  # confirmation for removing all files
  printf "\n\tAll Wireless Connections will be removed, continue? [y/n] " ; read -r resp

    # strtolower, and rm
    if [ 'y' == "$(echo $resp | awk '{print tolower($0)}')" ]; then
      rm -f ${net_dir}/*

function version ()
  echo -e "\n\twireless (GNU wireless network purge) v${VERSION}"
  echo -e "\n\tCopyright (C) 2013 Hydra Code, LLC."
  echo -e "\tLicense GPLv3+: GNU GPL version 3 or later <>.\n\tThis is free software: you are free to change and redistribute it.\n\tThere is NO WARRANTY, to the extent permitted by law."
  echo -e "\n\n\tWritten by Jd Daniel (GabelBombe)"
  exit 0

function help ()
  echo -e "\n\tUsage: wireless [OPTION]... [FILE]..."
  echo -e "\tList, remove single or flush the contents of your Wireless Network Manager"
  echo -e "\n\tThe options below may be used to perform the above actions, this program will only"
  echo -e "\trun a single flag or parameter at a time. Flag chaining is only available for -d"
  echo -e "\t  -l, --list \t\t List the contents of your 'Network Manager'"
  echo -e "\t  -d, --drop [conn] \t Drop a single (or multiple) wireless connections"
  echo -e "\t  -f, --flush \t\t Flush all wireless connections."
  echo -e "\t      --help \t\t Display this help menu and exit"
  echo -e "\t      --version \t Display version information and exit"
  exit 0


# no long-opts supported except --help
while getopts ':ld:f-:' OPT; do
  case $OPT in

    l) list  ;;
    d) dirList="${dirList} $OPTARG" ; drop  ;;
    f) flush ;;
    -) #long option
       case $OPTARG in

          list)     list    ;;
          drop)     drop    ;;
          flush)    flush   ;;
          help)     help    ;;
          version)  version ;;

    : ) echo -e "\n\tMissing option argument for -$OPTARG" >&2;               exit 1;;
    * ) echo -e "\n\tUnknown flag supplied ${OPTARG}\n\tTry wireless --help"; exit 1;;

shift $(($OPTIND - 1))



Hope all this helps!  You comments and suggestions are welcomed below.


Add comment


Did you learn something?
Did I save you time? 

Buy me a coffeeBuy me a coffee!

Find by Tag

5G Networks 6LoWLAN 6LoWPAN 802.11 802.11ah 802.11ax 802.11ay 802.11az ACL Addressing Analysis Ansible Architecture ARP Assessment AToM Backup Bandwidth BGP Bibliography Biography Briefings CBRS CellStream Cellular Central Office Cheat Sheet Chrome Cisco Clock Cloud Computer Consulting CPI Data Center Data Networking Decryption DHCPv4 DHCPv6 Display Filter DNS Documentation ECMP EIGRP Ethernet Ethics Flipping the Certification Model Follow Me Fragmentation Git GNS3 Google GQUIC Hands-On History Home Network HTTPS ICMP ICMPv6 IEEE 802.11p IEEE 802.15.4 In A Day Internet IOS Classic IoT IPv4 IPv6 L2 Switch L2VPN L3VPN LDP Learning Services Linux LLN Logging LoL M-BGP MAC MAC OSx Macro Microsoft mininet Monitoring Monitor Mode MPLS Multicast Name Resolution Netflow NetMon netsh Networking Network Science nmap Npcap nslookup Online Learning Online School OpenFlow OSPF OSPFv2 OSPFv3 OSX Parrot PIM Ping Policy POTS POTS to Pipes PPP Profile Profiles Programming Project Management Python QoS QUIC Requirements RFC RIP Routing RPL RSVP Rural SAS SDN Security Self Certification Service Provider Services Sharepoint Small Business Smartport SONET Speed SSH SSL Subnetting T-Shark TCP TCP/IP Telco Telecom 101 Telecommunications Telephone Telnet Terminal TLS Tools Traceroute Traffic Analysis Traffic Engineering Training Travel Tunnel Utility Video Virtualbox Virtualization Voice VoIP VXLAN Webex Wi-Fi Wi-Fi 4 Wi-Fi 5 Wi-Fi 6 Wi-Fi 6/6E Windows Wireless Wireless 5G Wireshark Wireshark Tip WLAN ZigBee Zoom

Twitter Feed