Unix - Pipes?

Discussion in 'Linux Discussion' started by ymcabookwormcat, May 5, 2008.

  1. Describe the Unix philosophy that deals with pipes and why we have pipes.
  2. row_o Guest

    row_o
    The pipe (|) is a great symbol in the linux/unix world.
    It basically sends the output of one command to another command but as its input.
    An example would be sending the output of a long list command into a perl command line script

    ls -la | perl -pe 's/one/two/g'
  3. M?l? Guest

    M?l?
    Adding further:-

    Pipes allows you to use simple unix commands together to make more complex/powerful programs

    Like above program
    ls -la | grep abc | lpr
    this allows to list all files using ls command, pass to filter (grep) for filename having name "abc" and send it to print.

    So according to unix philosophy, command should be mainly used for one purpose/task like command ls (for listing files),grep (filter result) ,lpr (for printing) etc but piping allows us to build more complex program/commands using this building blocks of unix commands (without writing new program codes for doing this job).

    Try doing same things in microsoft Windows and you have to bang your head even for doing simple command like above. Though windows is catching up by allowing use of limited scripting language and commands but still way behind.
    M?l?,
Loading...

Share This Page