
One thing very important to keep in mind when typing commands to the shell is that must punctuation symbols mean something special to it. Therefore if the name of a command or file contains a non-alphanumeric character, you should enclose the name in single quotes. For example
rm 'mail from bill@facstaff'Note that the space character is considered a special character.
rm *.txtThe special characer "*" is called a wild card meaning it matches any number (including zero) of any character. If the files atom.txt, electron.txt, and quark.txt existed in your directory, the above command would be "expanded" to
rm atom.txt electron.txt quark.txtSimilar to "*" is "?" which stands for any one character. For example,
rm c?twould remove the files cat, cot, and cut but not coat or ct. A c*t would have removed all these files. Using square brackets which contain select characters operate like a selective "?". For example,
rm c[au]twould remove the files cat and cut, but not cot or any other file.
Often your will want to list several files on the command line that are not in the current directory. It is painful to have to type the same pathname to all these files. This is were the curly brackets are useful. For example,
rm /usr/tmp/{game.log,temp.txt,doom.tmp}
removes the files game.log, temp.txt, and doom.tmp in the /usr/tmp directory.A tilde with no alphanumeric character immediately after expands to your home directory. A title followed by a user's login name expands to that users home directory. For example,
cp ~raines/.emacs_full ~/.emacscopies the file .emacs_full from raines's home directory to the file .emacs in your home directory.
All these things can be combined too!
rm ~/games/{c[ao]t,*.txt}
mail -s "The Data" armd@physics < nmr.datwould mail the contents of nmr.dat to user armd. For programs that output on a simple line by line basis to the terminal, the '>' symbol can be used to redirect that output to a file. For example,
sort < phone.list > newphone.listuses the sort program to sort the lines in the file phone.list and place them in the new file newphone.list. If you only want to append to an existing file, use the '>>' symbox instead.
The '|' symbol, called the pipe symbox, can be used to connect the output of one command to the input of another. For example,
grep George phone.list | sortuses the grep program to find all lines in phone.list containing the word George and then passes it to the sort program which print the lines sorted on your terminal. You can connect as may programs as you need this way.
.cshrc
alias mail 'pine'
alias Mail 'pine'
alias man 'man -F'
alias cp 'cp -i'
alias rm 'rm -i'
set prompt=("Your command? ")
.profile
alias mail= "pine" alias Mail="pine" alias man= "man -F" alias cp= "cp -i" alias rm= "rm -i" PS1="Your command? "These aliases help you by relieving you of having to think as hard while you are computing. The -i flag on the copy and delete commands make them ask if you really want to overwrite or remove the target file. I've already aliased these for you in an attempt to head-off disaster.

Last modified 9/12/96
College of William and Mary, Dept. of Physics