Ubuntu – How to combine the output of multiple `find` commands

command linefind

find -type f -name "*.avi" -exec md5sum {} + > checklist.chk
find -type f -name "*.mp4" -exec md5sum {} + > checklist.chk

How to combine these two commands?

  1. Either by combining both search terms in one command or

  2. So that each command adds its output to the same file.

Hope it's clear what I am trying to do.

Best Answer

Combining:

find -type f \( -name "*.avi" -or -name '*.mp4' \) -exec md5sum {} + > checklist.chk 

Adding output to one file:

find -type f -name "*.avi" -exec md5sum {} + > checklist.chk
find -type f -name "*.mp4" -exec md5sum {} + >> checklist.chk
Related Question