Featured

    Featured Posts

Wildcards

A wildcard is a symbol or a set of symbols that stands in for other characters. It can be used to substitute for any other character or characters in a string. For example, you can use a wildcard to get a list of all files in a directory that begin with the letter O.
Three types of wildcards are common in Linux:
? – matches a single character. For example, O??d matches anything that begins with O, ends with d and has two characters in between (like Oind, Okhd, Oerd, but not Oereed, Oad, Oerererd.)
* – matches any character or set of characters, including no character. For example, O*d matches anything that begins with O and ends with d (like Oind, Okhd, Oerd, Oereed, Oad, Oerererd, Od, Oarmeerrd). The number of characters in between O and d is not important.
Bracketed values – match characters enclosed in square brackets. For example, O[ac]d matches only Oad and Ocd. You can also specify a range of values: O[a-e]d matches Oad, Obd, Ocd, Odd and Oed.
Let’s look at a couple of examples. We have created files mentioned above:
linux files for wildcards
If we want to list all files that begin with O, end with d and have two characters in between, we need to use the following syntax:
linux wildcard question mark
To display all files that begin with O and end with d, no matter the number of character in between, we need to use the following syntax:
linux wildcard asterix
To display all files that begin with O and end with d and have a or c in between, we need to use the following syntax:
linux wildcard  brackets
author

Author Name

Author Description!

Get Free Email Updates to your Inbox!

Post a Comment

www.ccna.ma

yu
Powered by Blogger.

Translate

Copyright © Learn Linux Th3pro.xyz | Blogger Templates | Designed By Code TAOUSSI