Black Friday Sale – Up to50% OFFOFF, the Lowest Price of the Year!Save Now

UPDF Black Friday Sale

Black
FridayUp to

50% OFF
Save Now

How to Combine PDF on Linux: Complete Guide for Beginners

Are you looking to combine multiple PDFs into one document? Merging related PDFs is an excellent way to organize your work. However, on Linux, this simple task can be confusing if you don't know which tools or commands to use.

But don't worry. This guide shares the most reliable and effective ways to combine PDF on Linux. If you also work on non-Linux platforms, UPDF can help you merge your files without any complex code. You can download it now to get started!

Windows • macOS • iOS • Android 100% secure

Part 1. How to Combine PDF Files on Linux (Ubuntu)?

You can combine PDF files on Linux using either Terminal or a desktop PDF editor. Before you start, make sure you are familiar with basic command-line operations. Then, follow the steps below.

Option 1: Use pdfunite

Pdfunite is a command-line tool that is part of the Poppler-utils package on Linux. Here’s how to use it.

Step 1. Install (if needed)

Open the folder containing your PDFs. Right-click and choose “Open in Terminal.” Then, type the following code and press “Enter.”

sudo apt install poppler-utils

Step 2: Locate Your PDFs

Access your terminal and use this command to go to the directory where your PDF files are present:

cd ~/(the folder name where the files are present)

Step 3. Combine PDFs

Use the following command and press “Enter.” This code combines the files named “pdf1.pdf” and “pdf2.pdf” into a new file called “out.pdf.”

pdfunite pdf1.pdf pdf2.pdf out.pdf

command to merge pdf with pdfunite

Note:

Always include an output file name such as out.pdf or output.pdf. If you forget it, the last input file in the list will get overwritten.

If you need to merge a large number of PDF files in the current folder, you can replace the file names with “ *.pdf” instead. So, the command will become:

pdfunite *.pdf out.pdf

This code guides the shell to include all PDF files in the current directory. However, be aware that files will be combined in alphabetical (A-Z) order, not numerical order.

Option 2: Use PDFtk

PDFtk, or PDF Toolkit, is another simple command-line tool that helps you modify and combine PDF files on Linux. Here’s how to use it.

Step 1. Install PDFtk

Type the following command in your Terminal. Then, press Enter.

sudo apt install pdftk

Step 2. Access your PDFs

Once the tool is installed, open the terminal and navigate to the directory using this command:

cd ~/(the folder name where the files are present)

Step 3. Combine PDFs

In the terminal, enter the following command to merge your files:

pdftk file1.pdf file2.pdf cat output combined.pdf

Here's a brief explanation of this command:

  • file1.pdf file2.pdf: Input files in the order you want to merge them. Replace “file.pdf” with your PDF’s name.
  • cat: The concatenate command, which joins the files together.
  • output combined.pdf: Defines the name of the final merged file.

To merge all PDFs in the folder without writing individual names, you can also use this code.

pdftk *.pdf cat output combined.pdf

Option 3: Desktop Options on Linux - Stirling PDF

Stirling PDF is an open-source desktop PDF tool. It lets you combine PDF files on Linux via an interactive interface. So, it’s great if you want to avoid typing commands to merge PDFs.

However, you still need to install the tool in the Terminal. The steps to execute each command are the same:

  1. Open Terminal.
  2. Enter the command.
  3. Press “Enter.”

Step-by-Step Commands to Install Stirling PDF

Enter each of the following commands one at a time. Do not copy and paste all at once. This will make it much easier to identify and fix problems if they occur.

Here are the step-by-step commands:

Step 1. Enter the following code to update your package lists:

sudo apt-get update

Then install the required tools and libraries by entering:

sudo apt-get install -y git automake autoconf libtool \

libleptonica-dev pkg-config zlib1g-dev make g++ \

openjdk-21-jdk python3 python3-pip

Step 2. If you plan to use OCR features, run the following commands one by one:

mkdir ~/.git

cd ~/.git &&\

git clone https://github.com/agl/jbig2enc.git &&\

cd jbig2enc &&\

./autogen.sh &&\

