Up to main menu
Back to Directory and File Manipulations
Next: Other Basic Commands
File names and Wildcard symbols
Unix provides an easy way to name many files at once,
using the ``wildcard'' symbol *
(asterisk).
Here are some examples of the use of the asterisk.
- a* refers to all the files
(and subdirectories) in the
current directory whose names start with ``a''
- *.txt refers to all the files in the
current directory which have the suffix .txt
- * refers to all the files in the
current directory -- except for ``dot files'',
the files whose names begin with a dot.
- */* refers to all the files in all
of the subdirectories of the current directory.
This excludes files and directories named with a dot.
Be very careful not to use the command
rm * , which would remove all the files
in the current directory.
That is, unless you really intend to do that!
Another wildcard arrangement uses the square brackets ``[]'',
which allow the user to list specific alternate characters;
- [ab]* refers to all the files
(and subdirectories) in the
current directory whose names start with
either ``a'' or ``b''.
- x[ab]* refers to all the files
whose names start with ``xa'' or ``xb''
- [xX][ab]* refers to all the files
whose names start with either ``xa'', ``xb'',
``Xa'', or ``Xb''.
Up to main menu
Back to Directory and File Manipulations
Next: Other Basic Commands
Bruce.Fast@Colorado.EDU