• 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 Examples in Linux

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]

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. envoy: A PHP-based task manager for Laravel remote servers
  2. top Command Examples in Linux
  3. Understanding rsyslog Filter Options
  4. chown: command not found
  5. CentOS / RHEL : How to Disable / Enable direct root and non-root user ssh login
  6. CentOS / RHEL : How to configure alias (virtual interface) of bond interface (bondx:y)
  7. dconf Command Examples in Linux
  8. mimetype: command not found
  9. ethtool Command Examples in Linux
  10. figlet: Generate ASCII banners from user input

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