./configure &&\

make &&\

sudo make install

Step 3. Install LibreOffice components, Tesseract (for OCR), and other tools:

sudo apt-get install -y libreoffice-writer libreoffice-calc libreoffice-impress tesseract-ocr

pip3 install uno opencv-python-headless unoserver pngquant WeasyPrint --break-system-packages

Step 4. Download the updated Stirling-PDF JAR file from the official server:

sudo wget https://files.stirlingpdf.com/Stirling-PDF.jar

sudo chmod +x Stirling-PDF.jar

Step 5. Choose a directory such as /opt/Stirling-PDF/. Then, move the downloaded JAR and the scripts folder there:

sudo mkdir /opt/Stirling-PDF &&\

sudo mv ./build/libs/Stirling-PDF-*.jar /opt/Stirling-PDF/ &&\

sudo mv scripts /opt/Stirling-PDF/ &&\

echo “Scripts installed.”

Step 6. If you will use non-English OCR, install Tesseract language packs:

sudo apt update &&\

# All languages

# sudo apt install -y 'tesseract-ocr-*'

# Find languages:

apt search tesseract-ocr-

# View installed languages:

dpkg-query -W tesseract-ocr- | sed 's/tesseract-ocr-//g'

Step 7. Launch the application by running:

java -jar /opt/Stirling-PDF/Stirling-PDF-*.jar

Step 8. Create a .desktop file to launch Stirling PDF from your Appmenu:

location=$(pwd)/gradlew

image=$(pwd)/docs/stirling-transparent.svg

cat > ~/.local/share/applications/Stirling-PDF.desktop <<EOF

[Desktop Entry]

Name=Stirling PDF;

GenericName=Launch StirlingPDF and open its WebGUI;

Category=Office;

Exec=xdg-open http://localhost:8080 && nohup $location java -jar /opt/Stirling-PDF/Stirling-PDF-*.jar &;

Icon=$image;

Keywords=pdf;

Type=Application;

NoDisplay=false;

Terminal=true;

EOF

After this step, you’ll find “Stirling PDF” in your application list.

Steps to Merge PDFs with Stirling PDF 

  1. Launch Stirling PDF. Then, click “Merge” from the main interface.
click merge
  • Click “Choose Files” to upload your PDFs.
  • Sort your PDFs by name or date. Then, click “Merge” to combine PDF on Linux.
choose files, sort, and merge pdfs

Part 2. Bonus Tip: Use UPDF to Combine PDF on Non-Linux Platforms

If you also work on non-Linux systems such as Windows, macOS, iOS or Android, you can easily combine PDFs with UPDF. It is a professional PDF editor that lets you join multiple PDFs into a single document - all without any code or command-line operations.

So, download and install it on your device. Then follow these steps to merge your files.

Windows • macOS • iOS • Android 100% secure

Steps to Merge PDFs on Desktop

  1. Launch UPDF. Then, click “Tools” from the bottom and choose “Merge.”
select merge under tools
  • Click “Add Files” and upload all the PDFs you want to combine.
  • Once your files are uploaded, click the “Page Size Options” dropdown in the top right. Choose whether to “Keep original size” or “Standardize page size.” Then, click “Apply.”
choose page size options and click apply

Steps to Merge PDFs on Mobile

  1. Install UPDF from the App Store or Google Play. Open it and tap the “+” button.
  2. Import your PDFs from Files, Photos, Computer or Cloud Drive. Then Select “Merge PDFs” and choose your desired files.
  3. Click “Continue” to merge the selected files into one PDF.

Windows • macOS • iOS • Android 100% secure

merge pdfs with updf on ios

Conclusion

To sum up, you can combine PDF on Linux using command-line or desktop PDF editors. pdfunite, pdftk, and Stirling PDF are some great options. But if you want a more interactive experience without complex codes, UPDF can help you. It’s a complete PDF editor for non-Linux systems. Plus, you can get started for free. Download and try it today!

Windows • macOS • iOS • Android 100% secure

We use cookies to ensure you get the best experience on our website. Continued use of this website indicates your acceptance of our privacy policy.