unix

 


 

Within the School

Printing a File

The most common way of printing a file is to use lpr with the appropriate options. To print the file filename.ps in the current directory to the printer s0d, use:

help@london[1]: lpr -Ps0d filename.ps 

Your default printer should be set by our script find_printer, the default printer setting is held in the variable $PRINTER or $LPDEST. You can determine your default printer by typing the following:

help@london[2]: echo $PRINTER s0d 

Your default printer should be displayed. Using your default printer, the above command would be:

help@london[3]: lpr filename.ps 
Printing a DVI file help@london[3]: dvips -Ps0d filename.dvi  

 

Viewing the Print Queue

The print queue is the list of print requests that are currently waiting to be printed on a printer. To view the queue, use the command lpq. To view the queue on printer s0d, use the following:

help@london[4]: lpq -Ps0d 
Printer: s0d@localhost 'simonyi-0-duplex'  
Queue: 2 printable jobs  
Server: pid 15753 active  
Unspooler: pid 15754 active  
Status: waiting for subserver to exit at 13:41:35.420  
Filter_status: 87 percent done at 13:41:00.303  
Rank   Owner/ID                  Class Job Files                 Size Time 
stalled(676sec) guest@zurich+50     A    50 AHLMcT.pdf          288091
13:30:23 2      help@localhost+151           A   151 filename.ps               5596 13:41:35 

To view the queue on your default printer, use:

help@london[5]: lpq 
Printer: s0d@localhost 'simonyi-0-duplex'  
Queue: 2 printable jobs  
Server: pid 15753 active  
Unspooler: pid 15754 active  
Status: waiting for subserver to exit at 13:41:35.420  
Filter_status: getting end using 'pjl job/eoj' at 13:42:31.647  
Rank   Owner/ID                  Class Job Files                 Size Time 
stalled(799sec) guest@zurich+50     A    50 AHLMcT.pdf          288091
13:30:23 2      help@localhost+151           A   151 filename.ps               5596 13:41:35 

 

Removing a Job

Now, if we want to remove our job, we need the job id. Looking at the above output we see that the job number is 151. We can now remove that job with lprm:

help@london[6]: lprm 151  
Printer s0d@localhost:   checking perms 'help@localhost+151'   
dequeued 'help@localhost+151' 

The job is now removed from the print queue. If we wanted to remove all our jobs from the printer s0d, we could have used:

help@london[6]: lprm -Ps0d 

 

Printing from Applications

Most applications print by sending postscript to lpr, applications that function this way, usually have a Print Command: dialog or Printer Command:. This dialog will appear after selecting Print... from the File menu usually. The default command in this window is usually fine, however, should you experience difficulty printing, we suggest changing this to the following (assuming you wish to use printer s0d, change the name of the printer to whichever printer you wish to use):

Printer Command: lpr -Ps0d 

 

UNIX printing

To print directly to the printer from the command line without installing the printer on your device:

$ lpr -H printhost.math.ias.edu:631 -P<printer> file.txt

where <printer> is the printer that you want to print to.  Click here for a list of printers

 

The method of adding a printer will vary depending on your distribution.  The following example will be for reference only.

 

  • Server — printhost.math.ias.edu:631

  • Path — /printers/s0d (Refer to Printer Naming Conventions for the name of your desired print queue)

If you need to download and install drivers, click on the appropriate link:

For HP printers, you will need HPLIP.  If it is not installed on your system, you can install it with:

$ sudo yum install hplip ( for RedHat-based machines)

$ sudo apt-get install hplip ( for Debian-based machines)

Most modern UNIX's have fairly intelligent printing commands. You will probably not have to do any configuration to print to our print server. To print from your laptop, you will need to provide both a queue name and a print server name for lpr. To print the file filename.ps to the printer s0d you would type the following:

help@mymachine[1]: lpr -Ps0d@printhost filename.ps 

or

help@mymachine[2]: lpr -Ps0d@printhost.math.ias.edu filename.ps 

Typing this every time might become troublesome, so we should probably make s0d@printhost our default printer by setting the environment variable PRINTER. First check your SHELL setting with the following:

help@mymachine[3]: echo $SHELL /bin/csh 

Our shell is csh (or tcsh), we'll set the PRINTER variable with the following:

help@mymachine[4]: setenv PRINTER s0d@printhost.math.ias.edu  

We can now print to s0d@printhost.math.ias.edu by typing lpr. Now lets assume that we are using bash (or sh), we can set our PRINTER variable with slightly different syntax:

help@mymachine[5]: echo $SHELL /bin/bash help@mymachine[6]: PRINTER=s0d@printhost.math.ias.edu  help@mymachine[7]: export PRINTER 

or

help@mymachine[8]: export PRINTER=s0d@printhost.math.ias.edu 

 

PPDS

AttachmentSize
Binary Data f3d.ppd73.93 KB
Binary Data Dell 5330DN PPD73.9 KB
Binary Data Dell MFP 2335DN PPD53.98 KB
Binary Data Dell 2330DN PPD87.02 KB