One thing I like about Linux is that things go horribly wrong much less often than Windows (in my experience, obviously it’s possible that your mileage differs).  But the thing I love more is that when things go horribly wrong in Linux, there’s always something you can do about it.  Case in point: a few weeks ago my computer wouldn’t boot after an OS update.  Went through POST just fine, started loading Ubuntu, and then….nothing.  No HD light flickering, nothing on the screen but black and a small blinking cursor.  The first thing I tried was the magic SysRq key, a key combination that the kernel responds to even if most everything else has failed (the most useful combination is Ctrl+Alt+SysRq and, while holding down those 3 keys, press R, then E, then I, then S, then U, then B).  Second boot the same thing happened.

Then I tried the trusty recovery console.  But hey, Windows has that too, right?  The difference is that Linux is at its core a text-based operating system, which is what scares away a lot of potential users — even though Ubuntu is very graphical and IMO very user-friendly, it’s really hard to get through a month or even a week without having to do SOMETHING at the command line.  But that’s also what’s great if something goes wrong.  Even from the command line you have a full-featured operating system capable of networking, system updates, and even playing mp3s.  In my case it turned out that the system was booting just fine, but was hanging when loading the display manager.  For Windows users who are over 30, this is similar to being able to load DOS, but Windows won’t boot and so you don’t have any graphical environment with which to play Ski Free and get eaten by a yeti (i.e., a really distressing situation).  The first thing I tried was reloading the display manager manually: sudo service restart lightdm.  (I’m using Ubuntu with Unity, so my display manager is lightdm.  There are other display managers.)  This generated the same hang as when I tried to boot normally.

After doing some research (what did we do before laptops and smartphones?) it sounded like I was having a problem with updated packages, so I tried uninstalling and reinstalling Unity.  No dice.  Then I found the real problem: my video card drivers.  Luckily I use the command line a lot for installing and uninstalling packages, and I was familiar with the packages I needed for my video card, so after uninstalling and reinstalling those, everything worked just fine.

As a summary for anyone dealing with similar problems, here’s my general troubleshooting list:
1.  Reboot the computer, using the magic SysRq key if nothing else works (do NOT do a hard reset with the power button unless absolutely necessary)

2. Boot to the command line (with networking)

3. Start or restart your display manager (the most common with Ubuntu is lightdm)

4. Uninstall and reinstall Unity (try unity –reset first, then unity –replace, then try sudo apt-get remove ubuntu-desktop && sudo apt-get install ubuntu-desktop)

5. Uninstall and reinstall video card drivers (depends on your card: for NVIDIA the most useful package I’ve found is nvidia-current, so you’d do sudo apt-get remove nvidia-current && sudo apt-get install nvidia-current)

6. Bask in glory?  If you’re still having display problems I feel bad for you son.  I got 99 problems but a bad video card ain’t one.


SSH (Secure Shell) is a method of connecting to a computer remotely, giving you (depending on user permissions) full access to the files on that computer.  Obviously this is a huge security risk — if someone cracks your password, they’ll have complete access to your computer.  For this reason is generally recommended not to use passwords at all with external SSH connections, and so I’ll just be mentioning using SSH to connect to other computers on your local intranet.  Why use SSH?  While Windows has all sorts of relatively easy (and head-bashingly buggy) tools like “Network Discovery”, Ubuntu doesn’t default to easy intranet sharing like this.  In fact, this was one of my biggest frustrations when I first switched to Ubuntu, until I found SSH.

To install SSH, simply type “sudo apt-get install ssh” at the command line.  As usual you’ll be prompted for your root password.  Unless you already have ssh installed you will be prompted to download and install the package.  Once the ssh package is installed, you can use it either from the command line or directly from your workspace.  Unlike many utilities, I don’t usually use ssh from the command line.  I like visual file managers, so I like being able to use Nautilus to browse the files on the computer I’m connecting to.  To connect, I select “Connect to Server” from either my workspace or a nautilus window.  Then I enter the IP address of the computer I want to connect to.  This is information you can get via ifconfig on the computer in question, and will probably (depending on the size and topology of your network) be something like or 10.0.0.x, etc.  For “type” I select “SSH”; doing this automatically fills in the default port number of 22.  I leave the folder as root (/) and enter my username and password for the computer I’m connecting to.  I click “Connect”, and nautilus opens a window showing the file structure of the computer.  That’s it!  Now I can open and edit documents on the remote computer.

I’ve found this to be the easiest way to read and edit files on my desktop computer.  Certainly there are other ways, but if I use SSH to connect to my desktop, say, from my laptop in the living room, I can easily access everything I need, not just files I’ve put in a shared folder.  The method for connecting to your computer from outside your local network is more complicated and much more dangerous.  Typically if you’re going to try this you want to use keys instead of passwords and possibly also change the port used for SSH on the computer you’re connecting to.  I’ve never actually tried this, but it will be something I cover in a later post when I get around to working through the process.

