1.\"	$OpenBSD: lprm.1,v 1.13 2022/02/18 23:17:16 jsg Exp $
2.\"	$NetBSD: lprm.1,v 1.10 2002/01/19 03:23:47 wiz Exp $
3.\"
4.\" Copyright (c) 1983, 1990, 1993
5.\"	The Regents of the University of California.  All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice, this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\" 3. Neither the name of the University nor the names of its contributors
16.\"    may be used to endorse or promote products derived from this software
17.\"    without specific prior written permission.
18.\"
19.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29.\" SUCH DAMAGE.
30.\"
31.\"     @(#)lprm.1	8.1 (Berkeley) 6/6/93
32.\"
33.Dd $Mdocdate: February 18 2022 $
34.Dt LPRM 1
35.Os
36.Sh NAME
37.Nm lprm
38.Nd remove jobs from the line printer spooling queue
39.Sh SYNOPSIS
40.Nm lprm
41.Op Fl
42.Op Fl P Ns Ar printer
43.Oo
44.Op Ar job# ...
45.Op Ar user ...
46.Oc
47.Sh DESCRIPTION
48.Nm lprm
49will remove a job, or jobs, from a printer's spool queue.
50Since the spooling directory is protected from users, using
51.Nm
52is normally the only method by which a user may remove a job.
53The owner of a job is determined by the user's login name
54and host name on the machine where the
55.Xr lpr 1
56command was invoked.
57.Pp
58Options and arguments:
59.Bl -tag -width indent
60.It Fl P Ns Ar printer
61Specify the queue associated with a specific
62.Ar printer
63(otherwise the default printer is used).
64.It Fl
65If a single
66.Dq Fl
67is given,
68.Nm
69will remove all jobs which a user
70owns.
71If the superuser employs this flag, the spool queue will
72be emptied entirely.
73.It Ar user
74Causes
75.Nm
76to attempt to remove any jobs queued belonging to that user (or users).
77This form of invoking
78.Nm
79is useful only to the superuser.
80.It Ar job#
81A user may dequeue an individual job by specifying its job number.
82This number may be obtained from the
83.Xr lpq 1
84program, e.g.,
85.Bd -literal -offset indent
86\&% lpq \-l
87
881st:ken				[job #013ucbarpa]
89	(standard input)	100 bytes
90% lprm 13
91.Ed
92.El
93.Pp
94If neither arguments or options are given,
95.Nm
96will delete the currently active job if it is
97owned by the user who invoked
98.Nm lprm .
99.Pp
100.Nm lprm
101announces the names of any files it removes and is silent if
102there are no jobs in the queue which match the request list.
103.Pp
104.Nm
105will kill off an active daemon, if necessary, before removing
106any spooling files.
107If a daemon is killed, a new one is
108automatically restarted upon completion of file removals.
109.Sh ENVIRONMENT
110If the following environment variable exists, it is utilized by
111.Nm lprm :
112.Bl -tag -width PRINTER
113.It Ev PRINTER
114If the environment variable
115.Ev PRINTER
116exists,
117and a printer has not been specified with the
118.Fl P
119option,
120the default printer is assumed from
121.Ev PRINTER .
122.El
123.Sh FILES
124.Bl -tag -width /var/spool/output/*/lock/ -compact
125.It Pa /etc/printcap
126Printer characteristics file.
127.It Pa /var/spool/output/*
128Spooling directories.
129.It Pa /var/spool/output/*/lock
130Lock file used to obtain the PID of the current
131daemon and the job number of the currently active job.
132.El
133.Sh DIAGNOSTICS
134.Bl -tag -width Ds
135.It Sy Permission denied
136File to remove was owned by another user.
137.El
138.Sh SEE ALSO
139.Xr lpq 1 ,
140.Xr lpr 1 ,
141.Xr lpd 8
142.Sh HISTORY
143The
144.Nm lprm
145command appeared in
146.Bx 3.0 .
147.Sh BUGS
148Since there are race conditions possible in the update of the lock file,
149the currently active job may be incorrectly identified.
150