The commands described in this document are available while using the following systems:

  • SSH logins to crabshell (faculty/staff)

You may encounter other Linux/Unix systems on the Camden campus, in research labs, offices or other department-specific areas. These commands should work on those machines as well, but your printer options may vary significantly.

Default Printer and Available Printers

You can determine your default printer in a particular login window by running the lpq command with no arguments. The output will look something like:

PDF_Printer is ready
no entries

The first line of output shows the name of the printer (PDF_Printer) and its status (ready). The second line of output shows that there are currently no jobs in the queue for the default printer.

If you would like to change your default printer, you can edit the file .cshrc found in your home directory to add the following two lines to the bottom of that file:

setenv PRINTER printer-name

…replacing printer-name with the name of an available printer. Changes made to a .cshrc file don’t normally take effect until your next login. Although you can tell the current shell to reload this file by running the command source .cshrc. You can see a list of available printers on the current system using the lpstat command:

crabshell% lpstat -a
armprn02 accepting requests since Mon 06 Jul 2009 03:37:12 PM EDT
cmbsbpa accepting requests since Fri 27 Aug 2010 11:17:27 AM EDT
cmbsbpb accepting requests since Fri 27 Aug 2010 11:17:27 AM EDT
cmbsbpc accepting requests since Fri 27 Aug 2010 11:17:27 AM EDT
cmcccpa accepting requests since Fri 27 Aug 2010 11:17:27 AM EDT
cmcccpb accepting requests since Wed 01 Jul 2009 03:47:59 PM EDT
cmcccpc accepting requests since Wed 01 Jul 2009 03:45:07 PM EDT

Most RUCIT-managed network printers available from Linux/Unix follow a naming convention. The first two letters in the printer name refer to the campus (cm is Camden), the next three letters are the building (bsb is Business & Science Building and ccc is Camden Campus Center), and the last two letters stand for “printer a”, “printer b”, “printer c”, etc. RUCIT does not manage all of the network printers on campus, so not all printers follow this convention. Sometimes a department will request that their printer be made accessible from Linux/Unix, and that printer name will follow some other format.

If you have not specifically set a default printer in your .cshrc file, when you login to crabshell your default printer will be set to a special virtual device named PDF_Printer. If you print to this virtual device, the system will convert your printout to a PDF file and save it to your home directory. This can be useful when you want to print something from your account to a printer in your home or off-campus workplace. The PDF file can be downloaded and printed on any computer with a PDF reader.

Basic Printing Commands

The three commands you’ll use the most when printing are:

  • lpq – show printer queue status
  • lpr – send file to printer
  • lprm – remove print job from queue

The lpq command is used to get the printer queue status. If there are any jobs pending or active in the queue, they can be seen using this command. When used without arguments it returns the queue status for your current (default) printer. If you want to see the queue status for a specific printer, you can do that:

lpq -P printer-name

…replacing printer-name with the name of the printer you’re interested in.

The command to actually print something is lpr. To send a file to your default printer, you just run lpr giving the file name as an arguement:

lpr filename

Most networked printers can accept plaintext or postscript files directly from the command line. To print documents that use special control characters, like PDF, .doc, .docx, .xls, etc. you should print from inside the corresponding application that uses that type of file.

As with the lpq command, you can also specify a printer with lpr:

lpr -P printer-name filename

…replacing printer-name with the name of the printer you want to send your job to, and replacing filename with the name of the file you want to print.

The lprm command is used to remove your print jobs from the queue. Use the command to see what jobs of yours are in the print queue, then use the job number from that listing with the lprm command. You can delete all current jobs in the queue that belong to you:

lprm -U netid

…but you are not permitted to delete jobs that belong to anyone else. The lprm command cannot interact with the print release stations in the public labs. Once a print job has been accepted by the print conservation system, you must go to the release station to delete it.

Advanced Printing Commands

There are several additional commands related to printing that provide additional features:

  • mpage – reads a plaintext or postscript file and reduces the font size to permit printing multiple “pages” on a single sheet of paper.
  • enscript – converts plaintext files to postscript, with some basic controls for changing font type, font size, page headings, and page orientation.
  • lprdvi – print dvi2ps file.
  • dvips – print dvi files.
  • dvired – print dvi files with two “pages” per sheet of paper.

You can access any available system documentation using the man command:

man dvired

Printing from Applications

Applications typically use the lpr command internally to communicate with the printer. Sometimes the application will use your default printer as specified in your .cshrc file, but not always. Consult the built-in help or printer options of the application itself to see if it overrides your default system printer with a default application printer.