LaTeX on Linux

June 8, 2013

As I’ve mentioned in previous posts, I use TeXWorks for pretty much everything other than taking brief notes.  However, if you’re going to use it for much more than basic formatting, you’re probably going to need to install some extra packages other than the preloaded stuff that comes with TeXWorks.  The best package for Ubuntu, and the one that includes most of what you might use on a regular basis (including tipa, a package for typesetting IPA symbols, which is probably my most frequently used package), is the texlive-full package.  To install this in Ubuntu, you can open the terminal and type “sudo apt-get install texlive-full”.  This will prompt you for your sudo password and then install the package, which might take a while since it includes a whole bunch of stuff.  Remember that the apt-get service is the same as the Ubuntu Software Center service, so you can’t be running both at the same time; you’ll have to exit the Software Center if you want to install something with the command line.

I won’t go into a whole discussion of how to use TeXWorks here, but I’ll just add a reminder of how to use a package in LaTeX.  Extra packages you want to load have to go in the preamble/header, right after the \documentclass{} command.  So, for instance, to use the tipa package, I add \usepackage{tipa} immediately after my \documentclass{} declaration.  Some packages are picky and need to loaded before or after other packages, because of definition updates run by various packages.

using the terminal

June 2, 2013

One of the things that scares a lot of people about using Linux, and one of the things that makes it such a flexible and powerful set of operating systems, is the command-line interface or terminal.  As I mentioned in a previous post, I’ve never been scared of a monochrome blinking cursor, and I loved using DOS when all I knew was how to type “cd”, “dir”, and the few programs I ever used in the 80s (ah Wordperfect 4.1).  That’s a good thing, because you absolutely have to use the terminal if you’re going to use Ubuntu or any other Linux distribution as your primary operating systems.  Things will go wrong, you’ll have to compile from source code, you’ll accidentally set recursive file properties on your system files, and even if you don’t want to, you’ll have to use the terminal.  So I thought I would give a brief description of the last 3 commands I’ve used in my terminal on Ubuntu.

First things first: in most version of Ubuntu (and several other distributions), you can open the terminal with the keyboard shortcut Ctrl+Alt+t.  You can also access it by clicking on the Dash (if you’re using Unity as I am) and typing in any portion of “terminal”.  When you open it you’ll see something of the form <user>@<machine>.  For instance, if your username is cthulu and your computer’s hostname is rlyeh, you’ll see cthulu@rlyeh.  The default default location (not a typo — I mean the system default for the default folder you’re in when you open the terminal) is your home folder, so after a colon you’ll see ~, which is shorthand for your home directory.

We don’t want to be limited to our home directory, so I’ll introduce the first basic command, which easily enough is the same as for Windows: “cd”, which stands for “change directory”.  For instance, if I want to change into my Downloads directory, which resides in my home folder, I could type “cd Downloads” (remember: commands and folder names are case-sensitive).  If I want to get back to my home folder from anywhere, I can just type “cd”.  Okay, now I want to actually see what’s in my Downloads directory.  This command is different from Windows: “ls”, because we’re listing the contents of the directory.  By default ls only lists non-hidden files and folders, so if you want to see everything you’ll have to do “ls -a”.  This shows all files and folders.

Okay, now I’m bored and want to actually do something instead of just listing files.  The utility I use probably more than anything (including cd and ls) is ping, which sends ICMP packets to a target IP address and logs how many of them were returned and how long it took them to get back.  ping is used to test network connectivity.  For instance, if your computer won’t connect to the internet, and you want to know if your computer is properly connected to the router, you could ping the router.  If you’re connected, you should get all or most of the packets back, and the times should generally be 5-10ms if you’re using wireless and are some distance from the router.  Less than this is great, much more typically indicates radio interference or network congestion.  If you’re on a home network, the router IP address is probably, though it may also be  In my case it’s the latter, so if I want to test my connectivity I type in “ping” in the terminal, and I start getting responses like “64 bytes from icmp_req=1 ttl=255 time=1.43ms”.  The most relevant part of that for our purposes is the last bit: “time=1.43ms”. This means the time it took my computer to send an ICMP packet to the router and get a response back was a little over a thousandth of a second: great!  The default for Linux systems is to continuously ping, so if you enter the above command, it’ll just keep going forever and ever.  To stop this (or any other running process in the terminal), you can hit Ctrl+c — which, incidentally, is why you can’t use keyboard shortcuts for copying and pasting in the terminal.  If you want a specific number of pings, for instance the Windows default of 4, you can use “ping -c 4”, where 4 is the number of ICMP packets that will be sent.

Okay, we’re done!  Now I type “exit” and the terminal closes itself.

