Earlier this week someone sent me a scanned document with each page as a separate JPG file. I prefer to keep documents as single PDFs, as they’re easier to file and search later, and fortunately this is easy on Ubuntu. First of all, you need to install ImageMagick if you don’t already have it:
sudo apt-get install imagemagick
Then you can convert all the JPG files to a single PDF file:
convert *.jpg output.pdf
Each file will be a separate page, with the order in which they would appear in a directory listing. No further arguments are required, as ImageMagick can work out the correct conversion from the filenames. Lots of other conversions are possible too, if you have different input/output formats.