CS155: Introduction to Unix

Spring 2018

Wildcards

See this page as a slide show

Wildcards

CS155 Wildcards

Next

Vocabulary 
Punctuation*, ?, [], {}
Grammar 

Wildcards

Wildcards: Examples 1

% cd ~/pub
% ls
Examples	   area-codes	dwarfs.txt  hw1Files  hw3.tgz	 numbers
HW4-solution.html  domains.txt	greek	    hw2Files  index.php  planets
% ls *.txt
domains.txt  dwarfs.txt
% cd ~/pub
% ls d*
domains.txt  dwarfs.txt

Wildcards: Examples 2

% cd ~/pub
% ls *n*
HW4-solution.html  domains.txt	index.php  numbers  planets
% cd ~/pub
% ls -d hw[0-9]*s
hw1Files  hw2Files
% cd ~/pub
% ls -d *.{php,txt}
domains.txt  dwarfs.txt  index.php

Wildcards: In Use

Move all .txt files into the directory files

    % mv *.txt files

Remove all files beginning with HW, followed by a digit, and ending with .file

    % rm HW[0-9].file

List all files ending with .txt or .jpg

    % ls -l *.{txt,jpg} | more

Example Failure

User: Guest

Check: HTML CSS
Edit History Source

Modified: 2017-12-26T16:48

Apply to CSU | Contact CSU | Disclaimer | Equal Opportunity
Colorado State University, Fort Collins, CO 80523 USA
© 2018 Colorado State University
CS Building