Книга: Fedora™ Unleashed, 2008 edition

Managing Print Jobs

Managing Print Jobs

You can also print multiple documents from the command line. For example, to simultaneously print a number of files to the lp printer, use lpr like so:

# lp -dlp *.txt

This approach uses the wildcard capabilities of the shell to feed the lpr command all files in the current directory with a name ending in .txt for printing. Use the lpq command to view the printer's queue, as follows:

# lpq
lp is ready and printing
Rank   Owner Job File(s)      Total Size
active root  7   classes.conf 3072 bytes

The lpq command reports on the job, owner, job number, file being printed, and size of job. The job number (7 in this example) is used by CUPS to keep track of documents printing or waiting to be printed. Each job has a unique job number. To stop the print job in this example, use the lprm command, followed by the job number, like this:

# lprm 7

The lprm command removes the spooled files from the printer's queue and kills the job. Print job owners, such as regular users, can remove only spooled jobs that they own. As the root operator, you can kill any job.

Only the root operator can use the lpc command to administer printers and queues because the command is primarily used for printer and queue control. You, as a regular user, cannot use it to rearrange the order of your print jobs, but you can get a display of the status of any system printer. Start lpc on the command line like this:

# /usr/sbin/lpc

The lpc command has built-in help, but it consists of only five commands: exit, help, quit, status, and ?. The status command shows the status of a specified printer or all printers:

# lpc
lpc> ?
Commands may be abbreviated. Commands are:
exit help quit status ?
lpc> status
lp:
 printer is on device 'parallel' speed -1
 queuing is enabled
 printing is enabled
 no entries
 daemon present
netlp:
 printer is on device 'parallel' speed -1
 queuing is enabled
 printing is enabled
 no entries
 daemon present
lpc> quit

The preceding sample session shows a status report for two printers: lp and netlp. Another helpful command is lpstat, which you use like this with its -t option:

# lpstat -t
scheduler is running
system default destination: lp
device for lp: parallel:/dev/lp0
device for netlp: parallel:/dev/lp0
lp accepting requests since Jan 01 00:00
netlp accepting requests since Jan 01 00:00
printer lp is idle. enabled since Jan 01 00:00
printer netlp is idle. enabled since Jan 01 00:00!)

This command lists all status information about printer queues on the local system.

Оглавление книги

Оглавление статьи/книги

Генерация: 0.041. Запросов К БД/Cache: 0 / 0
поделиться
Вверх Вниз