Software & AppsOperating SystemLinux

How To Get a List of Network Connections in Terminal with Bash?

Ubuntu 19

In the world of system administration, the terminal is a powerful tool that allows you to manage your system with fine-grained control. One common task is managing network connections. In this article, we will explore how to get a list of network connections using Bash in the terminal.

Quick Answer

To get a list of network connections in the terminal with Bash, you can use the nmcli connection show command. This will display all the network connections managed by NetworkManager, along with their details such as connection type, SSID, IP address, and status.

Introduction to Bash and Network Connections

Bash, or the Bourne Again SHell, is a popular command-line interface for interacting with Unix-like operating systems. It allows you to run commands, scripts, and programs on your system.

Network connections, on the other hand, are the various ways your computer connects to other computers and the internet. These could be wired connections like Ethernet or wireless connections like Wi-Fi.

The nmcli Command-Line Tool

To manage network connections in Bash, we will use the nmcli command-line tool. nmcli is a command-line client for NetworkManager. It is used to create, display, edit, delete, activate, and deactivate network connections, as well as control and display network device status.

You can learn more about nmcli from its official documentation.

Listing Network Connections

To list all network connections, open your terminal and run the following command:

nmcli connection show

This command displays a list of all the network connections managed by NetworkManager. The show parameter tells nmcli to display information about the connections.

Each connection in the list has a unique name, and you can see additional details like the type of connection (e.g., Ethernet, Wi-Fi), the SSID for wireless connections, the IP address, and the status of the connection.

Deleting a Network Connection

If you need to delete a specific network connection, you can do so with the following command:

nmcli connection delete connection-name

Replace connection-name with the name of the connection you want to delete. For example, to delete a connection named “HomeNetwork”, you would run:

nmcli connection delete HomeNetwork

The delete parameter tells nmcli to remove the specified network connection from NetworkManager.


Bash provides a powerful interface for managing network connections through the nmcli command-line tool. With just a couple of commands, you can list all network connections and delete specific connections.

Remember, the terminal is a powerful tool, and with great power comes great responsibility. Always double-check your commands before running them, especially when performing operations like deleting network connections.

How do I install `nmcli` on my system?

nmcli is usually installed by default on most Unix-like operating systems. However, if it is not installed, you can install it by using the package manager specific to your operating system. For example, on Ubuntu-based systems, you can use the following command to install nmcli:

sudo apt-get install network-manager
Can I use `nmcli` on a non-NetworkManager system?

No, nmcli is specifically designed to work with NetworkManager. If your system does not use NetworkManager as the network management tool, nmcli will not be available or functional.

Leave a Comment

Your email address will not be published. Required fields are marked *