What is the difference between find with grep?

前端 未结 3 470
死守一世寂寞
死守一世寂寞 2021-02-03 10:14

What is the difference between these command:

find . –type f –name \'*txt*\' 

and

find . –type f | grep \'txt\'
3条回答
  •  一个人的身影
    2021-02-03 10:53

    When you have a path with txt in the directory name, the second command will find a match. When you do not want to match paths like txtfiles/allfiles.tgz and transactions/txtelevisions/bigscreen.jpg you will want to use the first.

提交回复
热议问题