Merge multiple pdfs into a single file

Ubuntu brings a nice package called “pdftk” for editing pdfs using the command line. This command joins multiple pdfs into a single pdf:

pdftk 1.pdf 2.pdf 3.pdf cat output 123.pdf

Here is another way to join pdf files, that only requires ghostscript:

gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=123.pdf 1.pdf 2.pdf 3.pdf