File Glob Patterns in Linux terminal

后端 未结 3 1974
北海茫月
北海茫月 2021-01-25 05:08

I want to search a filename which may contain kavi or kabhi. I wrote command in the terminal:

ls -l *ka[vbh]i*
<
3条回答
  •  伪装坚强ぢ
    2021-01-25 05:39

    a slightly longer cmd line could be using find, grep and xargs. it has the advantage of being easily extended to different search terms (by either extending the grep statement or by using additional options of find), a bit more readability (imho) and flexibility in being able to execute specific commands on the files which are found

    find . | grep -e "kabhi"  -e "kavi" | xargs ls -l
    

提交回复
热议问题