3

In windows you can use LPR

In Linux you can do lpr or 'data.txt > /dev/lpt1/'

How do I do it on a Mac?

Mark Henderson
  • 68,316
  • 31
  • 175
  • 255
sanbornm
  • 105
  • 1
  • 6

2 Answers2

4

lpr works great on the Mac.

If you type "lpr foo.txt" on my MacBook Pro, it gets sent to my default printer. Make sure that you have a printer setup.

Update: I asked a few of the Mac guys in the office about this and they indicated that in the past, some low-end "Win-Printers" with Mac drivers were unable to actually process plain text coming from LPR. We've since removed all of these printers from our inventory, so I'm unable to verify.

duffbeer703
  • 20,077
  • 4
  • 30
  • 39
  • 1
    This is an excellent and easy solution. We use `lpr` and `html2ps` on our web servers to print out web orders and it works like a charm. – morgant Aug 25 '09 at 16:59
2

Another handy option is to use netcat to send a raw postscript file directly to a networked printer. This is occasionally useful in wierd circumstances, like if you don't have or don't want to install printer drivers. I find it particularly useful on Linux boxes since you never know quite how they are set up.

Most Mac and Linux apps will print to a postcript file, and then you can run:

nc 255.255.255.255 9100 < file.ps

to send the postscript file directly to a printer on the network. (Replace the 255s with the actual printer IP address.)

Not something you'll use every day, but if you do a lot of consulting/troubleshooting on the road with your laptop it may come in handy.