Printing : Command-line Tools

If you’re an old UNIX hand and like to use command-line tools to run print jobs, you still have them available from CUPS.

 

lpr

You can print to your default printer with a command like:

lpr document.txt

If you haven’t set a default printer or want to change it, add a line to your .bashrc profile file like this:

export PRINTER=djet850

And if you want to override that default for a single print job, use this kind of command:

lpr -P djet600 document.txt

 

lpc

List the status of your printers with:

lpc status

 

lprm

Remove (kill) print jobs with an lprm command:

lprm -P djet850 #Kills jobs on this printer
or
lprm – #Kills all your print jobs
or
lprm glenn #Kills all of glenn’s print jobs – you have to be root to do this
or
lprm 166 #Kills job 166; find this number by issuing the lpq command.