How to use tar to compress only two files in a directory

compressiontar

I'm trying to compress only two files in a directory. Let's say I have a directory named 'images'. In the directory, I have a.jpg, b.jpg, c.jpg, and d.jpg. I like to compress only a.jpg and b.jpg using tar.

I googled about it, but weirdly I could not find it!

Best Answer

Maybe:

tar cvf output.tar images/{a,b}.jpg

?