lp - send files to a printer


lp [-bc] [-d dest] [-n copies] [file...]


The lp(1) utility sends files to a system printer, identified by -d dest.

The options are as follows:

Binary file; do not convert line-endings to Windows text format.
Copy the files so the user can modify or delete file without affecting the operation.
-d dest
Names the output device to which the files will be written. The destination is specified in a modified Universal Naming Convention (UNC) format: //SYSTEM/printer. For example, the printer Scrivener on the system Bartleby would be specified:

This option takes precedence over any destination specified in the LPDEST or PRINTER environment variables.

Specifies the number of copies of the files to be written.

The lp(1) utility expects that the files are appropriate for the printer; that is, a printer expecting PostScript receives PostScript files, a printer expecting text files receives text. Use the -b option for raw binary files (such as sending PCL files to an HP-compatible printer).


The lp(1) utility exits 0 on success, and >0 if an error occurs.


The lp(1) utility makes use of the following environment variables:

A default printer queue (in UNC format), which takes precedence over the one specified in PRINTER.
The location of the Windows utility print.exe. If this variable is set, lp(1) uses this value to run print.exe; if it is not set, lp(1) looks for the file %SYSTEMDIR%/system32/print.exe, checking for different cases. (The %SYSTEMDIR% is the directory in which Windows is installed.)
The default printer queue (in UNC format). This queue is used unless LPDEST is set or the -d option is used.


The lp(1) command is a wrapper for the Windows Win32 print.exe command.

For a TCP/IP connected printer, some users have found that the printer requires a share name before it can be used with print.exe.