nmcli

nmcli is a command-line interface for managing NetworkManager, a tool used to manage network connections on Linux-based systems. It provides a convenient way to configure network interfaces, Wi-Fi connections, VPNs, and other networking configurations directly from the command line.

Key Features and Subcommands

Here’s a breakdown of some common nmcli commands and their usage:

1. nmcli general

Used to display general system network settings and manage NetworkManager.

  • Show general status of NetworkManager:

    nmcli general status

    This command shows the overall status of NetworkManager (e.g., whether it's running).

  • Show the NetworkManager version:

    nmcli general version
  • Enable/Disable NetworkManager:

    nmcli general enable
    nmcli general disable

2. nmcli device

Manages network devices and shows their status.

  • Show all network devices:

    nmcli device status

    Displays the status of all network devices (e.g., Ethernet, Wi-Fi, etc.).

  • Bring a device up or down:

    nmcli device connect eth0
    nmcli device disconnect eth0
  • Show detailed information about a device:

    nmcli device show eth0
  • Change device connection:

    nmcli device wifi connect SSID password "yourpassword"

3. nmcli connection

Used to manage network connections (Ethernet, Wi-Fi, VPN, etc.).

  • Show all connections:

  • Show a specific connection:

  • Activate a connection:

  • Deactivate a connection:

  • Add a new Wi-Fi connection:

  • Delete a connection:

  • Edit a connection:

4. nmcli networking

Used to control the overall networking status.

  • Enable or disable networking:

5. nmcli radio

Used to control the wireless radio (Wi-Fi) state.

  • Enable Wi-Fi radio:

  • Disable Wi-Fi radio:

  • Enable/Disable Bluetooth radio:

6. nmcli vpn

Manages VPN connections.

  • Show VPN connections:

  • Add a VPN connection:

  • Activate a VPN connection:

7. nmcli monitor

Monitors network status in real-time.

  • Monitor changes to connections:

This command will keep the terminal open and monitor any network changes in real-time.

8. nmcli wifi

Manages Wi-Fi connections and networks.

  • List available Wi-Fi networks:

  • Connect to a Wi-Fi network:

  • Disconnect from the current Wi-Fi network:

Examples of nmcli Usage

  1. Check the current connection status:

  2. Change the IP address of an interface:

  3. Create a new Ethernet connection:

  4. Enable and disable Wi-Fi:

  5. Activate or deactivate a connection:

Conclusion

nmcli is a powerful and flexible tool for managing network connections on Linux systems. Whether you're configuring an Ethernet connection, connecting to Wi-Fi, managing VPNs, or even controlling network device states, nmcli provides a comprehensive set of commands to handle all your network configuration needs from the command line.

Last updated