[Linux] Merge Multiple PDF Files Into One File

I’m using Linux Mint on my Dell GX260 desktop. It’s another Linux distro based on (and compatible with) Ubuntu Linux. Therefore this installation tutorial might be more suitable for you who’s using Ubuntu and anyother distro based on it. But overall, you can install the package on any Linux distro you’re using now.

1. Install Ghostscript  (PostScript and PDF language interpreter and pre‐viewer), use command:

# sudo apt-get install gs

sudo apt-get install gs

2. Install PDFtk (A handy tool for manipulating PDF), using command:

# sudo apt-get install pdftk

sudo apt-get install pdftk

3. run the command line

Merge 2 files (or more) into one file:
pdftk doc_1.pdf doc_2.pdf doc_3.pdf cat output doc_combined_123.pdf

pdftk

Other Commands:

Using Handles:
pdftk A=doc_1.pdf B=doc_2.pdf cat A B output doc_combined_12.pdf

Using Wildcards:
pdftk *.pdf cat output doc_combined.pdf

Split Selected Pages from Multiple PDFs into one new PDF file:
pdftk A=one.pdf B=two.pdf cat A1-7 B1-5 A8 output combined.pdf

Encrypt a PDF using default 128-Bit Strength and Withhold All Permissions:
pdftk mydoc.pdf output encrypted_doc.128.pdf owner_pw your_password_here

Same as Above, Except a Password is Required to Open the PDF:
pdftk mydoc.pdf output encrypted_doc.128.pdf owner_pw blablabla user_pw helloworld

Same as Above, Except Printing is Allowed (after the PDF is Open):
pdftk mydoc.pdf output encrypted_doc.128.pdf owner_pw blablabla user_pw helloworld allow printing

Decrypt:
pdftk encrypted_doc.pdf input_pw helloworld output decrypted_doc.pdf