Linux Commands: off line print - sends a print job to the default system queue


lpr-Linux Command

lpr command- off line print - sends a print job to the default system queue

Syntax:

Description: By far, the most simplistic way to print in the Linux operating system is to send the file to be printed directly to the printing device. One way to do this is to use the cat command. As the root user, one could do something like
# cat thesis.txt > /dev/lp
In this case, /dev/lp is a symbolic link to the actual printing device---be it a dot-matrix, laser printer, typesetter, or plotter. (See ln(1) for more information on symbolic links.)
For the purpose of security, only the root user and users in the same group as the print daemon are able to write directly to the printer. This is why commands such as lpr, lprm, and lpq have to be used to access the printer.
Because of this, users have to use lpr to print a file. The lpr command takes care of all the initial work needed to print the file, and then it hands control over to another program, lpd, the line printing daemon. The line printing daemon then tells the printer how to print the file.
When lpr is executed, it first copies the specified file to a certain directory (the spool directory) where the file remains until lpd prints it. Once lpd is told that there is a file to print, it will spawn a copy of itself (what we programmers call forking). This copy will print our file while the original copy waits for more requests. This allows for multiple jobs to be queued at once.
The syntax of lpr(1) is a very familiar one,
$ lpr [ options ] [ filename ... ]
If filename is not specified, lpr expects input to come from standard input (usually the keyboard, or another program's output). This enables the user to redirect a command's output to the print spooler. As such,
$ cat thesis.txt | lpr
or,
$ pr -l60 thesis.txt | lpr
The lpr command accepts several command-line arguments that allow a user to control how it works. Some of the most widely used arguments are: -Pprinter specifies the printer to use, -h suppresses printing of the burst page, -s creates a symbolic link instead of copying the file to the spool directory (useful for large files), and -#num specifies the number of copies to print. An example interaction with lpr might be something like
$ lpr -#2 -sP dj thesis.txt
This command will create a symbolic link to the file thesis.txt in the spool directory for the printer named dj, where it would be processed by lpd. It would then print a second copy of thesis.txt.
For a listing of all the options that lpr will recognize, see lpr(1).
Example:

Related: banner, cancel, lpc, lprint, lpd(8), lprintq/lpq(1), lprm, pr(1), printcap(5), symlink

Other Linux Commands:
alias , break , builtin , cal , case , cat , cd , cfdisk , chgrp , chmod , chown , chroot , cksum , cmp , comm , continue , cp , cron , crontab , csplit , cut , date , dc , dd , declare , df , diff , diff3 , dir , dircolors , dirname , dirs , du , echo , egrep , enable , env , eval , exec , expand , export , expr , factor , false , fdformat , fdisk , fgrep , find , fmt , fold , for , fsck , function , getopts , hash , hashcharacter , head , history , hostname , id , if , import , install , join , kill , less , let , ln , local , locate , logname , logout , lpc , lpr , lprm , ls , m4 , man , mbadblocks , mkdir , mkfifo , mknod , more , mount , mtools , mv , nice , nl , nohup , passwd , paste , period , popd , pr , printf , ps , pushd , pwd , quota , quotacheck , quotactl , ram , rcp , read , readonly , return , rm , rmdir , rsync , Run , sdiff , sed , select , seq , set , shift , shopt , shutdown , sleep , sort , split , su , sum , symlink , sync , tac , tail , tar , tee , Test , time , times , top , touch , tr , traceroute , true , tsort , tty , Type , ulimit , umask , uname , Unexpand , uniq , units , unset , unshar , until , useradd , usermod , users , uuencode , watch , wc , whereis , which , while , who , xargs , yes ,
Live2Support.com :
Product - Benefits - Features - How Does it Works - Pricing - SSL Certificates - Signup - Contactus - Login - Submit Resources