Score:0

using cp to print a text file

br flag

I have 2 printers (both are "Generic Text-Only Printer")

  1. The first one is connected directly to my laptop through a USB. This printer corresponds to a device /dev/usb/lp0. For this one I can print a file just by using either cp or lp

$ cp textfile /dev/usb/lp0

or

$ lp -d "printer-name" textfile

  1. The second one is a network printer with an URI "socket://192.168.0.123" Currently, I can only print a text file using the command lp

$ lp -d "printer-name" textfile

Is there any way I can use cp here? Just like the first printer Something like

$ cp textfile ...?

If I can use cp, then I can just write directly to that file (/dev/usb/lp0) to print something from an application. Otherwise, I need to write to a text file first, then launch "lp ..." . This is a lot more cumbersome.

Any help is greatly appreciated. Thank you very much

N0rbert avatar
zw flag
Probably you have to try `cat textfile > /dev/usb/lp0` or `lpr textfile`.
Score:1
br flag

Network connected printers require a network-aware application such as netcat to process a file.

nc printer_IP_or_host_name 9100 < printer-ready_file

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.