Is there a way to tell which files I accidentally renamed to *.jpg aren't actually JPEG images?
You can use file FILENAME to determine the type of data in a file.
$ file image.jpg text.jpg pdf.jpg
image.jpg: JPEG image data
text.jpg:  ASCII text
pdf.jpg:   PDF document, version 1.4

So, file *.jpg | grep -v JPEG should give a list of all non-JPEGs with the &quot;.jpg&quot; extension
Also, assuming there are PDFs you can rename them in one go
find . -type f \
    -exec sh -c 'file &quot;$1&quot; | grep -q PDF' _ {} \;  \
    -exec sh -c 'echo mv -- &quot;$1&quot; &quot;${1%%jpg}pdf&quot;' _ {} \;

Remove the echo  in the second line once you verified that the output looks ok.