Using Pipes in Linux
Updated January 10, 2003
Created January 10, 2003


Autogenerated Site Map
Search this Site!:
Search this site powered by FreeFind

If the tools you need are not local, but available on another box, just put it together in a pipeline.

Here's the command I want to run:

rpm2cpio anaconda-7.1-5.src.rpm | cpio -idvm

This fails to run and complains because I am on a Red Hat 6.2 system which has RPM 3, and this package requires RPM 4 to unpack it.

The above command can also be re-written like this:

cat anaconda-7.1-5.src.rpm | rpm2cpio | cpio -idvm

I don't want to install RPM 4 on this Red Hat 6.2 box because it is a build server and I require RPM 3 on it. I'll just borrow RPM 4 from one of my Red Hat 8.0 boxes like this:

cat anaconda-7.1-5.src.rpm | ssh user@rh80dest "rpm2cpio " | cpio -idvm

The above works beautifully.

May this show you the power of unix, being text based, and the power of pipes. Unix is like a toolbox full of tools. Just grag the tools you need and get to work. No need to say, "this complex tool won't do what I need it to" -- in Unix you make your own "complex tools".

Search this Site!:
Search this site powered by FreeFind

Homepage: http://www.cpqlinux.com
Site Map: http://www.cpqlinux.com/sitemap.html