Printing Commands in Linux or Debain Linux
Linux includes a number of command line tools for administering printing. These commands are useful on networks, or for troubleshooting and managing printing on any system.
Each printer on a Linux system has its own spool or queue in the /var /spool/lpd directory. This spool uses the short name of the printer, which is created when the printer is first configured. When a file is printed, it becomes a job in the spool. Each job is stored in a spool until it is printed.
Printing tools generally start with lp (short for "line printer"). If you are familiar with other Linux commands, you can usually make a good guess at what the rest of the command should be. For example, lprm removes a print job from the spool
You can use the following tools for managing printing
lpq : Checks the status of print jobs.
lprm : Removes a print job from a spool.
lpstat : Reads the status of a spool.
Checking the Status of Print Jobs
lpq options user
The command's name comes from the fact that a spool is sometimes called a "queue."
The lpq Command (Print Jobs) Options
-l - Prints information for each file in the printer queue.
number - Checks the status of a job number.
-P printer - Sets the printer that a job should Use.
If you want to know more options check lpq man page
Sends requests to a line printer
lp options files
If you want to know more options check lp man page
Removing Jobs From a Printer Spool
lprm options job user
The command's name comes from the fact that it removes (rm) a job from a line printer (lp).
Only the root user can remove a job sent by another user.
Regular users can remove their own print jobs.
Use lpstat to find job numbers.
The lprm Command (Remove Print Jobs) Options
-P printer - Sets the printer to Use.
- user - Removes all jobs sent by the user specified.
If you want to know more options check lprm man page
Reading the Status of a Printer Spool
lpstat -t options
If you want to know more options check lpstat man page
Printing From the Command Line
lpr options files
The lpr Command (Print) Options
-P printer - Selects the printer to Use.
-s - This option saves time and disk space for large files, but may cause printing to be slower.
If you want to know more options check lpr man page