I started using LaTeX while working on a qualifying paper as a graduate student at Rutgers.  At that point I was still using Windows and Word, and I just couldn’t get the paper to look like I wanted it to in Word, despite having used it for a decade and having taught it to high school students for a year.  That’s not to say that I couldn’t have done it in Word, just that even after a decade I found Word completely unintuitive and difficult to customize.  Switching to LaTeX made it possible for me to end up with a document that looked professionally typeset and appeared exactly as I wanted, with little explicit formatting on my part.  LaTeX also eased my transition to Ubuntu, since I could continue using TeXWorks, whereas I wouldn’t have been able to continue using Word (at least not without Wine).

Before I switched to TeX I was afraid it would be difficult to compose in, since TeXWorks and other TeX editors aren’t WYSIWYG, so you don’t see things like italics or font faces in the document you’re editing.  However, for me it didn’t take long to adjust to typing in the editor on the left side of the screen and hitting Ctrl+t whenever I wanted to see what the formatting looked like (Ctrl+t typesets the document and also saves it).  Another nice feature is that converts from WYSIWYG editors don’t have to give up their little red underlining for misspelled words.  You just have to have to right spelling dictionary installed and then tell the editor to use that dictionary (under Edit > Spelling).  Unfortunately, the current default version of TeXWorks for Ubuntu only comes preinstalled with spelling dictionaries for British and South African English (who knows why — the last default package had only Canadian English).  Oh noes!

Luckily it’s not difficult to install a new spelling dictionary.  What I was looking for is the US English dictionary — en_US.  This consists of two parts: en_US.aff and en_US.dict.  These files are included in the OpenOffice en_US spelling dictionary available here:  You’ll have to download the file, then extract the contents using, e.g., Archive Manager.

Once you have the two files (en_US.aff and en_US.dict) you’ll have to copy them to the correct location.  For Ubuntu this is /usr/share/myspell/dicts.  Copying to this directory requires administrative privileges, so I recommend copying them using the terminal (I’ve gotten myself into trouble using the Nautilus file browser as root).  To do this you’ll use the copy utility: sudo cp <file location> /usr/share/myspell/dicts.  In my case I had the files in my Downloads folder of my home directory, so the exact command I used was sudo cp ./Downloads/en_US.aff /usr/share/myspell/dicts.  Do this for both files, and you’re done!  After restarting TeXWorks you’ll be able to select the en_US spelling dictionary and spellcheck your work in US English.


May 18, 2013

One of the big changes for me when I was switching from Windows to Ubuntu was finding a new mp3 player.  I’ve always favored small, lightweight programs rather that the clunky stuff that comes bundled with pre-built computers and Windows (e.g., Windows Media Player).  I used Winamp for about 10 years, and loved it.  I organize my mp3s in individual folders because I have an inherent distrust of logical organization like virtual libraries or databases used by programs like iTunes and RhythmBox, so I wanted something simple like Winamp.  For this reason I was immediately attracted to Audacious (available through the Ubuntu Software Center), which has a Winamp mode that looks and feels a lot like Winamp.

Ultimately I abandoned the Winamp emulation for the standard Audacious skin.  It’s lightweight and easy to use, and you can easily customize what information about the song it shows.  Like Winamp, it has a small optional visualization app that sits in the corner of the program.  One of the key features I require in an music listening device (hardware or software) is EQ.  The main reason I never use any kind of cloud music apps or internet radio is because I can’t stand anything under 192kbps, and I can’t stand not being able to adjust the EQ on a song.  Audacious has a good 10-band equalizer and preamp, with sliders at 31, 63, 125, 250, 500, 1k, 2k, 4k, 8k, and 16kHz.  (If anyone’s curious, my current adjustments are +1, +1, +1, 0, -1, -4, -2, -2, +1, +1.  I listen to a lot of metal, so I tend to smile the EQ on anything I use.)

Audacious also comes with a number of built-in effects, with more available in the plugins section.  The two I use are the Crystalizer (set at the default 1.3), which makes the sound a little crisper, and the Extra Stereo plugin (also at the default 1.3), which increases the L-R panning just a little bit to give the music a bit more breathing room.  While I missed my old Winamp for a while, I’ve come to rely on a number of features the Audacious has that Winamp either doesn’t do or doesn’t do as well.  One I use all the time is the ability to have multiple tabbed playlists, modeled after tabbed web browsing.  And while I don’t have to worry as much about system crashes now that I use Ubuntu, it’s nice that Audacious continually updates its configuration settings, so if the program or even the OS crashes I don’t lose a single setting or unsaved playlist.  I’ve even reinstalled Ubuntu without losing unsaved playlist data.

While Audacious doesn’t have as many features as some of the heavier programs like iTunes or RhythmBox (which I use for organizing my iPod), it’s definitely my favorite program for just listening to music.