Redirects and Pipes.

As alluded to before pipes let you run the output of a command through another command. Piping through more (e.g. ls -la | more) lets you use the more command to better observe the results of ls. Another example what the prettyprint alias in the cshrc example where we piped through lpr to send to the printer.

Many programs also take input from standard input (stdin is usually your keyboard) and spew results to standard output (stdout is usually your screen). To redirect stdin or stdout you use greater than and less than symbols: > and <.

Think of this as taking data, shoving it in the wide part of the symbol, and shooting it out the narrow end. In most cases I find myself wanting to redirect stdout. An alternative to mv might then be:
cat myfile > mycopy .

But what if you got something like: myfile: File exists. This is one of those rare cases where UNIX didn't blindly do what you want and thought you might have made a mistake. To overwrite use:
cat myfile >! mycopy
and hope there wasn't anything in mycopy that you wanted.

To append instead of overwriting use:
cat myfile >> mycopy .

WARNING: the syntax of redirects varies between shells.

Now suppose you have a program that expects you to type several inputs on the keyboard then does something and prints the results to the screen. Such a program comes from Passcal call sac2ah and to use this program you need to type:
sac2ah < sacfile > ahfile .

where sacfile is your input file and a new file called ahfile will be created. We redirected stdin (i.e. sacfile) and fed it to sac2ah, then redirected stdout to ahfile.

Redirects are often also used for looping in shell scripts but that's another topic.