Front | Info | Lists | Newsfeeds | Study Guide | What is BSD?
Advertisement: The OpenBSD PF Packet Filter Book: PF for NetBSD, FreeBSD, DragonFly and OpenBSD

BSD Links
·New Links
·User Groups

This is the BSDA Study Guide Book written via a wiki collaboration. This is a work in progress. You may contribute to or discuss this specific page at

Demonstrate proficiency in using redirection, pipes and tees


Be able to to redirect standard input, output or error, use a pipe to send the output of one command to another command or file, and use a tee to copy standard input to standard output.


tee: pipe fitting, this utility copies standard input to standard output, making a copy in zero or more files. The output is unbuffered.

file descriptors (fd):

fd 0: stdin

fd 1: stdout

fd 2: stderr

<: redirect stdin of a process so that input is read from a file instead of from the keyboard

command < infile

>: redirects stdout to a file

command > outfile

>>: appends stdout to a file

command >> outfile

| : piping command output to another command

command1 | command2 | ... | commandN

tee: lets you divert a copy of the data passing between commands to a file without changing how the pipeline functions

who | tee savewho | wc -l

>&: temporarily connect something to something else

ls 2>&1 means temporarily connect stderr to stdout



Practice Exercises

More information

<, >, |, tee(1), >\& and |\&

Front | Information | Lists | Newsfeeds