Thursday, December 29, 2011

NetworkManager CLI

In the past few years, there's been a proliferation of wireless access points, and the NetworkManager applet does not deal with this well.  I have seen cases where there are so many access points found during a scan that the one I want doesn't make the list.  I suppose it's understandable if it's one I've never connected to, and if the signal isn't one of the strongest available.  If I've made clear that it's one of my preferred connections, though, it should always be found.  Rather than stew over this brokenness, I was determined to find a way around it.  NetworkManager CLI to the rescue!

I'm not deeply familiar with the NetworkManager CLI, but only a couple of commands are needed.
"nmcli con" shows a list of connections with names and UUIDs.  Sample output:

NAME                      UUID                                   TYPE              TIMESTAMP-REAL                    
Auto GloblaSuiteWireless  1aa7870c-0408-4c14-a42a-2e706cabed84   802-11-wireless   Tue 28 Jun 2011 12:43:20 PM EDT    
Auto FLYSBA               37308cf9-b520-4754-b382-8aec39fea79e   802-11-wireless   Fri 27 May 2011 11:19:16 PM EDT
euca                      42696e07-1b3a-49c8-9fd3-4483d9211285   vpn               Thu 29 Dec 2011 11:34:19 AM EST   

If you travel much, you probably have a huge list of these, so grep is your friend. Once you've found the connection you wish to activate, run this with the appropriate uuid string:

sudo nmcli con up uuid 37308cf9-b520-4754-b382-8aec39fea79e

I've set up script aliases for my favorite connections, so I don't have to search through the list each time. Note that VPN connections can be activated in this way as well.

As always, I hope this little nugget of information saves someone a bit of time someday.  It's certainly made my life easier.

Wednesday, December 28, 2011

Old School Audio Playback

One of the things that can be frustrating as an "old school" Linux user is that, with each upgrade to a new distro / release, familiar lightweight tools for everyday tasks fall out of fashion, and flashier new GUIs take their place.  Often, the older tools are still available, but they may not work out-of-the-box as they once did.  When I find something like this, I think it's worthwhile to document it publicly.   And while what I'm documenting may be obvious to some people, my perspective is that if it took me more than 30 seconds to figure it out, someone else is going to search the web for it eventually.

I have an old workstation running Fedora 16 in text mode (partly because I don't need a GUI, and partly because the nouveau graphics driver doesn't behave well on this system).  Today I wanted to play a CD and  went looking for a CLI to do so... nothing? Okay, I was going to rip it eventually, so cdparanoia + vorbis-tools (oggenc) got that job done.  Next, I tried ogg123 to play the converted files ... no sound.  There are probably some hoops I could have jumped through to get PulseAudio working, but I found that after a simple "alsactl init", ogg123 worked just fine.  I don't recall having to explicitly initialize the sound card like this in recent years, but it's good to know how simple it is.

It's worth noting that ogg123 uses about 5 MB of RAM, and about 1% of my CPU (maybe less) during playback.   Very nice.