0

I have a directory x which contains n files. I need to find which of them contains the word y or z in their name by typing just one command.

ls *x*|*z*
ls [*x*|*z*]

How can I do that? Thank you in advance!

Koti
  • 177
  • 11

1 Answers1

0

use find. Specify path to your x directory, specify that you want to find only files (type-f) and list several masks for files you want with -name:

find /path/to/x_directory -type f -name "*y*" -name "*z*"
Saboteur
  • 1,331
  • 5
  • 12