Convert cbr files to pdf

Here’s a quick tip. Generally when some of my good internet pirate friends share with me a comic book,1 it comes in the cbr format. There is no application for my Ubuntu phone to read these files (yet), but there are some good pdf readers. All I have to do is convert the files with some handy terminal commands.

A cbr file is just a group of image files compressed in the rar format. So, let’s uncompress the files in a temporary directory:

  dir=$(mktemp -d)
  cd $dir
  unrar x /path/to/file.cbr

And then let’s convert them to pdf:

  convert * /path/to/file.pdf

Open the pdf to check it is OK:

  evince /path/to/file.pdf

And delete the temporary directory:

  cd ..
  rm -rf $dir

Transfer to the phone, and enjoy.