Skip to Content
Running Mac OS X Tiger
book

Running Mac OS X Tiger

by Jason Deraleau, James Duncan Davidson
December 2005
Intermediate to advanced
400 pages
11h 33m
English
O'Reilly Media, Inc.
Content preview from Running Mac OS X Tiger

Printing from the Command Line

Since the Mac OS X printing infrastructure is built on top of various Unix tools, it should be no surprise that you can print from the command line. You can print plain-text, PDF, and PostScript files from the command line by using the following command:

    lp filename

You can print the following kinds of files from the command line to any printer:

  • Plain text

  • PDF

  • PostScript

Because Mac OS X supports all these technologies in its print system, you don’t have to worry about sending PostScript to a non-PostScript printer—even if the printer is an old dot matrix printer. For example, to print out the contents of a PostScript file named requirements.ps, you would use the command shown in Example 10-5.

Example 10-5. Printing a text file to a printer

$ lp requirements.ps
request id is HP_LaserJet_5000-6 (1 file(s))

CUPS tells you that the job has been submitted and provides you with an identifier for the job. The identifier is composed of two parts: the name of the printer that the job will be printed on—in this case, HP_LaserJet_5000—and a sequence number—in this case, the number 6 indicates that this is the sixth job printed from this machine since CUPS was launched.

When called by itself, lp prints to the default printer on the system. To print to another printer, you have to specify its queue to the lp command. But how do you know the names of the printers attached to your computer? Use the lpstat command (refer back to Example 10-1 to see this in action).

Armed with ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

OS X Mavericks: The Missing Manual

OS X Mavericks: The Missing Manual

David Pogue
Mac OS X Hacks

Mac OS X Hacks

Kevin Hemenway, Rael Dornfest

Publisher Resources

ISBN: 0596009135Catalog PageErrata