Merging multiple PDF files with GhostScript and pdftk


I had to merge multiple PDF files into one recently and wanted a quick way to do it. In order to do this I had to

  1. Download and install ghostscript and pdftk
    sudo apt-get install gs pdftk
  2. cd into the directory containing the files and issue command
    gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=combined.pdf -dBATCH first.pdf second.pdf