Skip to main content

Command Palette

Search for a command to run...

Wildcard searching in the terminal

Updated
1 min read
Wildcard searching in the terminal

While I often reach for * when searching for files in the terminal, I just discovered that the ? symbol represents a single character. Secondly, in a similar manner to regex, you can also specify a subset of characters by placing them in [].

chris@chris-book:~$ ls sho*.txt
shoe.txt shogun.txt shoot.txt shot.txt

chris@chris-book:~$ ls sho?.txt
shoe.txt shot.txt

chris@chris-book:~$ ls sho[efg].txt
shoe.txt

So you too can now be more powerful with your search!