Monday, August 29, 2011

print commands in Linux

To see a list of available printers:

# lpstat -p -d

To print the file to printer "MyPrinter"

# lpr -P MyPrinter filename

To view (query) the print queue, use the lpq or lpstat command. When entered without arguments, it displays the contents of the default print queue.

# lpq
# lpstat

To list the default printer

# lpstat -d

To know the status of default printer

# lpstat -p

If the printer status is disabled, you need to enable the printer using "enable" command as follows.

# /usr/bin/enable

To disable the printer

# /usr/bin/disable -c

To reset the print queue, you have to disable and reenable as follows

# /usr/bin/disable -c
# /usr/bin/enable

To remove the print job

# lprm