Front | Info | Lists | Newsfeeds | Study Guide | What is BSD? |
|
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 http://bsdwiki.reedmedia.net/wiki/Demonstrate_proficiency_in_using_redirection__44___pipes_and_tees.html. Demonstrate proficiency in using redirection, pipes and teesConceptBe 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. Introductiontee: 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 |&: ExamplesPractice ExercisesMore information<, >, |, tee(1), >\& and |\&
|