Print a file or modify a queued print job
lp command is used to print files or modify queued print tasks. Similar to the lpr command, the lp command supports both file input and standard input. It differs from lpr in that it has a different (slightly more complex) set of parameter options.
lp(option)(parameter)
-E: Force encryption when connecting to the print server;
-U: Specify the user name used when connecting to the print server;
-d: Specify the target printer to receive the print task;
-i: Specify an existing printing task number;
-m: Send E-mail when printing is completed;
-n: Specify the number of copies to print;
-t: Specifies the name of the print task;
-H: Specify the time when the print task starts;
-P: Specify the page number to be printed.
File: File to be printed.
To print the file /etc/motd
on printer lp0 attached to device dlp0, enter:
lp /etc/motd
To print 30 copies of the /etc/motd
file using one copy of the file, and to notify the user by email that the job is complete, enter:
lp -c -m -n30 -dlp0:lpd0 /etc/motd
To print the /etc/motd
file using the backend flags -f and -a with a job title blah, enter:
lp -t "blah" -o -f -o -a /etc/motd
To queue a MyFile file and return the job number, enter:
lp myfile
To queue a MyFile file and suppress job numbers, enter:
lp -s myfile
Exit status
The command returns the following exit values: