Home > Articles > Operating Systems, Server

  • Print
  • + Share This

Printing from UNIX

Two commands used at the FreeBSD command prompt are intended as general-purpose print commands: lp and lpr.


The lp command is simply a front-end command that calls the lpr command with appropriate options. Its main use is to allow the running of precompiled binary programs and scripts that assume that the lp command is the official printing command.


The lpr command is the main command used to print files from the command prompts under the FreeBSD operating system. It is frequently spawned off as a child program or used in pipes. For example, when the Netscape Web browser's Print button is clicked, Netscape may create the PostScript output, but the output goes through the lpr command.

The lpr command, like many UNIX command-line printing programs, assumes that the default print queue name is lp. When the FreeBSD machine is set up, the administrator usually sets the lp queue to print through a filter that allows raw UNIX text sent to it to print properly. For example, if an HP LaserJet printer that doesn't have PostScript is connected to the server, the lp queue specifies in the /etc/printcap file the crlf filter listed earlier. On the other hand, if an Apple Laserwriter that doesn't support ASCII is connected to the server, the a2ps filter would be specified in the /etc/printcap for the lp queue.

When printing raw text files, usually the -p option is specified to lpr. When printing preformatted files, such as PostScript files, the -P option is used, which selects whatever queue is used to handle these job types.


  • + Share This
  • 🔖 Save To Your Account

Related Resources

There are currently no related titles. Please check back later.