LPQ(1)

๐Ÿ’– LPQ ๐Ÿ’–

okay bestie, so this is lpq โ€” the spool queue examination program, from the General Commands Manual section of the Unix world. she's an icon, she's been around forever (more on that below ๐Ÿ‘€), and she's here to tell you what's cooking in your printer's queue. let's get into it ๐ŸŽ€


โœจ SYNOPSIS โœจ

lpq [-al] [-Pprinter] [job# ...] [user ...]

๐ŸŒธ DESCRIPTION ๐ŸŒธ

so like, lpq goes and peeks inside the spooling area that lpd(8) uses to print files on the line printer, and then reports the status of the jobs you asked about โ€” or all the jobs that belong to a user. and if you just run lpq with zero arguments? she reports on any jobs currently in the queue. no filter, no fuss, just vibes ๐Ÿ’…

the options are as follows:

  • -a โ€” report on the local queues for all printers, not just the one you specified. go big or go home โœจ
  • -l โ€” prints info about each of the files comprising the job entry. normally she only shows as much info as will fit on one line, so this is the โœจ verbose โœจ main character mode.
  • -Pprinter โ€” pick a specific printer, otherwise the default line printer gets used (or whatever PRINTER is set to in the environment). and like, all the other arguments you pass get interpreted as user names or job numbers, filtering down to only those jobs you actually care about ๐Ÿซถ

for every job that's been submitted (i.e., every invocation of lpr(1)), lpq reports:

  • the user's name ๐Ÿ‘ค
  • current rank in the queue ๐Ÿ“Š
  • the names of the files comprising the job ๐Ÿ“„
  • the job identifier โ€” a number you can hand to lprm(1) to remove that specific job ๐Ÿ”ข
  • and the total size in bytes ๐Ÿ“

ngl, the job ordering depends on the algorithm used to scan the spooling directory, and it's supposed to be FIFO (First In First Out). supposed to be. anyway.

also โ€” file names comprising a job may be unavailable (this happens when lpr(1) is used as a sink in a pipeline), and in that case the file is just indicated as (standard input). mystery file energy, lowkey iconic ๐Ÿ™ˆ

๐Ÿšจ if lpq warns that there is no daemon present (i.e., due to some malfunction), you can use the lpc(8) command to restart the printer daemon. crisis averted, bestie.

๐ŸŒˆ ENVIRONMENT ๐ŸŒˆ

if this environment variable exists, lpq uses it:

  • PRINTER โ€” specifies an alternate default printer.

๐Ÿฆ‹ FILES ๐Ÿฆ‹

  • /etc/printcap โ€” to determine printer characteristics.
  • /var/spool/* โ€” the spooling directory, as determined from printcap.
  • /var/spool/output/*/cf* โ€” control files specifying jobs.
  • /var/spool/output/*/lock โ€” the lock file to obtain the currently active job.

๐Ÿ’€ DIAGNOSTICS ๐Ÿ’€

  • unable to open various files.
  • the lock file being malformed.
  • garbage files when there is no daemon active, but files are still sitting in the spooling directory.

๐Ÿ‘‘ SEE ALSO ๐Ÿ‘‘

lpr(1), lprm(1), lpc(8), lpd(8)


โญ HISTORY โญ

lpq appeared in 3BSD. she's a legacy queen, no cap ๐Ÿ’œ


๐Ÿ˜ญ BUGS ๐Ÿ˜ญ

  • due to the dynamic nature of the information in the spooling directory, lpq may report unreliably. it's giving "trust me bro" but for print queues.
  • output formatting is sensitive to the line length of the terminal, which can result in widely spaced columns. yeah. she's a little dramatic about your terminal width.

and that's the whole page bestie, fr fr ๐Ÿงš โ€” this one comes to you from Debian, dated May 31, 2007, and it lives in the LPQ(1) slot of the manual. go check your queue, slay ๐Ÿ’…โœจ๐Ÿ“

๐Ÿ“ฆ where this page comes from