Show Menu
Cheatography

Wildcards Cheat Sheet (DRAFT) by

Wildcards in Linux, SQL

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Wildcards in Linux

*
matches one or more occurr­ences of any character, including no character.
$ rm tar
?
represents or matches a single occurrence of any character.
$ ls l?st.sh
[]
matches any occurrence of character enclosed in the square brackets. It is possible to use different types of characters (alpha­numeric charac­ters): numbers, letters, other special characters etc.
$ ls users-­[0-­9][­a-z­0-9­][0-9]*
!
negate a set of charac­ters.
$ ls users-­[0-­9][­!0-­9][­a-z­A-Z]*
-
Represents a range of characters
$ ls users-­[0-­9][­!0-­9][­a-z­A-Z]*
 

Wildcards in SQL

%
Represents zero or more characters
	bl% finds bl, black, blue, and blob
_
Represents a single character.
h_t finds hot, hat, and hit
[]
Represents any single character within the brackets.
	h[oa]t finds hot and hat, but not hit
^
Represents any character not in the brackets
h[^oa]t finds hit, but not hot and hat
-
Represents a range of characters
c[a-b]t finds cat and cbt