Can I Print Linux Files?
The lpr command makes a copy of your file and stuffs it in the system's print queue (a process called spooling), so you can change or delete the original file without harming your printout.
The lpr command will accept two optional flags:
-r Delete the file after printing.
-s No spooling (don't make a temporary copy for printing).
The -r flag tells the system to delete the file after printing, and -s tells the system to print directly from the original file instead of spooling to the print queue. Of course, if you specify the -s flag, you can't modify or delete the original file while it's printing, but this option can save a bit of time (since no copy is made) when the original file is big.
Here are some examples using the -r and -s flags:
lpr -r humongous Delete the file humongous after printing.
lpr -s humongous Print the file humongous without spooling.
lpr -r -s humongous Print the file humongous without spooling and t hen delete it.
Customizing Your Printouts
The lpr command is a no-frills way to print your files. It doesn't do any fancy formatting; it just dumps your file on the printer. If you'd like to format your printout (paginate, add a title, set margins, or control the page length), you can use the pr command in conjunction with lpr. By default, pr will add page numbers and a title consisting of the file's name and the date and time it was last modified. But you can do lots of other fancy formatting as well. Here are some of the options that pr supports:
-d Double-space the printout.
-h <my title> Specify a title for the page header (the default is the file name).
-Ln Set the page length to n lines (the default is 66).
-On Set the margin to n characters (the default is 8).
-T Suppress the page header.
-2 | -3 | -4 Print output in two, three, or four columns (as in a newspaper).
Typically, the output from pr is sent only to your printer (by piping the output to lpr, as shown in the following examples), but if you leave off the lpr step, you'll see the output on the screen instead. Here are some examples using the pr command to print a file named panda97.txt--for example, with no options specified, just adding page numbers and the default title (file name and date):
pr panda97.txt | lpr
Here we've specified a more meaningful title for the printout:
pr -h "Financial Report" panda97.dat | lpr
And now we've set the page length to 55 lines, set the margin to 5 spaces, and added double-spacing:
pr -h "Financial Report" -l55 -o5 -d panda97.dat | lpr
Stop the Presses!
If you send a file to the printer by mistake, you might be able to snatch it from the print queue before it's too late. First use lpq to find the job number:
lpq
Rank Owner Job Files Total Size
1st hermie 17 really-humongous 2317678 bytes
In the example shown here, the job number is 17. Once you know the job number, enlist the assistance of lprm to remove that file from the queue as follows (using job 17 as an example):
lprm 17
Previous Lesson: Spell Checking
Next Lesson: Joining Files
Comments - most recent first
(Please feel free to answer questions posted by others!)
I'm having a printer sharing issue with open suse 12.1.
Printer connected to suse 11.3 desktop and I want to share that printer to suse 12.1 desktop.
Anyone know how to do it,
Ajith
please help me anybody, i have install Canon LBP-2900 laser jet printer on zorin-os-4-core-32 (Ubuntu), it's installed successfully, but when i give print it's not printing & showing processing, but not printing, when i restart the printer it's showing job complied, but not printing
linux/ubuntu/lucid - is it possible to install a printer driver that sends all print output to a text file?, if yes, how?
thanks in advance
You may don't have 'cups' software on your linux system. If you already installed 'cups' you should reach that.
Try to contact me if you still want help.
johnny_white007@yahoo.com
While I am giving lpr command it gives replay like "command not found" , I am working on linux 2.6.2. can you help me?
Regards
MD
I welcome your comments. However... I am puzzled by many people who say "Please send me the Linux tutorial." This website *is* your Linux Tutorial! Read everything here, learn all you can, ask questions if you like. But
don't ask me to send what you already have. :-) NO SPAM! If you post garbage, it will be deleted, and you will be banned.
Copyright © by -
All rights reserved - Redistribution is allowed only with permission.

