6

OS: Ubuntu 11.10 with gnome-shell

I've few access points on my saved list which I want to remove and never connect to. I can't seem to find way to delete these.

How should I remove (at least not auto connect) from saved access point list?

5 Answers 5

14
ctrl + t {for terminal prompt}
cd /etc/NetworkManager/system-connections 
sudo rm {wireless_hotspot_name}

Hope that helps

EDIT FROM ONE YEAR LATER

Seems like this turned into a fairly popular answer, so I went ahead and wrote an automated script to do this for everyone. Just copy the below script into into /usr/local/bin/wireless and remember to run command sudo chmod +x /usr/local/bin/wireless

Glad to see this is continually helping fellow *buntu users ;) newest version(s) will be on GitHub

#!/bin/bash
# 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}

##===============================================================##
##===============================================================##

clear

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


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"
    done
}

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}
    fi
}

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}/*
    fi
}

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 <http://gnu.org/licenses/gpl.html>.\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) http://github.com/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 ;;

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

shift $(($OPTIND - 1))

##===============================================================##
##===============================================================##
1
  • 1
    Remind me to rewrite this for 2019 sometime, lol
    – ehime
    Oct 28, 2019 at 17:12
1

Delete all connection never used ( no root needed )

nmcli --fields UUID,TIMESTAMP-REAL con show | grep never |  awk '{print $1}' | while read line; do nmcli con delete uuid  $line;    done
0

Open Network Manager , If you use it its the applet on the top corner . Go to the edit connections menu and click on the wireless tab. Simply delete all the access points you dont need.

1
  • exactly how I used to do it, however can't find it since I shifted to gnome-shell. applet on top corner doesn't open up the list from where I could delete previously (before gnome-shell)
    – wisemonkey
    Apr 9, 2012 at 19:57
0

It seems that from the menu "Edit connections", that you can find clicking on the icon on the top panel (Ubuntu Unity), you can delete only wireless connections. If you have other networks like phone networks you have to delete them in the /etc/NetworkManager/system-connections folder. You have to become root to delete any subfolder in that folder.

For example to remove the network of my HTC evo I had to do:

sudo rm -R /etc/NetworkManager/system-connections/Network\ HTC\ EVO\ 3D\ X515m
0

Aside from the options mentioned in the other answers, you can also use the Network Manager app to forget the network or make it avoid automatic connections, in case you want to keep the network information.

  1. Click on the top, right corner, to show the Wi-fi button. Click on it, and then on Wi-fi Settings (or go there through Settings > Network).
  2. In the network manager, make sure you are on the Wi-fi section (on the left menu), and then click on the gear icon next to the network you want to edit.
  3. A new window will appear. If you want to delete the network, go to the Reset option on the left list, and choose Forget. All data related to that network will be erased and to use it again you will need to supply a password again.
  4. If you just want to avoid connecting automatically, go to the Identity option (also on the left side list) and uncheck the Connect automatically checkbox.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .