-1

I can't find any way to list out files with specific string in random location of the filename, except "find" command.

I don't want to use find command, it is very complicated to me.

for example: I want to list out files with "def" inside the filename no matter where the specified string is located. aa234aaaaaaaaadefaaaaa42.txt defaaaaaaaa234.txt aaaa234aadef.txt

Is there way to achieve this with our common "$ls" command ?

Thx

1 Answers1

0

With find:

find . -name "*def*"

with fd

fd def

With ls

ls ./*def*

Note that ls won't go thru subdirectories, you will need to search each and every directory manually.

mashuptwice
  • 3,395