Linux Format

CUPS command-line utilities

-

The CUPS printing system ships with a number of nifty little command-line utilities. In fact, you can set up and configure all aspects of your printer from the CLI. Let’s run through some of the most useful commands that will help you manage the printer better.

We’ve already seen the lp command, which queues a file for printing on the default printer. The default printer is specified in the PRINTER variable. You can specify it with the command

export PRINTER=printer-name where printer-name is the name of the printer you specify in step two of the walkthroug­h ( seep66). If you have multiple printers, use the -d option to specify the printer you wish to print to. For example, lp -d HP-printer file.txt prints the file on the HP printer, which isn’t set as the default.

To influence the characteri­stics of the printed output, use the -o option to specify a variety of options. For example, lp -o landscape -o fit-to

page -o media A4 file.jpg fits the image into A4 size specificat­ions and prints it in landscape mode. Refer to the CUPS documentat­ion ( www.cups.org/documentat­ion.php/options. html#OPTIONS) for a list of all the supported printing options.

If you mistakenly print a large file and want to stop the print job before you waste too much paper, you can use the lpq command to print a list of all the print jobs currently in the queue.

The command also lists the file that each job is printing and its size, so you can easily identify the job ID assigned to each. Make note of it because you need it to cancel the print job. The command cancel 2 , for instance, cancels the job with the ID 2.

Newspapers in English

Newspapers from Australia