lp (Unix)

From Wikipedia, the free encyclopedia
Jump to: navigation, search

The lp system was the print system provided by the UNIX System V family of operating systems. It was similar in functionality to the Berkeley Software Distribution-based lpr system, and has been supplanted by the LPRng and CUPS systems. lp was also the name of the command used to move documents into the print spool, or queue. Like similarly-named commands on ITS, DEC, CP/M, and 86-DOS, it was originally an acronym for terms like line print(er) and local print(er). However, the commands stopped being specific to particular devices in the 1980s, and today are used with any printer compatible with the operating system itself.


In the Unix programming model, devices such as printers are represented as just another file in the filesystem. For example, the first line printer on a system might be represented by a file "lp1" in the device ("dev") directory, i.e. /dev/lp1. Using the file metaphor, a document could by printed by "copying" the file onto the device: cp document /dev/lp1. While this worked well enough for the case where there was one printer per user, this model did not scale out well to multiple users having to share one printer.[1] The solution was to create a queue (or spool) of documents to be printed and allow a system daemon to print the documents in the order in which they arrived.


The lp system was first introduced in 1973 in Version 4 of Unix.[2] By the release of System V Release 4, the suite of utilities had grown to include commands for canceling print jobs, moving jobs among queues, enabling and disabling queues, enabling and disabling a job scheduler daemon and status reports of the print system.[3] The lp command handled queue documents to be printed[3] and had over 20 different options that controlled the appearance of the document, it's place in the queue,[4] and even handled email notification of the user once the document had finished printing.[2] The command returned a "job id" which could be used by the cancel or lpstat commands to remove the job from the queue or check on its progress, respectively.[5] While the system was considered to be quite complex to set up and administer, most uses were expected to only use these three commands.[4]


In his introduction to a simplified configuration system for lp, author Peter Gray of the University of Wollongong described several weaknesses of the version shipping with the then-current Solaris (operating system) version 2.

  • As opposed to the single daemon used by the simpler BSD lpr system, the lp system used separate daemons, one for scheduling and one for remote communication.
  • The lpr system could be controlled with a single configuration file while lp requires a separate program for administration.
  • The lp system did support permissions, but the model did not scale to hundreds of users.

As a result, Gray observed that "many administrators choose to simply run the old lpr/lpd system on the SVR4 boxes."[6]


With its distribution in the influential AT&T Unix, the interface if not the implementation became the standard for users' control over printers. The lp command was included as a requirement in the POSIX.2 standard,[7] and a command by that name appeared in the subsequent lpr, LPRng and CUPS printing systems. (In SV4R derivates like SCO UNIX, the lp command was simply an alias for the lpr command used by the BSD-based lpr system.[8])

As late as 1996, Running Linux stated "The Linux printing software consists of the UNIX standard lp and lpr software,"[9] but by 1999 support for lp was waning and the third edition simply stated "The lpr command prints a document on Linux." [10] By 2003, a survey of the Debian, Mandrake, Red Hat, Slackware and SuSE distributions showed that all of them were running some combination of lpr, LPRng and CUPS.[11]


  1. ^ Kofler, Michael (1997). "6.4 Printer Configuration". Linux: Installation, configuration and use. Addison-Wesley. pp. 146–150. ISBN 0-201-17809-5. 
  2. ^ a b Arthur, Lowell Jay (1986). Unix Shell Programming. John Wiley & Sons. p. 190. ISBN 0-471-84932-4. 
  3. ^ a b Nemeth, Evi; Snyder, Garth; Seebass, Scott (1989). "Printing Under ATT". UNIX System Administration Handbook (1st ed.). Prentice Hall. pp. 164–173. ISBN 0-13-933441-6. 
  4. ^ a b Rosen, Kenneth H.; Rosinski, Richard R.; Farber, James M. (1990). UNIX System V Release 4: An Introduction for New and Experienced Users. Osborne McGraw-Hill. pp. 117–121. ISBN 0-07-881552-5. 
  5. ^ Sobell, Mark G. (1985). A Practical Guide to UNIX System V. Benjamin/Cummings. pp. 45–46. ISBN 0-8053-8915-6. 
  6. ^ Gray, Peter (August 1997). "Simplified LP configuration". AUUGN: The Journal of AUUG (Australian Unix systems User Group) 18 (3): 9–11. 
  7. ^ Gardner, James (1994). Learning Unix (2nd ed.). SAMS. p. 144. ISBN 0-672-30457-0. 
  8. ^ Cutler, Ellie (1994). SCO UNIX in a Nutshell. O'Reilly. pp. 75–76. ISBN 1-56592-037-6. 
  9. ^ Welsh, Matt; Kaufman, Lar (1995). Running Linux (1st ed.). O'Reilly. p. 33. ISBN 1-56592-100-3. 
  10. ^ Welsh, Matt; Dalheimer, Kalle; Kaufman, Lar (1999). Running Linux (3rd ed.). O'Reilly. pp. 323–330. ISBN 1-56592-469-X. 
  11. ^ Smith, Roderick W. (2003). "Managing Printers". Linux Power Tools. SYBEX. pp. 269–284. ISBN 0-7821-4226-5. 

External Links[edit]

Selected documentation from various operating systems.