Install the Perl package
Image::ExifTool. It includes a command-line program called
exiftool that can change EXIF, IPTC, XMP, and many other forms of image metadata:
$ exiftool -IPTC:caption="This is a great image" image.jpg
ExifTool understands a great many other tags as well.
There's a good chance that your OS has an ExifTool package already. It's in the Ubuntu package repository as
libimage-exiftool-perl, in FreeBSD Ports as
graphics/p5-Image-ExifTool, and in OS X Homebrew as
exiftool, for example. The official site distributes Mac OS X and Windows standalone versions.
If you have
cpanm on your system, the second easiest way to install
$ sudo cpanm Image::ExifTool
You can also install through
cpan, which is only slightly more involved, once you get past all the questions it asks the first time you run it:
cpan> install Image::ExifTool
If you have neither
cpan installed, even installing from source is not hard:
# cd /tmp
# wget http://search.cpan.org/CPAN/authors/id/E/EX/EXIFTOOL/Image-ExifTool-9.53.tar.gz
# tar xvf Image-ExifTool-9.53.tar.gz
# cd Image-ExifTool-9.53
# perl Makefile.PL
# make install
Run the program without arguments to get a detailed manual page.