# Print from irb to CUPS daemon

**URL:** <https://www.ruby-forum.com/t/print-from-irb-to-cups-daemon/185770>\
**Category:** Ruby\
**Created:** [March 25, 2010, 8:43pm UTC](https://www.ruby-forum.com/t/print-from-irb-to-cups-daemon/185770 "2010-03-25T20:43:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![byrnejb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d2c977/32.png) [@byrnejb](https://www.ruby-forum.com/u/byrnejb)\
**Post date:** [March 25, 2010, 8:43pm UTC](https://www.ruby-forum.com/t/print-from-irb-to-cups-daemon/185770/1 "2010-03-25T20:43:22Z")

</div>

I have googled for this topic but cannot seem to find anything  
useful. I want to print a few things directly from an irb session to  
one of a number of networked printers that I have configured with  
CUPS.

$ lpstat -v  
device for HPLj5N: socket://168.192.1.49:9100  
device for NP4172: lpd://168.192.1.52/NP4172  
device for NP4173: lpd://168.192.1.53/NP4173  
device for NP4174: lpd://168.192.1.54/NP4174

For example:

> > my\_lp = File.open("???",“w”)
> > 
> > my\_lp.puts(my\_array)

What argument string do I use in order to obtain an IO stream to one  
of these devices?

---

<div class="post-metadata">

**Author:** ![byrnejb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d2c977/32.png) [@byrnejb](https://www.ruby-forum.com/u/byrnejb)\
**Post date:** [March 28, 2010, 4:08am UTC](https://www.ruby-forum.com/t/print-from-irb-to-cups-daemon/185770/2 "2010-03-28T04:08:34Z")

</div>

On Fri, 26 Mar 2010 04:42:35 +0900, byrnejb wrote:

> > > my\_lp = File.open("???",“w”)
> > > 
> > > my\_lp.puts(my\_array)
> 
> What argument string do I use in order to obtain an IO stream to one of  
> these devices?

my\_lp = IO.popen(“lp -d printername”)
