Linux Print Command : Usage Of Linux lp Command With Examples

May 10, 2011 | By
| Reply More

The 'Lp' command is used to print files on Unix and Linux systems. The name 'lp' stands for 'line printer'. Normal users are allowed to have direct access to the printer. Users have to spool a job in a print queue. Spooling ensures the orderly printing of jobs. lp command is very useful in printing files when GUI is not installed on Linux. It serves as a front end command that calls the lpr command with appropriate options.

Change paper size using command prompt

It is very easy to change paper size in GUI environment. But how do you change paper size with command prompt?

The lp command prints to A4 paper size by default. However, if you want to print in a different paper size using the command prompt such as A3 or A5 then type as given below. Supported printer sizes are: "a4", "letter", and "legal".

$ lp -o media=A3 /path

Where, -o media=size : Sets the page size to size.
Print a double-sided legal document to a printer called "printer1":

$ lp -d printer1 -o media=legal -o sides=two-sided-long-edge /path

Print an image using a printer called "printer2":

$ lp -d printer2 -o scaling=200 filename

Linux lp printing command examples

The command given below prints /etc/passwd file to the default printer destination:

$lp /etc/passwd

Print the “.profile” file to the printer named “Sales”. The -d option specifies the destination.

$lp -dSales .profile

Simultaneous printing of more than one files:

$lp -dSales file1 file2 file3

This command places the print request Sales-101 on hold:

$lp -i Sales-101 -H hold

This command resumes the print request Sales-101:

$lp -i Sales-101 -H resume

The command given below resumes the print request Sales-101 starting with page 4:

$lp -i Sales-101 -H resume -P 4-

Use of pipeline with lp command. The command given below will print the output of the “ps -ef” command to the default printer:

$ps -ef | lp

To display the names of the printers that are connected to your system, use the lpc status command:

$lpc status

printer is on device 'parallel' speed -1
queuing is enabled
printing is enabled
no entries
daemon present

I hope these Linux lp command examples were helpful for you.


Tagged With :

Free Linux Ebook to Download

Leave a Reply

All comments are subject to moderation.