SCO Unix/System V Printing FAQ
Much of the printer information here makes references to
"interface scripts". Some people call them "printer drivers" (they
aren't). These scripts are what controls what happens to your print
job as it goes to the printer.
Linux systems now commonly use CUPS, which has a much more powerful
printing system. However, if you are only sending text, you can use
interface scripts - see Using System V interface scripts with CUPS printing
Understand that Unix printing is very different than Windows
printing. Windows apps are very dumb about printing, and depend
upon the printing system to know all about the nitty gritty
details. Unix printing takes the opposite approach: the printing
system knows nothing about printers at all. Your only chance
outside of the application itself to affect what happens is in the
The scripts are found in /usr/spool/lp/admins/lp/interfaces (or
/var/spool/lp/admins/lp/interfaces on modern systems, though the
"old" path will still work). You will find that each of the
printers listed by lpstat will have a script here, and the names
will be the same as the name of the printers.
Note that if you are using HP JetDirect printers, the script
will be there, but the actual script you want to modify is in the
To make changes to interface scripts permanent, you want to make
the same changes in the model script that was used to create the
printer. The model scripts are usually in /usr/spool/lp/model, but
it's possible for a printer to get its script from anywhere, so
it's best to check. You can look in
/usr/spool/lp/admins/lp/printers where you will find a
sub-directory for each printer you have. Within that sub-directory
is the file "configuration", and you can "cat configuration" to see
where the script originated.
If you want your script changes to survive upgrades, copy them
to a new name in /usr/spool/lp/model, and change the configuration
file to reflect this, either by setting the model in the Printer
Manager or by directly editing
The scripts get called by lpsched when the printer is ready to
accept data (your lp command just created files in
/usr/spool/lp/temp; see How can I get the file from the
print spooler before it prints? ). The script gets passed the
print job number, the user who submitted the job, a title (seldom
used- it's the "-t" option to lp) , the number of copies, any
options, and finally all the files to be printed. This means that
the interface will always see at least 6 arguments. The lpsched
programs sets stdout to point to the device the printer uses, so
the interface script doesn't have to deal with that at all. A
simplistic script could just do this:
shift; shift; shift; shift; shift
# throw away everything but the file names
Most scripts offer more features than that, of course.
A related feature is print filters. These allow the use of a -T option to specify an input type ("ps" for Postscript, for example). A filter you specify (see previous link for details) runs when its type is passed.
Of course you could do any of that with a more complex interface script that processed options, but using filters separates your scripts and allows their reuse with other printers.
Got something to add? Send me email.
Increase ad revenue 50-250% with Ezoic
More Articles by Tony Lawrence
Find me on Google+
© 2013-07-18 Tony Lawrence