2.3 File Name Conventions
Good file names: use characters: upper,lower case letters,
digits, underscore, period, comma, and plus sign.
1st character = . implies a hidden file
System V Rel 3 or before uses a maximum of 14 character file names [Rare-RK]
System V Rel 4 or BSD versions use a maximum of 256 character file names [Most Implementations now RK]
File name expansion (a facility performed by the shell)
For a filename:
= Wildcards in DOS: ? In the current directory match any character
* In the current directory match zero or more characters
[aeiou] In the current directory, match a vowel in a single
character position
[a-f] In the current directory, match the first 6 letters of
the alphabet in a single character position
[!A-Z] In the current directory, match anything except a
capital letter in a single character position.
Note: matching a hidden file requires the leading . to be specified: .* not *
Forward slashes will not be matched by * or ?. Use them explicitly also.
Examples:
$ # What do these commands with wild cards match?
$ # What error message do you get with ls or echo if there is no match?
$ echo *a
$ ls *[xyz]
$ echo *.?
$ ls ??
$ echo *.obj
$ ls m*
$ ls -l /usr/a[acs-y]*
$ echo *add*
$ mv Chap?.unix archive
$ cat *.year > manyyears
$ cat chap[1-6] > manychapts
$ cp accounts89 accounts.arc
$ cp account6 payments $HOME/archives
$ cp account* archives
$ mv accounts89 accounts.arc
$ mv payments $HOME/archive/payments.89
$ mv account6 payments $HOME/archives
$ mv acc*89 archives
Questions? Robert Katz: rkatz@ned.highline.edu
Last Update June 26, 2003