How to Print from a Linux

If you use the Linux operating system on your computer or mobile device, you might be wondering how to print out a file or image. You'll have to use different commands to print different types of documents from a Linux operating system.

To print a postscript or text file, use the lpr command:

Keep Reading Below

Type % lpr . This will print your file to whatever printer is set as the default.

Select a different printer by typing -P followed by the name of the printer. The space should be entered as follows, without any spaces in between the different parts of the command: % lpr -P .

Don't use these commands to print non-postscript or non-text files [source: Penn Engineering]! Instead, use one of the commands listed below.

To print an html file, you'll need to use an html interpreter program.

Open the page you want to print within your html interpreter program.

Select Print from the File dropdown menu. A dialogue box will open.

Click OK if you wish to print to the default printer.

Enter the lpr command as above if you wish to select a different printer. Then click OK [source: Penn Engineering].

To print an image, follow the directions for printing an html file but open your file in an imaging program.

If you wish to remove a print job from the print queue, use the lprm command, as follows.

Type lpq -P and view the queue of print jobs.

Verify the name of the print job you wish to remove, and type lprm -P. You can remove all print jobs from the queue by using a dash instead of a job number. Type lprm -P - [source: Soyinka].

Make sure you type all characters (letters, hyphens and spaces) exactly as listed above.