Every now and then a customer comes to me with a lot of JPEG formated files that need to be optimized for online use. The main reason for optimizing them is to use them online, or to burn them to a DVD that doesn't require them to be on top quality. I do that often when creating static web-sites that live inside the DVD and are given to visitors on seminars.
There is a command line tool available under Linux that allows you to optimize all images in a given directory with a very simple command. Say hello to jpegoptim.
Install jpegoptim using your package manager (in Archlinux it is available in AUR at the moment I'm writting this) and go to a folder with a lot of jpeg files.
Then simply type:
jpegoptim -t *
And enjoy the output and the savings on file size:
Average compression (174 files): 84.68% (921529k)
You can of course experiment more with the options it provides, make sure to read man page. It is a lifesaver on many situations so keep it in mind.