Skip to main content
IBM 
ShopSupportDownloads
IBM HomeProductsConsultingIndustriesNewsAbout IBM
IBM : developerWorks : Linux : Education - Tutorials
LPI certification 101 exam prep, Part 2
ZIPPDF (letter)PDF (A4)e-mail
Main menuSection menuFeedbackNext
5. Text processing
  


Redirection revisited page 1 of 14


You can use the > operator to redirect the output of a command to a file, as follows:


$ echo "firstfile" > copyme

In addition to redirecting output to a file, we can also take advantage of a powerful shell feature called pipes. Using pipes, we can pass the output of one command to the input of another command. Consider the following example:


$ echo "hi there" | wc
      1       2       9

The | character is used to connect the output of the command on the left to the input of the command on the right. In the example above, the echo command prints out the string hi there followed by a linefeed. That output would normally appear on the terminal, but the pipe redirects it into the wc command, which displays the number of lines, words, and characters in its input.


Main menuSection menuFeedbackNext
PrivacyLegalContact