Jpegoptim is a Linux software that does what the name suggests: is does optimize jpg images. It is one of the two recommended software for Google Pagespeed optimization.
As this software doesn't have a recursion parameter, we use a trick to parse all the subdirectories where we have jpeg images to be optimized.