Printing in Linux

Printing in Linux: A Starting Guide

This guide provides an explanation to printing in linux and instructions on how to get started.

Contained on this page:

  • A basic understanding of Printing Principals in Linux
  • Instructions on how to configure your .bashrc
  • Instructions on how to print 'Office Documents' (.doc, .ppt, ...)
  • 'Failsafe' methods for printing
  • WWW Printing Links
  • Contact Information

All of the contained information is to help you get started in printing in linux. Because it is very general it might not be applicable or beneficial to your specific printing needs. Consult online documentation pertaining to specific programs or contact your TA. They can help.

Linux Printing

What happens when you print...

Programs (i.e. Mozilla, Openoffice...) use the same printing command that a user types when he or she wants to print from a Linux prompt, like the one in the xterm window. The program makes a PostScript file of what the user wants printed and sends it to the lpr command, the linux terminal command for printing. lpr takes the given PostScript file and sends it to the user specified printer (which is important). Later on in the 'Failsafe' section this will need to be understood.

Configuring Your .bashrc*

Your .bashrc file contains all sorts of user settings. This file may not exist; if it does not you can create it with the command "touch .bashrc" . Right now we will add a line that will define our default printer. Look around the lab that you frequent for the printer that you want to use. All of our printers are labeled. For now we will use ry402-2.

  1. Open an xterm and type: pico .bashrc
  2. Below the export PATH= line add export PRINTER=ry402-2
  3. Ctrl-X and type 'Y' to save changes.
  4. Log out and log back in.

To test to see if your changes took place type from the prompt in xterm: echo $PRINTER. It should display the name of the printer that you will use.

Now that we have the correct default printer, most programs that are supplied on the CS-Linux machines should be able to print on your default printer. Open any program and try to use the program to print. Most of them should work.

* Note: Do not make changes to your .bashrc that you don't understand. Read the comments in the .bashrc file to learn more

Printing Office Documents (.doc, .ppt, .xls,...)

The standard office program suite on all of the CS-Linux machines is OpenOffice. This program allows users to create and edit Microsoft Office files. To access it open an xterm and type: openoffice.

Now printing in OpenOffice...

  1. Start OpenOffice
  2. Open the file
  3. Select from the toolbar: File-Print
  4. Click Ok (even though it says Generic Printer it prints to your specified default printer)
  5. Don't forget to pick up document from the printer

Simple isn't it? That is because it uses the linux lpr command in conjunction with your PRINTER environment variable.

'Failsafe' Printing

Note: This will not always work, but try it before you declare failure and start looking for another printing solution.

The 'Failsafe' method uses the process of printing that the programs use but instead of the computer doing all of the work the user will. Remember that the printer prints standard output text or PostScript files that it can read.

  1. From any program find the File-Print equivalent command. (In most web browsers this is the command)
  2. Find the Printer Properties
  3. If the command for printing is other than lpr change it to lpr and try printing.
  4. If 3 fails, return to the Printer Properties and find an option to print to file. This converts what it is that you are printing to a file that the printer can read
  5. If there is an option in 'Print to File' for PostScript type select Type 1.
  6. Save the document in your home directory
  7. In xterm, from your home directory, type lpr -P ry402-2 'filename'.ps
  8. Again, in xterm, type lpq to monitor the success or failure of your attempt.

If this works, then congratulations! You can probably print anything that you need from the CS-Linux machines.

If it failed contact Techstaff and we will try to help solve your printing strife.

In Conclusion...

Hopefully by now you are able to successfully print, or you at least know who to contact if you have troubles. Remember Techstaff is here to help.

World Wide Web Linux Printing Links

LinuxPlanet -Tutorials: A Guide to Linux Printing Note: In-depth explaination and information about printing in Linux

Contact Information