Sunday, November 21, 2010

Piping And Redirecting Standard Output

,
With linux commands, we can output the command result to the screen. Sometimes we have problem with the output on the screen. For example, the output is too long to displayed on the screen. To resolve the problem, we can pipe or redirect the output to somewhere else. You can use the | character to pipe the commands or > character to redirect it. Let's look at this command :

  1.  ls /lib | less
  2.  ls /lib > output.txt
    The command number one will pipe the output of the ls command to the less. So you can scroll the result of ls /lib. The command number two will redirect output of ls /lib to the file named output.txt. The ls /lib command won't be displayed to the screen.

    0 comments to “Piping And Redirecting Standard Output”

    Post a Comment