Concatenate multiple PDF files into one PDF file

For this purpose we need ghostscript, but basically this software comes pre-installed in most linux distribution.

So to concatenate multiple PDFs (file1.pdf, file2.pdf, file3.pdf), into one file (output.pdf), simply run this:

$ gs -q -sPAPERSIZE=a4 -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=output.pdf file1pdf file2.pdf file3.pdf

Yes, it’s a long command, I know. To change the output paper size we can replace “a4” with “legal” for US Legal or “letter” for US Letter.


Things I did after Ubuntu 12.04 installation

1. Thinkpad HDAPSD
I can’t work peacefully without knowing that my hard disk is protected from shocks that might happen either with or without purpose.

$ sudo apt-get install hdapsd

2. Remove Messaging Menu

For me, this indicator is more to disaster rather than feature. Even without this indicator, I got enough distraction from the social medias and chat clients. So let’s remove this useless feature to help us focus.

$ sudo apt-get remove indicator-message

3. Install CPU Temperature Monitor Applet/Indicator

Since my Thinkpad X61 is getting old, the cooling performance is getting worse over time. Especially in last summer, everytime I played game it shuts down suddenly because of processor overheating. I built myself a laptop cooler out of junks, and to monitor the temperature I need an applet or in Ubuntu Unity’s term: “indicator”.

There are not much option for hardware sensor monitor that gives temperature display. One of them is Psensor which is available in Synaptic. It gives one nice thermometer button on the indicator panel, when you click on it a drop down will show up with all the temperature readings. It also has a temperature alarm feature that will give notification if the temperature reaches certain value. But it’s not handy enough for me because I have to click on it to see the temperature.

The other option is the indicator-sensors. This tool is quite handy and easy to use. It has also the alarm feature, and the most important feature: it displays the temperature value on the panel. But unfortunately this isn’t available yet from Synaptic, so we have to install it from the ppa:

$ sudo add-apt-repository ppa:alexmurray/indicator-sensors
$ sudo apt-get update
$ sudo apt-get install indicator-sensors

And this is how it looks like:

Neat huh? But I still haven’t figured out how to display more than one sensor reading.

This is the Preferences window:

Make sure you put a tick on the sensors you want to activate on the applet.

4. Remove Indicator “Switch User Account” Indicator
Ubuntu developer decides to display my name on the top right of the screen. Well, I know my name and I don’t really need a reminder. And since my laptop screen is quite small, the presence of this indicator makes it a bit cluttered.

To remove it, install dconf-editor first, either from Synaptic or apt-get:

$ sudo apt-get install dconf-editor

Then open dconf-editor, on the left panel navigate to “apps” -> “indicator-session”, then on the right panel remove the tick on “user-show-menu”. Close it, log out and log back in.

5. Install Network Speed Applet/Indicator
Back in Gnome2 when I was using Ubuntu 10.04 LTS, one of the applets I use the most is the Netspeed Applet. I don’t know why but I really enjoy looking at my fast network speed.

But unfortunately this applet is not available for Ubuntu 12.04 Precise Pangolin user. And there are no other similar applet either, that could be installed easily. Luckily, Andrew from came up with solution. It uses the indicator-sysmonitor and combine it with a BASH script. Click here to go to his page and follow all the steps.

This is how it looks like on my ubuntu:

Join/Merge Multiple mp4 Files Into One File Without Re-Encoding

Install GPAC first, easily from ubuntu repository:
$ sudo apt-get install gpac

Then using one of GPAC’s tool, named MP4Box, we can join or merge multiple mp4 files by concatenating into one file. With concatenating we save a huge amount of processing time which is usually spent for rendering/re-encoding.
$ MP4Box -cat file1.mp4 -cat file2.mp4 -cat file3.mp4 OutputFile.mp4

Convert Multiple Images Into PDF in Ubuntu Linux

First of all make sure you have imagemagick installed, otherwise checking won’t hurt:
$ sudo apt-get install imagemagick

Then in this case, I would like to join multiple image files of scanned documents with sortable file names (e.g. file01.jpg, file02.jpg, etc.). Finally to join those files together in A4 PDF format we do this in terminal:
$ convert -page A4+0+0 file* OutputFile.pdf

Adding “Open in Terminal” in Ubuntu’s Nautilus


$ sudo apt-get install nautilus-open-terminal

Then quit nautilus to refresh the settings

$ nautilus -q

Now if we right-click any folder in Nautilus, there will be a new option “Open in Terminal” which comes very handy.

Using Android as Wireless Mouse

Just a quick post as my personal documentation.

Use PRemoteDroid

Download the JAVA-based server.

Then you can connect to your phone using WiFi if both phone and laptop are on the same network. For connection via bluetooth under Ubuntu, first you have to download/install these files using apt-get:
– libbluetooth-dev
– bluez

Don’t forget to switch on the bluetooth before starting the server! Then the server should start quietly without long outputs.

Combining Multiple PDF Files Into One PDF File in Linux

This post is inspired (and 68% taken) from here. 😀

There are times when you need to combine multiple PDF files into one single PDF file. In Windows or Mac, it’s easy (as long as you are willing to spend some amount of money to buy the software), you can use Adobe Acrobat Professional. Sadly Adobe didn’t come up with Acrobat Professional for Linux platform, but luckily we have several options to do such job in a Linux box. Here’s one.

