According to this link

nmcli dev wifi con a52c60f5-c1af-4d39-8dc8-728bd770bffc password 12345678 name dlink_home

should establish the connection, but it outputs the following error when I try to connect:

Error: 'dev wifi' command 'con' is not valid.

So, how I can connect to wireless internet/network using network-manager or nmcli in command-line mode?

PS. The OS I am running is RHEL6 Server

  • Try dev wlan0 instead.
    – Flup
    Commented Jun 20, 2013 at 11:57
  • Error: 'dev' command 'wlan0' is not valid.
    – easl
    Commented Jun 20, 2013 at 11:59
  • 1
    I tried nmcli con up id dlink_home but it only works after I start GUI with startx, without starting GUI nmcli nm's state is disabled.
    – easl
    Commented Jun 20, 2013 at 12:00
  • See my answer over here: unix.stackexchange.com/a/79434/7453
    – slm
    Commented Jun 20, 2013 at 12:10
  • it does not connect by outputting the error i had mentioned above
    – easl
    Commented Jun 20, 2013 at 12:13

2 Answers 2


Using an 18-month old openSUSE with nmcli -v 0.8.2, I did the following:

nmcli dev wifi

That gave me a list, in which I could spot my own wireless hub. The key columns are SSID and BSSID.

I then used Start Menu-->Control Center-->Network Connections-->Wireless. I had one connection there called "Wireless connection 1". Selecting it, Edit...-->Wireless: fill in SSID and BSSID verbatim from the nmcli command above. Then on Wireless Security page, I entered my hub's password. The "Security" selection was based again on the nmcli output above. OK, Save...

Then (I did this as root; may not be necessary):

nmcli con up id 'Wireless connection 1'

Note the "id" is NOT the SSID or BSSID; instead this is the "nickname" on your computer for this network.

As stated above, /etc/NetworkManager/system-connections holds files of which "Wireless connection 1' is one (in my case).


The capability to define a new connection on the command line with nmcli dev wifi con … was added in NetworkManager 0.9.6. (If you're using Ubuntu, that means release 12.10 or higher.) In earlier versions, new connections can only be defined through the GUI or by editing configuration files manually (in /etc/NetworkManager/system-connections or under ~/.gconf). You can activate an existing connection with nmcli con up.

If you have no GUI to define connections, you can try wicd instead of NetworkManager.

  • 1
    wicd did not work either. It caused more troubles than it solved.
    – Lord Loh.
    Commented Nov 15, 2013 at 21:58

You must log in to answer this question.

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