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

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

lpr: command not found

by admin

The lpr command submits files for printing. Files supplied at the command-line are sent to the specified printer or to the print queue if the printer is busy. Without specifying the printer to use, the command will send the print job to the default printer, which you can configure with CUPS. The lpr command reads the print file from standard input if no files are supplied at the command-line.

Syntax

The syntax of the lpr command is:

# lpr [options] [file names]

lpr Command Options

The lpr command options are described in the following table.

Option Description
-E Force encryption when connecting to the server.
-P {destination} Send the print job to the destination printer specified.
-# {copies} Set the number of copies to print from 1 to 100.
-T {name} Set the job name.
-l Specify that the print file is already formatted and should be sent to the destination without being filtered.
-o {option} Set a job option, like printing in landscape mode, scaling the printed output, printing double-sided, etc. Job options vary depending on the printer.
-p Print the specified files with a shaded header that includes the date, time, job name, and page number.
-r Specify that the printed files should be deleted after printing.

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

lpr: command not found

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

OS Distribution Command
Debian apt-get install lpr
Ubuntu apt-get install lpr
Arch Linux pacman -S lpr
Kali Linux apt-get install lpr
CentOS yum install lpr
Raspbian apt-get install lpr

lpr Command Examples

1. Print a file to the default printer:

# lpr path/to/file

2. Print 2 copies:

# lpr -# 2 path/to/file

3. Print to a named printer:

# lpr -P printer path/to/file

4. Print either a single page (e.g. 2) or a range of pages (e.g. 2–16):

# lpr -o page-ranges=2|2-16 path/to/file

5. Print double-sided either in portrait (long) or in landscape (short):

# lpr -o sides=two-sided-long-edge|two-sided-short-edge path/to/file

6. Set page size (more options may be available depending on setup):

# lpr -o media=a4|letter|legal path/to/file

7. Print multiple pages per sheet:

# lpr -o number-up=2|4|6|9|16 path/to/file

Filed Under: Linux

Some more articles you might also be interested in …

  1. Change default kernel (boot with old kernel) – CentOS/RHEL/OEL 7
  2. getsebool Command in Linux
  3. conky: command not found
  4. How to disable SSH host key checking in Linux
  5. Error “530: permission denied” when user logs in to vsftpd server via ftp
  6. How to Reinstall Corrupted Library with yum
  7. How To Disable Ksplice Service on OEL
  8. gnome-software: command not found
  9. How to uninstall ssh software package from Ubuntu
  10. bmon: command not found

You May Also Like

Primary Sidebar

Recent Posts

  • protonvpn-cli Command Examples in Linux
  • protonvpn-cli connect Command Examples
  • procs Command Examples in Linux
  • prlimit: command not found

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright