Home > Unix > UNIX – Lesson 023 – Printers and printer spooler – lp, lpstat and cancel commands

UNIX – Lesson 023 – Printers and printer spooler – lp, lpstat and cancel commands


Printers and printer spooler
In this lesson we will speal about the most used command to use to print/check/cancel a submitted print.

==================================================================================
lp

The “lp” (line printer spooler) command is used to submits print requests to a destination, assigning a unique ID number.
Syntax :
lp [-d printer] [-options] filename …

Key argument :

  • -d Prints file on a specific destination.
  • -n # Prints a specific number of copies of file.
  • -q # Assigns a priority in the print queue. Specify priority-level as an integer between from 0 and 39. Use 0 to indicate the highest priority.

Example :
$ lp report # print to default printer
Request id is IT-HP405-114 (1 file)

$ lp –n2 memo1 memo2 # print two copies for every files
Request id is IT-HP405-115 (2 files)

$ ls –l | lp –d IT-HP405 # print from standard input
Request id is IT-HP405-116 (std. input)

==================================================================================
lpstat
The “lpstat” command displays information about the current status of the LP print service
Syntax :
lpstat [-tosrR]

Key argument :

  • -a lists all available printers
  • -t prints all information about the status of all printers
  • -o [printer] print the status of output requests
  • -s print a status summary, (status of the LP scheduler, default destination, list of printers etc.)
  • -r print the status of the LP request scheduler.
  • -R print a number showing the position of each request in the print queue.

Example :
$ lpstat –o
IT-HP5100-4 xarabas@itctnss0111 31781 Mar 10 18:10
IT-HP5100-5 root@itctnss0161 31823 Mar 10 18:10
IT-HP5101-856 ernescpp@itctnss0145 249752 Mar 10 18:10

$ lpstat –t
scheduler is running
no system default destination
system for IT-HP5101-l7: itctnss0145  (as printer raptor)
IT-HP5101-l7 accepting requests since Mar 10 18:17 2005
printer IT-HP5101-l7 is idle. enabled since Mar 10 18:18 2005.

$ lpstat –s
scheduler is running
system default destination: itctnss0145
system for IT-HP5101: itctnss0145 (as printer raptor)
system for IT-HP5102: itctnss0145 (as printer vtcds)

==================================================================================
cancel
The “cancel” command is used to remove the requests from the print queue

Syntax :
cancel id [id …]

Key argument :

  • -u username   Cancels jobs owned by username.

Example :
$ cancel IT-HP5100-128
Remove jobID 128 from printer IT-HP5100

$ cancel IT-HP5100
Remove current job on IT-HP5100

$ cancel -u xarabas
Remove all jobs owned by xarabas

N.B.:
The user can remove only his own request, only “root” can remove the request of other users.

Advertisements
Categories: Unix
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: