Posted 11 months ago. Visible to the public.

Joining PDFs with Linux command line

There are several ways to merge two (or more) PDF files to a single file using the Linux command line.

If you're looking for graphical tools to edit or annotate a PDF, we have a separate card for that.


The pdfjoin binary from pdfjam is probably already installed on your system. Usage:

pdfjoin one.pdf two.pdf --outfile out.pdf

Pages from joined documents might be rotated. To avoid this, call it like this:

pdfjoin one.pdf two.pdf --outfile out.pdf --paper a4paper --rotateoversize false

For a list of availble options use pdfjam --help.


PDFtk is another great toolkit for manipulating PDF documents. You may need to install it first (sudo apt install pdftk).
Merging multiple files works like this:

pdftk one.pdf two.pdf cat output out.pdf

Unlike pdfjam, PDFtk should not mess with page sizes but simply joins pages as they are.

See pdftk --help or the PDFtk examples page for more.

ImageMagick (not recommended)

You could also use ImageMagick's convert, but this will raster vector contents and usually result in lower quality at higher file size:

convert one.pdf two.pdf out.pdf

We don't recommend this.

Does your version of Ruby on Rails still receive security updates?
Rails LTS provides security patches for old versions of Ruby on Rails (3.2 and 2.3).

Owner of this card:

Judith Roth
Last edit:
11 months ago
by Arne Hartherz
concat, concatenate
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Judith Roth to makandra dev
This website uses short-lived cookies to improve usability.
Accept or learn more