Meta characters (or) wild card characters

Ratings:
(4)
Views: 0
Banner-Img
Share this blog:

 

Wild Card Characters In Unix/Linux

*: It matches zero (or) more characters in the given file  

Ex:      

$  ls a* ---->Displaying files star with ‘a”.

$  ls  i*---->Start with ‘I” end with ‘g’

$ ls   *g---->list out  end with ‘g’ only

$ rm I *---->removes start with i

$cp  a* Documents/copies start with a

$ cp - rf I * g Documents /

$  cp - rvf * / backup copies current directory all files

? : It matches any single character in the given file  

Ex:        

$ ls ?---->Display single character files.

$ ls ??---->Two character files

$ ls a ??? ---->list four character files but first one is ‘a’.

$ rm ??  ---->Removes two character files.

$ cp ??? Documents/ copies three character files.

[     ]: It matches any single characters in the given list.

Inclined to build a profession as Linux Developer? Then here is the blog post on, explore Linux Training

Ex: $ ls [aeiou] ---->Displays given matching character files.

$ ls [aeiou] * ---->Displays start with a,e,I,o,u files.

$ rm [aeiou] *---->Removing start with a,e,I,o,u

$ cp [aeiou] * Unix/copying start with a,e,I,o,u    

[  -   ] : It matches any single characters in the given range.

Ex:      

$ ls [a-f]  *---->Displays start with a,b,c,d,e,f

$ ls [a-f, o-v] * ---->Display start with a-e & o-v

$ rm  [a-f] *---->Removes a-f

$ cp  [a-f, 1-9]  *  Unix/copying files a-f & 1-9

 

Linux Tutorials

 

For an in-depth understanding of Linux click on

 

 

You liked the article?

Like: 0

Vote for difficulty

Current difficulty (Avg): Medium

EasyMediumHardDifficultExpert
IMPROVE ARTICLEReport Issue

About Author

Authorlogo
Name
TekSlate
Author Bio

TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills in the market.