Globbing: The process of expanding a wildcard to the list of matching file names is called globbing, and UNIX shells have a variety of globbing operators (so-called globs) to help you express what you’re looking for:
- The glob * (star) matches any character or sequence of characters, including an empty sequence.
- The glob ? (question mark) matches any single character.
- The glob [ ] (square brackets) matches any of the enclosed characters. Within the brackets, you can refer to a range of characters by using – (hyphen), as in [a-z] or all lowercase letters.
finds only those items that have a one-letter suffix.
ls -1 *.?
alloca.c
ansi2knr.c
cmpt.c
cmpt.o
This command finds only those items that have four characters followed by a dot and one character.
ls -1 ????.?
cmpt.c
cmpt.o
Finally, following command finds items that begin with lowercase a, lowercase b, or lowercase c and are followed by at least one letter, then anything, then a period, and then any suffix.
ls [a-c]?*.*
alloca.c
ansi2knr.c
cmpt.c
Aliases: An alias is a short sequence that you use instead of a longer command.
alias findreports=’find $HOME -type f -name “*.txt” -print | xargs grep -l “Monthly Report”‘
Single quotation marks must delimit each alias. If you need quotation marks inside the alias, use double quotation marks.
To see all the aliases set in your shell, just type alias.
If you want to remove an alias, just type unalias and the alias’s name.