File Glob Patterns in Linux terminal

后端 未结 3 2014
北海茫月
北海茫月 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:14

    You can get what you want by using curly braces in bash:

    ls -l *ka{v,bh}i*
    

    Note: this is not a regular expression question so much as a "shell globbing" question. Shell "glob patterns" are different from regular expressions, though they are similar in many ways.

提交回复
热议问题