Print files or modify queued print jobs
The lp command is used to print files or modify queued print jobs. Similar to the lpr command, lp supports both file input and standard input. It differs from lpr in having a slightly more complex set of parameter options.
lp (options) (parameters)
-E: Force encryption when connecting to the server;
-U <username>: Specify the username to use when connecting to the print server;
-d <printer>: Specify the destination printer;
-i <job-id>: Specify an existing job ID;
-m: Send an email when the job is completed;
-n <copies>: Specify the number of copies to print;
-t <title>: Specify the name/title of the print job;
-H <when>: Specify when the job should be printed;
-P <page-list>: Specify which pages to print.
File: The file to be printed.
To print the file /etc/motd on the printer lp0 connected to device dlp0, enter:
lp /etc/motd
To print 30 copies of the /etc/motd file using a copy of the file and notify the user by email when the job is done, enter:
lp -c -m -n30 -d lp0:lpd0 /etc/motd
To print /etc/motd with backend flags -f and -a and the job title "blah", enter:
lp -t "blah" -o -f -o -a /etc/motd
To queue the file myfile and return the job number:
lp myfile
To queue the file myfile and suppress the job number:
lp -s myfile
Exit Status
This command returns the following exit values:
0: No output device was available, or an error occurred.