Combine multiple PDFs into a single file on Linux

Disclosure: Links to other sites may be affiliate links that generate us a small commission at no extra cost to you.

One of the great features of the iPhone is the ability to load PDF files into the iBooks application… why lug paper around when you can have a huge amount of reading material right on your phone?

One of the challenges of this is that many freely available materials come as 1 chapter per PDF file: Linux Device Drivers is just one example.  The iBooks application remembers where you last left off when reading a PDF file, it also supports bookmarks.  As such, it makes for too much clutter to have multiple books with multiple files per chapter, too confusing to navigate and manage.

Using the GhostScript (gs) and pdftk tools we can easily combine multiple PDF files into one.  Both these tools are freely available on Linux.   The steps here were performed on Ubuntu 10.10

1. Install GhostScript and pdftk:

sudo apt-get install gs pdftk

2. Download the tarball of files:


3. Unzip using bunzip2:

bunzip ldd3_pdf.tar.bz2

4. Un tar:

tar -xvf ldd3_pdf.tar

5. Change to newly created dir:

cd ldd3_pdf

6. Combine using GhostScript:

gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=ldd3.pdf -dBATCH TITLE.pdf ch01.pdf ch02.pdf ch03.pdf

(not all files listed)

7. There will now be an output file named ldd3.pdf that combines all the listed files in the order they were listed in the command arguments!

About the author


I'm an all around computer junkie, interested in many aspects of programming, operating systems, and enterprise IT technologies. I love Mac OS X, Linux, and Windows and more!