nmcli command in Linux with Examples

nmcli is a command-line tool which is used for controlling NetworkManager. nmcli commnad can also be used to display network device status, create, edit, activate/deactivate, and delete network connections.

Typical Uses:

  • Scripts: Instead of manually managing the network connections it utilize NetworkMaager via nmcli.
  • Servers, headless machine and terminals: Can be used to control NetworkManager with no GUI and control system-wide connections.

Syntax:

nmcli [OPTIONS] OBJECT { COMMAND | help }

Where the OBJECT can be any one of the following:

  • nm: NetworkManager’s status.
  • connection/cn: NetworkManager’s connection.
  • d[evice]: devices managed by NetworkManager.

Example 1: To check the device status using nmcli command.

We can see that the output is shown in various columns that include the device name, its type and connection status. The output might vary with different machines.

Example 2: To check active connection on the device.

In the above output, we can see that there is one connection which is active. The number of connection, it’s UUID(universally unique identifier) and type might vary from machine to machine.

Example 3: To list all the available device.

Options: