Ubuntu – How to locate all files that include specific word as part of name and end with specific extension

command linelocate

I am using locate command.

I want to find all files that end with specific extension and have specific keyword in their name.

For example I want to find image such as this:

myImageFromSummer.jpg

I want to search by keyword "Summer" and extension ".jpg".

How would command look like for this task?

Best Answer

locate -b '*Summer*.jpg'

The -b option tells locate to only match the file name and * in the pattern match any number of characters.