CS155

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    domains.txt  greek	   hw2Files  index.php	planets
area-codes  dwarfs.txt	 hw1Files  hw3.tgz   numbers
% ls *.txt
domains.txt  dwarfs.txt
% cd ~/pub
% ls d*
domains.txt  dwarfs.txt

Wildcards: Examples 2

% cd ~/pub
% ls *n*
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

Modified: 2017-12-26T16:48

User: Guest

Check: HTML CSS
Edit History Source
Apply to CSU | Contact CSU | Disclaimer | Equal Opportunity
Colorado State University, Fort Collins, CO 80523 USA
© 2015 Colorado State University
CS Building