Linux: How to search and print command output?

VN:F [1.9.7_1111]
Rating: 0.0/10 (0 votes cast)

Well today, I was trying to do a simple test with Ubuntu. .. that is trying to print the output of the ‘ps -aux‘ command.  It wasn’t that bad.  The way to do this is to pipe it into the ‘LPR’ that is your printer.

e.g. ps -aux | lpr

This will send the output to your printer for printing.  Not hard at all.  :-)

For searching, you can use the same piping trick but with the ‘grep’ command after it.

e.g. ps -aux | grep testing

This will search the output for the word testing and listed them out.

To get fancy, you can then send the output of the search results to your printer.

ps -aux | grep testing | lpr

That’s the beauty of Linux.  Piping in Linux is very useful.

Related Tech posts:

  1. How to Find a file by name in UNIX/Solaris/Linux?
  2. How to cancel or delete a print job that is stuck in the print queue?
  3. How to add a printer to your printer list in Mac OS X?
  4. Linux Root Password
  5. Linux Server for ISPs and Hosters, What should be in it?
  6. How to add a DNS Suffix Search List to a Windows DHCP server?
  7. Useful Google Search Commands

About the Author