вторник, 30 марта 2010 г.

LPI exam 102 prep: Printing

Краткие заметки, сделанные при подготовке к сдаче экзамена LPI 117-102 (Junior Level Linux Professional (LPIC-1)).

In UNIX® and Linux systems, printing initially used the Berkeley Software
Distribution (BSD) printing subsystem, consisting of a line printer daemon (lpd)
running as a server, and client commands such as lpr to submit jobs for printing.
This protocol was later standardized by the IETF as RFC 1179, "Line Printer
Daemon Protocol".

System V UNIX also had a printing daemon. It was functionally similar to the
Berkeley LPD, but had a different command set. You will frequently see two
commands with different options that accomplish the same task. For example, lpr
from the Berkeley implementation and lp from the System V implementation are
both use to print files.


The CUPS server runs as a daemon process, cupsd under control of a configuration
file normally located in /etc/cups/cupsd.conf. The /etc/cups directory also contains
other configuration files related to CUPS. It is usually started during system
initialization, but may be controlled by the cups script located in /etc/rc.d/init.d or
/etc/init.d, according to your distribution.

The configuration file, /etc/cups/cupsd.conf, contains parameters that you may set to
control such things as access to the printing system, whether remote printing is
allowed, the location of spool files, and so on.

the spool files are stored by default in the /var/spool filesystem as you would expect from the
Filesystem Hierarchy Standard (FHS).

the spool files are stored by default in the /var/spool filesystem as you would expect from the
Filesystem Hierarchy Standard (FHS).

check the queues known to the system using the CUPS lpstat command.

-a Display accepting
status of printers.
-c Display print classes.
-p Display print status:
enabled or disabled.
-s Display default printer,
printers, and classes.
Equivalent to -d -c
-v. Note that multiple
options must be
separated as values
can be specified for
many.
-s Display printers and
their devices.

also use the LPD lpc command, found in /usr/sbin, with the status option.

If no option is specified, lpq displays the queue for the default printer. Use the -P option with a printer name to specify a particular printer or the -a option to specify all printers,

You can avoid printing the extra copy by removing a job from the queue with the lprm command.

Another command that will help you manipulate jobs on print queues is the lp command.

you might use lpc topq to move a job to the top of a queue. Other lpc commands may include
disable, down, enable, hold, move, redirect, release, and start.

Most CUPS systems also have a graphical interface to
the command-line functions that we discuss here. Generally, this interface is
accessible from the local host using a browser pointed to port 631
(http://localhost:631 or http://127.0.0.1:631),

The simplest way to print any file is to use the lpr command and provide the file
name. This prints the file on the default printer.

Print files

The simplest way to print any file is to use the lpr command and provide the file
name. This prints the file on the default printer.

-C, -J, or -T Set a job name.
-P Select a particular
printer.
-# Specify number of
copies. Note this is
different to the -n option
you saw with the lp
command.
-m Send email upon job
completion.
-l The print file is already
formatted for printing.
Equivalent to -o raw.
-o Set a job option.
-p Format a text file with a
shaded header.
Equivalent to -o
prettyprint.
-q Hold (or queue) the job
for later printing.
-r Remove the file after it

complex example: lpr -Pxerox -J "Ian's text file" -#2 -m -p -q -r abc.txt, user ian is requesting a specific printer, giving a name to the
job, requesting 2 copies, requesting an email confirmation after printing, holding the
job, and having the file abc.txt removed after it has been spooled. The subsequent
commands show the held job and the fact that the file has indeed been removed.

find out what general options are set for a printer using the
lpoptions command. Add the -l option to display printer-specific options

mpage
Formats test files for printing multiple pages on a single page.
psnup
Performs similar functions for PostScript files as mpage does for text files.
psbook
Rearranges the pages of a PostScript document for printing as a book or
booklet, taking into account the number of pages per sheet and how the sheet
is folded.

The a2ps command can handle a wide range of text file types and make intelligent
decisions about the best way to format them

Printer installation and configuration

Use the cups script located in /etc/rc.d/init.d or /etc/init.d, according to your
distribution with the status command. You can also use the lpstat or lpc
status command to check whether your daemon is running.

CUPS also maintains an access log and an error log. You can change the level of
logging using the LogLevel statement in /etc/cups/cupsd.conf. By default, logs are
stored in the /var/log/cups directory.

The lpinfo command can also help you identify
available device types and drivers. Use the -v option to list supported devices and
the -m option to list drivers

If you need to remove a printer, use lpadmin with the -x option

CUPS uses the /var/spool/cups directory for spooling.

Комментариев нет: