FAQ: Printing in the Math Department Using UNIX

What is a print job?
What is a print queue?
What types of files and/or program data can I send to the printers?
What are the available print queues named?
What is the default print queue?
How do I print a file?
How do I cancel a print job?
How do I know to which printer my printouts will go?
What commands should I know?
Can I use lpr, lprm, and lpq?
Can I see some "real world" examples of printing commands in action?
 

What is a print job?

When something (a file, program output, etc.) is sent to a print queue in order to be printed, it is called a print job.

What is a print queue?

Before they are printed, print jobs wait in print queues. There is a print queue for every printer in the department, and each one of them has a name. As of this writing, these are the available print queues:
Queue Name Printer Type Location Comment
ewg329 HP LaserJet 4000N Ewing 329 Monochrome laser printer; uses the PCL and PostScript printer languages
ewg433 HP LaserJet 4100N Ewing 433 Monochrome laser printer; uses the PCL and PostScript printer languages
ewg433dup HP LaserJet 4100N Ewing 433 Monochrome laser printer with double-sided printing on; uses the PCL and PostScript printer languages
ewg433c HP DeskJet 1600CM Ewing 433 Color inkjet printer; uses the PCL and PostScript printer languages
ewg517 HP LaserJet 4100N Ewing 517 Monochrome laser printer; uses the PCL and PostScript printer languages
ewg517dup HP LaserJet 4100N Ewing 517 Monochrome laser printer with double-sided printing on; uses the PCL and PostScript printer languages
ewg517c HP Color LaserJet 3700N Ewing 517 Color laser printer; uses the PCL and PostScript printer languages; PLEASE USE SPARINGLY!
ewg517cdup HP Color LaserJet 3700N Ewing 517 Color laser printer with double-sided printing on; uses PostScript printer language; PLEASE USE SPARINGLY!
ewg537 HP LaserJet 4050N Ewing 537 Monochrome laser printer; uses the PCL and PostScript printer languages
ewg537dup HP LaserJet 4050N Ewing 537 Monochrome laser printer with double-sided printing on; uses the PCL and PostScript printer languages

Some of the queues listed above may not be on the particular workstation into which you are logged. Each workstation also has a print queue that all print jobs go to if no queue is specified. This queue is called the default queue. See the command, lpstat, to see how you can find out what queues are available on the workstation as well as what the default queue is.

What types of files and/or program data can I send to the printers?

PostScript is the page description language that our printers understand. You can send plain text, PCL or PostScript files or program output to them. Anything else, like raw Matlab plot files, Maple files, etc. will come out a garbled mess. Most software will produce output that printers will understand, but if you are submitting files to the printers with commands like lp, please be sure that it is in the correct format beforehand.

What are the available print queues named?

Here's a list of available print queues and what they are called.

What is the default print queue?

Every UNIX computer in the department is setup so that if a person does not specify where a print job should be sent, it will go to the default print queue. You can use the lpstat command to find out what the default print queue is for the computer into which you are logged.

How do I print a file?

There are essentially two ways: the GUI (graphical user interface) way or the command line way.

Command-Line Way:

The lp command is used to send output to a print queue.

GUI Way:

In many respects, it is easier to print files using the GUI. There are a couple ways to print a file using the tools available in the GUI.

Method #1: File Manager

The File Manager is used ease the job of organizing your files. Find the file that you desire to print. Use the right mouse button to click on the icon for the file. A menu will pop up, and one of the options in it is "Print...". Choose that option. A print dialog box will appear that will allow you to specify the print queue and the number of copies that you want to print.

Method #2: Drag and Drop

This method requires that the Front Panel and the File Manager be visible on the screen at the same time. If the Front Panel is covered up, then resize or minimize other windows until they are both unobstructed. In the File Manager, find the file that you desire to print. With the left mouse button click on file's icon and hold the mouse button down. While holding the mouse button down, move the mouse so that the file's icon is over the Default Printer Icon on the Front Panel. Let go of the mouse button while the icon is still over the Default Printer Icon.

How do I cancel a print job?

To cancel an already-submitted print job, one first needs to know the print job's print job ID. The lpstat command is used to find out print job IDs. See the lpstat command in the Other Important Commands section below to find out how to use it.


To cancel a print job, one would issue the cancel command followed by the print job ID, like so: "cancel ewg433-10".

One is only allowed to cancel his or her own print jobs. This is important in situations where someone else's print job is holding up the print queue because it is large or too complex for the printer. If this happens, the best policy is to contact the person who owns the job so that they can cancel it. Otherwise, the system administrator can cancel anyone's print jobs. It is best to try to get the print job owner to cancel his or her job first before contacting the system administrator.

How do I know to which printer my printouts will go?

Well, there are essentially two cases. You either tell the lp command where to send the print job, or you let lp send it to the default print queue.

What commands should I know?

The commands that are most commonly used are:  lp, cancel, and lpstat.  Each of these commands is summarized below.

lp

The lp command is used to send output to a print queue for printing. The following table lists commonly-used forms of the lp command. The parts that are in square brackets are optional.
Form Description Examples
<UNIX command> | lp [-d <queue name>] With this form of the command, the output of a UNIX command is piped (a UNIX facility designated by the '|' character) into the input of the lp command. The '-d <queue name>' option designates a print queue for printing.
    ls -al | lp 

    ls -al | lp -d ewg433

lp [-d <queue name>] <file name> Sends the designated file to the default print queue. The '-d <queue name>' option designates a print queue for printing.
    lp file.ps 

    lp -d ewg433 file.ps

cancel

The cancel command is used to remove print jobs from a print queue.  You are only allowed to cancel your own print jobs.

lpstat

The lpstat command is used to gather information about print queues and print jobs. The lpstat command uses the following options to indicate what information is desired:
Option Description Examples
(none) If no option is given, lpstat displays the print jobs for the current user in all print queues lpstat
-d lpstat displays the name of the default print queue for the computer on which the command is run. Each computer has a separate default print queue. lpstat -d
-o [queue] lpstat displays the current print jobs. If a queue name is specified, only print jobs in that queue are displayed.
lpstat -o 
lpstat -o ewg433 
-p [ queue | "all" ] lpstat displays the print queues and their current status. If a queue name is specified, only the status of that queue is displayed. If no queue name is specified or the word "all" is specified, all the queues are listed.
lpstat -p 
lpstat -p all 
lpstat -p ewg433 
-u [user name(s)] lpstat displays the print jobs for the specified user(s). If more than one user name is listed in a quoted string (eg. "user1 user2 user3"), then the print jobs for all of the listed users are displayed. If no user is specified, then all print jobs for all users are displayed (synonym for "lpstat -o").
lpstat -u schwenk 
lpstat -u "schwenk jdoe" 
lpstat -u 

Can I use lpr, lprm, and lpq?

Yes, these commands are still available, and they work, but they are not as flexible at the newer commands. The following commands may be familiar to those who have used the older version of Sun Microsystem's UNIX, SunOS 4.1.x. They are considered to be obsolete, but they still work. There may be some situations where they don't work as well as the "standard" printing commands listed in the previous sections. Their use is discouraged.
Old Command Function New Command Equivalent
lpr Print files lp
lpq Show the print jobs in the queues lpstat
lprm Remove print jobs from a queue or queues cancel

Can I see some "real world" examples of printing commands in action?

The following is a session captured where many of the commands listed above are used.
 
[9:42:50]schwenk@sisyphus:~> lpstat -d
system default destination: ewg433
[9:42:55]schwenk@sisyphus:~> lpstat -p
printer ewg517 is idle. enabled since May 06 09:42 1999. available.
printer ewg517c is idle. enabled since May 06 09:43 1999. available.
printer ewg329 is idle. enabled since May 06 09:43 1999. available.
printer ewg433c is idle. enabled since May 06 09:43 1999. available.
printer ewg537 is idle. enabled since May 06 09:43 1999. available.
printer ewg433 is idle. enabled since May 06 09:43 1999. available.
printer ewg517cdup is idle. enabled since May 06 09:43 1999. available.
printer ewg433dup is idle. enabled since May 06 09:43 1999. available.
printer ewg537dup is idle. enabled since May 06 09:43 1999. available.
[9:43:01]schwenk@sisyphus:~> lpstat -o
[9:43:07]schwenk@sisyphus:~> lp PriceList.ps
request id is ewg433-242 (1 file)
[9:43:22]schwenk@sisyphus:~> lpstat -o
ewg433-242             sisyphus.math.udel.edu!schwenk 14095408   May 06 09:43
[9:43:35]schwenk@sisyphus:~> cancel ewg433-242
ewg433-242: canceled
[9:43:42]schwenk@sisyphus:~> lpstat -o
[9:43:47]schwenk@sisyphus:~> lp -d ewg329 PriceList.ps
request id is ewg329-243 (1 file)
[9:44:09]schwenk@sisyphus:~> lpstat -o
ewg329-243             sisyphus.math.udel.edu!schwenk 14095408   May 06 09:44
[9:44:15]schwenk@sisyphus:~> cancel ewg329-243
ewg329-243: canceled
[9:44:23]schwenk@sisyphus:~> lpstat -p ewg329
printer ewg329 is idle. enabled since May 06 09:44 1999. available.
[9:44:58]schwenk@sisyphus:~> lpstat -o ewg329
[9:45:06]schwenk@sisyphus:~> lp PriceList.ps
request id is ewg433-244 (1 file)
[9:46:10]schwenk@sisyphus:~> lpstat -o ewg433
ewg433-244             sisyphus.math.udel.edu!schwenk 14095408   May 06 09:46
[9:46:16]schwenk@sisyphus:~> lpstat -o ewg329
[9:46:21]schwenk@sisyphus:~> lpstat -u schwenk
ewg433-244             sisyphus.math.udel.edu!schwenk 14095408   May 06 09:46
[9:46:30]schwenk@sisyphus:~> lpstat -u rakesh
[9:46:39]schwenk@sisyphus:~> cancel ewg433-244
friday.math.udel.edu: ewg433-244 dequeued