LinuxCommandLibrary

nmcli-device

Manage network devices through command line

TLDR

Print the statuses of all network interfaces

$ nmcli device status
copy

Print the available Wi-Fi access points
$ nmcli device wifi
copy

Connect to a Wi-Fi network with the specified SSID (you will be prompted for a password)
$ nmcli --ask device wifi connect [ssid]
copy

Print the password and QR code for the current Wi-Fi network
$ nmcli device wifi show-password
copy

SYNOPSIS

nmcli device {status | show [iface] | connect iface | disconnect iface | reapply iface}

PARAMETERS

status
    Displays the status of network devices. Shows device name, type, state, and connection.

show [iface]
    Displays detailed information about a specific network device (iface) or all devices if no interface is specified. It includes information such as MAC address, IP addresses, and connection settings.

connect iface
    Connects a specified network device (iface) to a network. This will activate an existing connection profile associated with the device.

disconnect iface
    Disconnects a specified network device (iface) from the network. This deactivates the active connection profile.

reapply iface
    Applies settings of iface device by reloading the network device.

DESCRIPTION

The `nmcli device` command is a part of the NetworkManager command-line tool (`nmcli`). It's used to manage network devices and their connection status. You can use it to list, connect, disconnect, show details, and modify settings of network interfaces. This command allows interaction with network devices without needing a graphical interface, making it suitable for scripting and server environments. The `nmcli device` command provides a robust and flexible way to monitor and control network interfaces, enabling efficient network administration from the command line. The command is a primary tool to show network information, for example, information about the device status, type, and connection status.

EXIT CODES

0 - Success.
1 - An error occurred.

EXAMPLES

Display the status of all network devices:
nmcli device status

Display details for the 'eth0' interface:
nmcli device show eth0

Connect to a wifi called 'MyWifi':
nmcli device wifi connect MyWifi password 'your_password'

Disconnect the interface 'eth0':
nmcli device disconnect eth0

SEE ALSO

nmcli(1), ip(8), ifconfig(8)

Copied to clipboard