Home Linux Commandline Tools How to Merge PDF Files Using GUI & CLI Tools in Linux

How to Merge PDF Files Using GUI & CLI Tools in Linux

Whether you prefer to use a command-line or graphical application, several tools are available for free to combine multiple PDF files in Linux.

[ You might also like: How to Use Timeshift to Backup and Restore Linux ]

In this article, I’ll help you to merge multiple PDF files into one PDF without breaking the PDF content. Considering the Linux experience level, I’ll use both free command-line and GUI-based applications.

Merge Multiple PDF Files In Linux Using GUI App

Using the graphical app is helpful for not just beginners who find it hard to remember or type commands in a terminal, but also to save time by doing things with a click of a button.

Now there are several Linux software available that combine PDF files into one PDF such as PDF Chain, PDF Arranger, PDFJumbler, and PDF Mix Tool.

Though you’re free to use any of the tools, I’ll use the PDF Arranger app that offers the following important features:

  • Reorder PDF pages
  • Merge multiple PDF documents
  • Export all or selected page from a PDF
  • Delete, rotate, and crop PDF pages
  • Zoom in and out
  • Edit PDF metadata
  • Duplicate pages
  • Page format

Install PDF Arranger On Linux

If you’ve already set up universal package manager Flatpak, you can install PDF Arranger using Flatpak by running a single command:

$ flatpak install flathub com.github.jeromerobert.pdfarranger

However, if you don’t have Flatpak, binary packages of PDF Arranger are also available for several Linux distributions. If none of the installation methods works, you can install it from the source code.

Use PDF Arranger to Combine PDFs

Once you install it successfully, open the app and click on the icon at the top left corner. It will pop up a dialog box, where you can select all PDFs you want to merge.

Select PDF Files
Select PDF Files

Now you can see a list of all pages from the selected PDFs. Here before you combine all pages, you can perform certain actions such as rearrange, delete, export, and edit metadata.

Merge PDF Files
Merge PDF Files

After doing the modification, click on the second or third icon at the top left corner to merge all pages in a single PDF file.

Merge Multiple PDF Files in Linux Command Line

Coming to the command line method of combining multiple PDF files, it can be helpful for system administrators who work on the server without a Linux desktop.

Similar to GUI apps, there are also several command-line tools available such as PDFtk, pdfconcat, Ghostscript, and pdfunite.

For this article I’ll use PDFtk, which comes in three variant:

  • PDFtk Free: a free graphical app
  • PDFtk Server: a free command-line tool
  • PDFtk Pro: paid version with both CLI and GUI app

Being terminal-based does not mean that PDFtk Server lacks features. Like any other graphical PDF merger app, you can use PDFtk Server to perform the following functions:

  • Merge PDF documents or collate PDF page scans.
  • Split PDF pages into a new Document.
  • Rotate PDF pages.
  • Fill PDF Forms with X/FDF data and/or Flatten Forms.
  • Add a background watermark or a foreground stamp.
  • Edit PDF metadata.
  • Attach files to PDF pages and unpack PDF attachments.

Install PDFtk On Linux

The easiest way to install PDFtk on Debian and Ubuntu-based Linux distributions is by running a single command:

$ sudo apt install pdftk-java

For CentOS, Fedora, and Red Hat, you first need to install libgcj dependency.

$ sudo yum install libgcj

Then, you can download Binary RPM for Red Hat or CentOS – available for both 32-bit and 64-bit architecture.

$ sudo rpm -i pdftk-2.02-1.*.rpm

If you cannot find a binary file for your Linux distro, you can also compile and build PDFtk Server from its source code.

Use PDFtk to Combine PDFs in Command Line

To join multiple PDFs, you need to give its name in the terminal along with the name of the single combined PDF.

$ pdftk pdf1.pdf pdf2 cat output out1.pdf
Merge PDF Files in Linux Commandline
Merge PDF Files in Linux Commandline

If you have got a large number of PDFs to combine, you can also use an asterisk (*) wildcards as *.pdf.

$ pdftk *.pdf cat output combined.pdf

PDFtk also allows encrypting and decrypting a PDF using the “owner_pw” and “input_pw” options.

$ pdftk unsecured-1.pdf output secured-1.pdf owner_pw xyz [Encrypt PDF file]
$ pdftk secured-1.pdf input_pw xyz output unsecured.pdf [Decrypt PDF file]

To use other features of PDFtk like remove and delete pages from PDF, check out its official manual.

Based on your experience and situation, you can decide whether you want to use a command line or graphical tool to merge multiple PDF files into one PDF. PDF Arranger might seem easy to use on a Linux desktop, but PDFtk can be the choice on a server with no GUI.

Sarvottam Kumar is a software engineer by profession with interest and experience in Blockchain, Angular, React and Flutter. He loves to explore the nuts and bolts of Linux and share his experience and insights of Linux and open-source on the web/various prestigious portals.

Each tutorial at UbuntuMint is created by a team of experienced writers so that it meets our high-quality standards.

Was this article helpful? Please add a comment to show your appreciation and support.

1 thought on “How to Merge PDF Files Using GUI & CLI Tools in Linux”

Got something to say? Join the discussion.

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published or shared. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.