restarting network-manager

August 17, 2013

When you boot up your computer, there are a lot of programs running behind the scenes that start up to govern all sorts of background processes.  Most of these aren’t “programs” that you can open and close, so when something goes wrong with one of them, it’s not as simple as clicking a button to close or restart the service.  These, one of the most vital on a Linux system is network-manager.  This is the service that controls your network connections and gives you a graphical interface to select wireless networks, enter passwords for secured networks, etc.

The other day my network-manager suddenly stopped working.  While I do a lot of networking stuff from the command line, I almost always use the GUI for connecting to and disconnecting from wireless networks.  This time, clicking on “Disconnect” or “Connection information” didn’t do anything.  Luckily, it’s easy to restart the network-manager service if it stops responding for any reason:

Open the terminal and type “sudo service restart network-manager”

It’s as simple as that.  This is also the syntax for restarting most any misbehaving service or program.


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 11, 2013

To anyone who knows me or has read the last few posts, this next sentence will probably be a shock: there is a Microsoft program that I love.  It’s called SyncToy.  It’s a very minimalist, very easy to use program to syncing folders between locations, and I used to use it as my backup program, where I would have it do unidirectional syncs from my files to my backup drive periodically.  It took me a while when I switched to Ubuntu to figure out how best to do regular backups.  Ubuntu has a few built-in utilities with good GUIs, but none of them were really set up to do what I wanted.

The main problem was that I wanted to do incremental backups of all my data — ALL my data, which between text documents, pictures, recordings I’m working on, and mp3s means ~2TB.  That’s the main reason I do incremental backups rather than ever trying to do a system image or full backup.  I’m not afraid of having to reinstall my OS since I’m not a business and down time doesn’t mean that much, but I’m extremely afraid of losing any data.  That’s why rsync works so well for me.  Rsync is a very minimal command-line program that syncs files between locations, and comes with a lot of options for how you run the sync; I highly recommend it.  Of course, backups mean very little if you don’t run them regularly.

Once I got rsync figured out I still had to learn how to get it to run automatically.  This is where cron comes in.  Cron is the task scheduling utility on Ubuntu and other *nix systems. In principle it’s similar to the task scheduler in Windows, but it’s configured very differently.  Like many if not most other Linux utilities, it’s meant to be run from the command line.  For most tasks you’ll probably want to run them as your regular user account, so you can access crontab, which stores user-specific scheduled tasks, by entering “crontab -e” in the terminal.

This will probably open crontab in nano (which I usually prefer to vi), depending on what your default CLI editor is.  The slightly tricky part of using cron is getting used to the syntax.  Instead of simply inputting a time, you have to input 5 numbers separated by spaces: the minute, hour, day of the month, and month you want the task to run, followed by a number to represent the day of the week.  After these numbers telling cron when to run the task, you enter the path for the actual command to be run.  If you have a backup script called “backup” in your home folder, the path would be /home/<username>/backup.  Asterisks are used in place of numbers if you want the task to run during every instance of that type, e.g., putting * in the “month” spot would run the task every month instead of a specific month.  I have my backup script run every night at 3am, so I have “0 03 * * *”: “0 03” tells it to run at 3:00, and the asterisks tell it to run every day (of week and month) in every month.

why I use Ubuntu

April 20, 2013

I have conflicting feelings about proselytizing anyone regarding operating systems.  In fact, one of the best things about Linux is that it’s a relatively small community of people who are interested in and mostly knowledgeable about computers and are passionate about open source software.  Bringing new users to Linux introduces problems after a point, since one of the main reasons there are no wild viruses for Linux is that so few people use it (depending on your source and your country, roughly 1% of computer users).  On the other hand, I love Linux, and Ubuntu specifically.  Coming from 20+ years of Windows use, Ubuntu was still very intuitive to get to know and use (much more so than MacOS for me).  It looks good.  And it’s free!

The main reason I switched to Ubuntu is because it’s free and open source.  While ideologically the latter is important to me, in all honesty it was the former that made me switch.  I was tired of paying hundreds of dollars for an operating system I didn’t love.  When I installed Ubuntu, I had been running a pirated copy of Windows — even though I had 4 Windows licenses for home use.  But these had come pre-installed on purchased computers, and after years of moving, hard drive crashes, and OS problems, I just didn’t know where any of the licenses were, and since all my computers were out of warranty, Microsoft wouldn’t give me the time of day.  Since I didn’t think it was right to pirate an operating system, I decided I’d check out something I could use for free, rather than spending hundreds of dollars replacing something that technically I still owned.

Another reason I switched was the instability of Windows.  I rebooted my computer pretty much every day between programs crashing my system, getting a Blue Screen of Death because of a driver or Windows Update problem, or just having to install new batch of Windows Updates that were so poorly written that every one of them required a restart, even though you should never have to restart your computer for an update that isn’t to the OS kernel, a driver, or something similar.  I’ve had a couple crashes with Ubuntu, but they were all either hardware problems (a video card that’s probably damaged) or because I tried to run lesser-supported Windows programs through Wine, the Windows emulator for Linux.  However, probably even more than the stability, the speed of Ubuntu has won me over.  Ubuntu is a little more bulky than, say, Fedora, but it still outperforms Windows in basically every way.  On my desktop Ubuntu takes about 30 seconds to boot, compared to 5 minutes for Windows XP.  On my laptop Ubuntu takes 15-20 seconds, versus Windows 7’s 2-3 minutes.

My biggest fear with switching to Ubuntu was the old hand-wringing of “What if I can’t use my programs??”  I eased myself into it by switching (while still using Windows) to less proprietary programs that ran on both Windows and Linux.  I started using Pidgin instead of AIM (a huge improvement since Pidgin supports all sorts of chat protocols) and LaTeX instead of Microsoft Office for text documents.  When I switched to Ubuntu, lo and behold, I was still able to do everything I could do on Windows.  I could still use Pidgin and TeXWorks, I found the default Document Viewer much faster and more stable than Adobe Acrobat, and OpenOffice filled the gaps left by leaving MS Office behind (though I still use TeXWorks for pretty much any text document).  As a musician working in two online collaborative projects I do a lot of file sharing, so I was pleased to find that Nicotine+ uses the Soulseek server for file sharing.  My old friend Google Chrome was still available, and I found a new music player — Audacious, which I’ll talk about in more detail in another post.  In short, everything I was afraid of about switching permanently to Ubuntu turned out to be a non-issue.

Personally I think everybody should try out Linux, and Ubuntu tends to be the distribution people find most user-friendly.  Ubuntu isn’t for everyone; if you have to use proprietary software that only runs on Windows, it’s not a perfect solution to have to reboot a dual-boot system or open a virtual machine running Windows.  And it’s definitely true that you MUST be comfortable with the command line if you’re going to use Linux.  As far as many modern distributions have come, you still either must or should use the command line for some tasks.  But for people who aren’t afraid of a few text commands and are willing to try out the open source alternatives to proprietary software, I think Ubuntu is the best operating system currently in heavy use.