• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

lpq: command not found

by admin

The lpq command shows the status of the printer queue. By default, it will report each print job’s rank in the queue, who owns the job, the job number, the files in the job, and the size of the job. You can also have the report update every number of seconds that you specify with the +interval option, until the queue is empty. If you don’t specify the printer to monitor, the lpq command will monitor the default printer.

Syntax

The syntax of the lpq command is:

# lpq [options]

If you encounter the below error while running the lpq command:

lpq: command not found

you may try installing the below package as per your choice of distribution:

OS Distribution Command
Debian apt-get install lprng
Ubuntu apt-get install gnuspool
Alpine apk add cups
Arch Linux pacman -S cups
Kali Linux apt-get install lprng
Fedora dnf install cups
Raspbian apt-get install gnuspool

lpq Command Examples

1. Examine active jobs:

$ lpq
lp is ready and printing
Rank   Owner      Job  Files                 Total Size
active root       193  filter                9443 bytes
1st    root       194  resume.txt            11024 bytes
2nd    root       196  (standard input)      18998 bytes

Here, filter is currently being printed. resume.txt is up next, followed by the 18,998 bytes of data piped into lpr’s standard input.

2. Examine those same jobs using the long format:

$ lpq -l
lp is ready and printing
root: active                             [job 193AsJRzIt]
        filter                           9443 bytes
root: 1st                                [job 194AMj9lo9]
        resume.txt                       11024 bytes
root: 2nd                                [job 196A6rUGu5]
        (standard input)                 18998 bytes

3. Examine queue lp, which turns out to be empty:

$ lpq -Plp
no entries

4. Examine jobs owned by geek:

$ lpq geek
Rank   Owner      Job  Files                 Total Size
7th    geek     202  .bash_history         1263 bytes
9th    geek     204  .bash_profile         5676 bytes

Conclusion

The lpq command can be used to check the status of jobs that are waiting in the print queue. If it is called without any arguments, lpq will report the status of all jobs currently in the queue for the default printer. If the PRINTER environment variable is set, that printer is considered to be the default printer. If the PRINTER environment variable is not set, the printer that is aliased to lp in /etc/printcap will be used as the default.
Using the job numbers reported by lpq, any user may remove her own print jobs from the queue, or the superuser may remove any job.

Filed Under: Linux

Some more articles you might also be interested in …

  1. ghci: The Glasgow Haskell Compiler’s interactive environment
  2. Images preview with ngx_http_image_filter_module
  3. Difference between absolute and relative paths in Linux
  4. How to uninstall scons package from Ubuntu
  5. curl Command Examples in Linux
  6. nethogs Command Examples in Linux
  7. nslookup Command Examples in Linux
  8. llvd Command Examples
  9. How to use the ssh-keygen Command in Linux
  10. mpstat Command Examples in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • Vanilla OS 2 Released: A New Era for Linux Enthusiasts
  • mk Command Examples
  • mixxx Command Examples
  • mix Command Examples

© 2025 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright