Use serial port as regular user in Ubuntu

By default a regular user does not have permission to use the serial port. In my case I wanted to use two USB-to-serial adapters:

By looking at output you can see that the owning group is dialout. So it is a matter of adding your user to that group (and logout/login as with every user rights change). The bash environment variable $USER contains your username.

Found on the Ubuntu help pages.

Identical acronyms with different meaning

Neat 🙂 LaTeX is really solid. There’s a solution for every problem…

Found this post by user cgnieder.

TeX Live 2012, Gummi 0.6.5 and a great LaTeX template for theses

Today I set up my LaTeX environment for my master thesis on my Ubuntu 12.04 notebook. It consists of the Tex Live distribution version 2012 and the Gummi LaTeX editor. The latter is very lightweight and has a very useful live preview:

Screenshot of Gummi v0.6.5 with the CandyMountain text color scheme
Screenshot of Gummi v0.6.5 with the CandyMountain text color scheme

1. Install

The Ubuntu 12.04 repos don’t contain the latest versions of TeX Live and Gummi. So we’ll add two PPAs – one for a more recent version of Gummi and one for TeX Live 2012.

sudo apt-add-repository ppa:texlive-backports/ppa
sudo apt-add-repository ppa:gummi/gummi

Next we’ll update the repos on the machine and install the required packages. I’ll show you a nice template in a second for which I needed to add some additional packages.

sudo apt-get update && sudo apt-get install gummi texlive-science texlive-fonts-extra texlive-math-extra texlive-bibtex-extra cm-super texlive-lang-german

2. A useful template for theses

Google turned up a nice LaTeX template over at Matthias Pospiech’s website. And here’s why I like it:

  • it works (almost, see below) out-of-the-box
  • it looks good
  • it has a lot of things set-up (quotes, tables, references, two-page bind-friendly print layout, bibliography, math formula support, code listings, diagrams, plots)
  • it is THOROUGHLY documented (we’re talking 200+ pages pdf with examples for everything – the template IS the documentation)

The only thing I had to do is replacing each \include with an \input (for security reasons only TeX files from the same directory can be included in recent Linux distributions – you can find more on that in this stackexchange response) and I was good to go. The documentation is BIG PLUS – clearly a lot of effort went into this. This will help a lot when modifying the template.

3. Find a text color scheme you like
If you’re going to write reports and/or theses with Gummi you should look for a color scheme that you like. Right now I’ll try Jacob Pennock’s CandyMountain for a while. The editor pane of Gummi is the GtkSourceView from the GTK – so you can use any color scheme that works for it. Gedit also uses GtkSourceView. There are a few nice styles in Gnome’s GTK wiki, but you can find some scattered across the web.

The color schemes are plain text xml files. You can either install them via the gedit preferences or copying the xml files into this directory (you may have to create it first):


You can then try and select the color scheme in the Gummi preferences (you may have to restart Gummi to see the new schemes):

Edit > Preferences > Fonts & Colors

Remove/replace line break in bash output

Sometimes it’s much more convenient (or required) to feed a list as one line with separated elements instead of one item per line. Example:

You have this (just a random list of files):

You want this:

Tools like ls and echo have their own parameters to handle this individually, but I found two simple solutions that work for ALL bash output: one makes use of tr and the other of xargs. The latter makes sense if you want the list of elements as command line parameters for another tool (i.e. open all *.c files in this directory in a text editor) while tr is useful if you want to pipe the list to another program or into a file.



ls | grep “\.c$” | tr ‘\n’ ‘ ‘

In this example tr takes the input and replaces each new line character ('\n') with a space character (' '). tr has a few interesting options to manipulate output. The description from the man page pretty much sums it up:

“Translate, squeeze, and/or delete characters from standard input, writing to standard output.”

Found in this reply on Ask Ubuntu by user roadmr.