From Fedora Project Wiki

Description

nmcli is a tool that allows NetworkManager management from command line. This tool is useful in those cases in which a graphical frontend is not available.

Connect/disconnect to an already configured connection

List already configured connections

nmcli con list

Connect to a configured connection by name or uuid

nmcli con up id <connection name>
nmcli con up uuid <uuid>

Disconnection by name or uuid

nmcli con down id <connection name>
nmcli con down uuid <uuid>

Network interfaces

List available devices and their status

nmcli dev status

Disconnect an interface

nmcli dev disconnect iface <interface>

Wifi

Get Wifi status

nmcli nm wifi

Turn wifi on or off

nmcli nm wifi <on|off>

List available access points(AP) to connect to

nmcli dev wifi list

Create a new connection to an open AP

nmcli dev wifi connect <SSID|BSSID>

Modify an already configured connection

Open with a text editor the configuration file of the connection. The file is located in "/etc/sysconfig/network-scripts/" under the name of "ifcfg-<connection name>"

Connect automatically to that connection

Edit to or add the line "ONBOOT=yes"

Make the connection available only to one user

Edit or add the line "USERS=<username>"

Spoof MAC address

Edit or add the line "MACADDR=<spoofed MAC>". Don't change the line "HWADDR=<real MAC>" to spoof your MAC address.


Finally save the file and to apply changes to an already active connection execute

nmcli con up id <connection name>

Edit a connection password

To modify a connection password open with a text editor and edit the file "keys-<connection id>" located in "/etc/sysconfig/network-scripts/". The password is stored in plain text

Delete a connection

nmcli con delete id <connection name>

Notes

nmcli maybe contain some bugs and lack some features graphical tools for NetworkManager have.

To see available options for nmcli deeper

man nmcli

Links

[1]