A Quick Introduction to Unix/Wildcards
< A Quick Introduction to UnixWildcards
A wildcard is a character that can stand for all members of some class of characters. When you use a wildcard the computer systems substitutes the members of the class for the wildcard character. The examples below will make this clearer. We will use the command ls for illustration.
The * wildcard
The character * is a wildcard and matches zero or more character(s) in a file (or directory) name. For example, in your mytraining directory, you might type
% ls list*
This will list all files in the current directory starting with list.
You could type
% ls *list
This will list all files in the current directory ending with list.
The ? wildcard
The character ? will match exactly one character.
So ?ouse will match files like house and mouse, but not grouse.
An example use of this syntax is:
% ls ?list
Contents
- Components
- Shells and subshells
- Directory Structure
- Changing Directories
- Listing Files and Directories
- Pathnames
- Files and Processes
- Wildcards
- Exercises 1
- Creating Directories
- Creating Files
- Special Directories
- Exercises 2
- Copying Files
- Moving Files
- Deleting Files
- Exercises 3
- Redirection
- Searching Text Files
- More grep examples
- Permissions on Files and Directories
- Editing Text
- Exercises 4
- My First Shell Script
- Job Control
- Links
- Environment Variables
This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.