How to check and set mobile settings like APN from command-line?

On the Librem 5, in Settings we can choose “Mobile” to see and set cellular network settings, for example:

  • Mobile data on/off
  • Data Roaming on/off
  • Access Point Names (APNs where each APM has the fields Name, APN, Username, Password)

So those things are available in the Settings app. I would like to check those settings, and also be able to set them, from the command-line. Is that possible and if so, how to do it?

That would be useful for example when troubleshooting MMS functionality, doing as much as possible from the command line allows putting things in a script and being sure that exactly the same settings are used every time, systematically testing different settings, and so on.

The APN is in /etc/NetworkManager/system-connections/xyz.nmconnection where you choose xyz as appropriate. (I seem to have some duplicates from stuffing around, but maybe you won’t.)

That should be good enough for checking. If you want ‘get’ and ‘set’ then nmcli is your friend.

2 Likes

This could be a good thread to collect bits for a how-to in this, a list of commands, use-cases, solutions, hacks etc. There have already been a couple messages (including @irvinewade’s) in other threads that I’ve bookmarked, but in the long run it’s going to be a challenge to find anything if it’s not collected. So, maybe discuss here and later transfer to wiki for in some nicer format?

I’ve put a really basic summary in the Tips & Tricks Wiki.

2 Likes

Care to link to it? I searched but could not find anything. Thanks, appreciated

4 Likes