Score:0

How to get the name of Active Local Network without using network utilities?

gw flag

Is there a file in Linux which stores the name (the SSID) of the local network to which I'm connected to.

I do not want to use any of the network utilities like nmcli or iwgetid or IP to get this information.

I checked the /sys/class/net. Files there can provide the status of the connection, but I cannot find the SSID of the network there.

I also checked the /etc/NetworkManager/system-connections. But it has all the networks that I have connected to in the past and not just the current local network I am connected to. Is there a way to get the Active Network SSID?

I believe that the utilities like nmcli must use some files to get this information. I want to use the same file (if that is the case).

OS: Ubuntu, Raspbian

guiverc avatar
cn flag
You've not provided any OS, product & release details. You mention *Network Manager* but it's not used by all Ubuntu products, so please be precise & provide the Ubuntu product/release you are asking about.
Shivam Saxena avatar
gw flag
@guiverc The OS can be Ubuntu or Raspbian.
guiverc avatar
cn flag
Please refer https://askubuntu.com/help/on-topic, Ubuntu and *official* flavors of Ubuntu (https://ubuntu.com/download/flavours) are on-topic on this site. The on-topic link provides alternate SE sites for non-Ubuntu OSes. *If you want to ask about Raspbian or Ubuntu - please use SE Unix & Linux where both are on-topic*
guiverc avatar
cn flag
You didn't provide any specific details; Ubuntu has different products, some use *Network Manager* but others do not; so please be precise; Ubuntu Server, Ubuntu Core, Ubuntu Desktop, what release etc.
Shivam Saxena avatar
gw flag
I don't have any specific OS request. Looking for generic answer. But since you asked, consider Ubuntu server since that can be installed on RPi. All I want to know is that if there is a file that I can simply read to get the name of Active Local Network. Or if there is some other way to get this info without using Network Utilities.
guiverc avatar
cn flag
Ubuntu Server doesn't include *Network Manager* (you can refer https://cdimage.ubuntu.com/releases/22.04/release/ubuntu-22.04.1-preinstalled-server-arm64+raspi.manifest for a list of what's included) so mention of that makes little sense (*it's not on Ubuntu Core either of course*)
Shivam Saxena avatar
gw flag
I have checked "/etc/NetworkManager/system-connections" on Raspbian. May be Ubuntu Server does not have it. But I want some generic answer (if there is). Please let me know if it is not possible to simply read from some file.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.