GhostScript is an interpreter for PostScript language and PDF files, and as far as I know, GhostScript is widely available by default on various Linux distro. In this post I will show you a simple trick to use GhostScript to combine any numbers of PDF files into one single PDF file. Although combining files with GhostScript has its own drawbacks, but still, for most purposes GhostScript does the job well.

Here’s the voodoo mantra, spell them on Linux terminal:
$ gs -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=finished.pdf file1.pdf file2.pdf ...

And below is the explanation of each mantra:

  • gs
    The GhostScript program.
  • -dBATCH
    tells the program to exit after finishing the job.
    tells the program to keep going without having conversation with the user.
  • -sDEVICE=pdfwrite
    tells the program to use its internal PDF writer to process the files.
  • -sOutputFile=finished.pdf
    tells the program where to put those scattered PDF files into one file whom name you specified.
  • file1.pdf file2.pdf …
    tells the program which PDFs you want to combine.

Tada, now you have combined PDF file, ready to brought anywhere without worry leaving one part behind.

Convert (Any?) Video to PSP video format on linux


FFMPEG is a linux based application which is also a solution in streaming and converting almost any audio and video format. That includes video format for gadget or handheld device such as mobile phone video (3gp), iPod, and PSP.

In this writing I will try to elaborate my findings about video conversion, although for now this is still incomplete.

Okay, here’s a simple trick to convert video file into PSP video format, so that the video can be playable on PSP:
$ ffmpeg -i INPUTVIDEO -f psp -r 29.97 -b 512k -ar 24000 -ab 64k -s 320x240 M4V00001.MP4

Then you’ll have M4V00001.MP4, copy that into your PSP. Several articles point out that PSP only reckon video files which follow this file naming rule (M4VXXXXX.mp4). I actually haven’t tried this out because of my PSP is still somewhere on my sister’s room. I’ll update this post as soon as I found the thing.

If the command above doesn’t work (error unsupported codec for output stream), try install this package

Or check out these links about converting video into PSP video format: (In Indonesian Language)

Broadcom BCM4312 Wireless Issues on Ubuntu

Today I was installing Ubuntu Lucid Lynx on my friend’s notebook, a Compaq Presario CQ20. Installation process ran smooth. After reaching desktop, with wireless already switched on, the stupid computer can’t find any wireless network.

It’s been a long time I never had a ubuntu fresh install with devices that doesn’t work. Since Ubuntu Karmic, usually all my installations is “just works”, all devices works just like that.

Okay, enough with the chit chat, let’s get this done fast. Simple googling for the notebook’s spec gives me information about which wireless chipset used by the notebook. It’s a Broadcom BCM4312. Another simple googling with keyword “broadcom bcm4312 ubuntu” leads me to another tutorial about resolving broadcom wireless issue.

The official solution is provided by the vendor here, which is great. But sadly they only provide the source code tarball, no pre-compiled package listed there. Lazily I extract the tarball, then *sigh*, read the manual. Quick read-skip-read takes me to part about steps to install from pre-compiled package, hurray.. Here’s how:

First of all, you have to make sure you have the right device to troubleshoot, by using this command:
$ lspci -vnn | grep 14e4

If you have the right wireless device, then command above should give output more or less like this:
02:00.0 Network controller [0280]: Broadcom Corporation BCM4312 802.11b/g [14e4:4315] (rev 01)
Subsystem: Broadcom Corporation Device [14e4:04b5]

Afterwards, download these packages from other ubuntu system by using apt-get --download-only install PACKAGENAME:

  • patch
  • dkms
  • bcmwl-kernel-source

If you don’t have other ubuntu system which connected to repository server, you can browse for that packages on repository server. But because I don’t have much thing to do, let me do the browsing:

patch for 32bit ubuntu
dkms for all ubuntu
bcmwl for 32bit ubuntu

Click on the link above to download.

Then transfer those files to the target notebook using flash drive or anything.

Last step is calling the mighty dpkg:

$ sudo dpkg -i patch_2.6-2ubuntu1_i386.deb
$ sudo dpkg -i dkms_2.1.1.2-3fakesync1_all.deb
$ sudo dpkg -i bcmwl-modaliases_5.60.48.36+bdcom-0ubuntu3_i386.deb

The process is a bit lengthy, especially when installing bcmwl-kernel-source package, so be patient and keep hoping you don’t crash your notebook.

When the installation finished, reboot, and stay hopeful that you don’t crash your notebook. If reboot success, check wireless access points with network manager applet on upper right of the desktop. If there’s wireless network detected, then voila, you are done.

Tiled Multiple GNOME Terminal

2015 update:

  • now I use the more superior Terminator.
  • I am now aware of tiling window manager (i3, awesome, etc.).

When I do stuff with Linux, 68% of them are terminal/shell work. And most of them needs many tty/terminals at once. In Ubuntu, or generally in GNOME Desktop Manager, arranging multiple terminal layout every time you need it can be such a pain in the ass. Here’s a simple shortcut to open multiple gnome-terminal with arranged (tiled) position:


gnome-terminal –geometry=157×22+0+670 &
gnome-terminal –geometry=80×20+700 &
gnome-terminal –geometry=100×20+0 &

You can save the script into a file, and put it in $PATH directory. For example:


Then change the file mode bits to make that executable:

$ sudo chmod 755 /usr/local/bin/multiterm

And here is what it looks like

Multiple tiled GNOME Terminal

Multiple tiled gnome-terminal

For the sake of simplicity and ease of access, you can put a shortcut on the GNOME panel to launch the script with a single click of the mouse.