rhl38.htm

来自「linux的初学电子书」· HTM 代码 · 共 2,175 行 · 第 1/5 页

HTM
2,175 行
字号
<BR>

<NOTE>The ownership root.daemon is a special Linux convention for the daemons run by root. The entry root.daemon does not appear in the /etc/passwd file. This uses a convention that lets the first part of the entry (before the period) indicate the user and 
the second part (after the period) represent the group.</NOTE>

<BR>

<HR ALIGN=CENTER>

</BLOCKQUOTE></BLOCKQUOTE>

<P>If a different device is configured, the device name itself must be changed to the device number. For each possible parallel port, the mknod commands are as follows:

<BR>

<PRE>

<FONT COLOR="#000080">mknod -m 620 /dev/lp0 c 6 0

mknod -m 620 /dev/lp1 c 6 1

mknod -m 620 /dev/lp2 c 6 2</FONT></PRE>

<P>In these examples, the minor device numbers have been incremented to correspond to the port number. This is not necessary, but it can help with identification.

<BR>

<P>After the mknod and chown commands have been issued, it is advisable to manually check to ensure that the ownerships are set properly and that a spool directory has been created. If the spool directory doesn't exist, you have to create it manually. The 
permissions and ownership requirements of the spool directory were given earlier, in the section &quot;The /etc/printcap File and Spooling Directories.&quot;

<BR>

<BR>

<A NAME="E69E431"></A>

<H4 ALIGN=CENTER>

<CENTER>

<FONT SIZE=4 COLOR="#FF0000"><B>Managing Printers with </B><B>lpc</B></FONT></CENTER></H4>

<BR>

<P>Printers are controlled through a utility called lpc. The lpc program lets you perform several important functions pertaining to the printers used on your Linux system:

<BR>

<UL>

<LI>Display printer status information

<BR>

<BR>

<LI>Enable or disable the printer

<BR>

<BR>

<LI>Enable or disable the printer queue

<BR>

<BR>

<LI>Remove all print requests from a printer's queue

<BR>

<BR>

<LI>Promote a particular print request to the top of the queue

<BR>

<BR>

<LI>Make changes to the lpd printer daemon

<BR>

<BR>

</UL>

<P>The lpc program can't be used for remote printers. It affects only those directly attached and configured on the local machine.

<BR>

<BLOCKQUOTE>

<BLOCKQUOTE>

<HR ALIGN=CENTER>

<BR>

<NOTE>Be warned that lpc is one of the most unpredictable and unreliable programs included with the Linux operating system! It can hang up for no obvious reason, and it can also display erroneous status messages. In some cases, the only way to fix a 
severely screwed-up printer system is to reset the machine completely!</NOTE>

<BR>

<HR ALIGN=CENTER>

</BLOCKQUOTE></BLOCKQUOTE>

<P>When used without any arguments, lpc prompts you for a command. The following are several valid lpc commands and their arguments (a vertical bar indicates a choice of arguments):

<BR>

<UL>

<UL>

<P>abort printer_name | all Is similar to the stop command, except it doesn't allow any print job that is currently being printed to finish before stopping the printer. When used with the all argument, all printers are stopped. Any job that is abnormally 
terminated by the abort command is requeued when the printer is started again. See the stop command for more details about the printer daemon and lock files.

<BR>

</UL></UL>

<UL>

<UL>

<P>clean printer_name | all Removes all print jobs that are queued, including any active print jobs. In many cases, the currently printing job proceeds normally because it has been passed to the printer daemon or the printer's buffer. All other jobs are 
removed, though. If the all argument is used, all printers have their print queues cleaned.

<BR>

</UL></UL>

<UL>

<UL>

<P>disable printer_name | all Disables the spooling of print requests to the printer (or all printers, depending on the argument). Any jobs that are already queued are unaffected. Any user trying to send a print job to the disabled printer receives a 
message indicating that the printer is disabled, and the print job is refused. Printers are enabled and disabled through changes in the lock file in the spool directory.

<BR>

</UL></UL>

<UL>

<UL>

<P>down printer_name message Is used to take a printer completely offline, usually for an extended period. If a message is included, it can be as long as you want. It is placed in the status file in the spool directory and displayed to users trying to 
queue to the printer. The down command is usually used when a printer has serious problems and must be removed from the system for more than a day.

<BR>

</UL></UL>

<UL>

<UL>

<P>enable printer_name | all Enables the spooling of print requests to the printer or all printers.

<BR>

</UL></UL>

<UL>

<UL>

<P>exit Exits from lpc (the same as quit).

<BR>

</UL></UL>

<UL>

<UL>

<P>help or ? Shows a short list of all lpc commands. If an argument is supplied, it displays a one-line description of that command (such as help abort).

<BR>

</UL></UL>

<UL>

<UL>

<P>quit Exits from lpc (the same as exit).

<BR>

</UL></UL>

<UL>

<UL>

<P>restart printer_name | all Restarts the printer daemon, and is usually used after it has died for an inexplicable reason (which the BSD printer daemons tend to do). If the argument all is supplied, all printer daemons are restarted.

<BR>

</UL></UL>

<UL>

<UL>

<P>start printer_name Starts the printer, allowing it to print requests. This command starts the printer queue daemon for that printer.

<BR>

</UL></UL>

<UL>

<UL>

<P>status printer_name Displays the printer name, whether it has the spool queue enabled, whether printing is enabled, the number of entries in the print queue, and the status of the daemon for that printer. If there are no entries in the queue, no printer 
daemon will be active. However, if there are entries in the queue and the printer daemon shows as no daemon present, the daemon has died and must be started again with the restart command.

<BR>

</UL></UL>

<UL>

<UL>

<P>stop printer_name Stops the printer. Print requests can still be spooled, but they are not printed until the printer is started. If a job is being printed when the stop command is issued, the job completes the print process and then stops printing. The 
start and stop commands alter the contents of the lock file in the print spool directories. The stop command also kills the daemon for spooling to that printer.

<BR>

</UL></UL>

<UL>

<UL>

<P>topq printer_name print_ID Moves the print request with print_ID to the top of the print queue.

<BR>

</UL></UL>

<UL>

<UL>

<P>topq printer_name username Moves all print requests owned by username to the top of the queue. (This is very handy for system administrators who don't want to wait!)

<BR>

</UL></UL>

<UL>

<UL>

<P>up printer_name Is used to reactivate a printer that was taken down. See the down command for more information.

<BR>

</UL></UL>

<P>The lpc utility isn't very user-friendly, but it's the only way to handle printers and their queues in Linux. Several front-end menu-driven utilities are beginning to appear that simplify this task.

<BR>

<BR>

<A NAME="E69E432"></A>

<H4 ALIGN=CENTER>

<CENTER>

<FONT SIZE=4 COLOR="#FF0000"><B>Managing the Printer Queue with </B><B>lpq</B><B> and </B><B>lprm</B></FONT></CENTER></H4>

<BR>

<P>Several commands help you administer the printer queue specifically, instead of relying on the lpc command. Two tasks are commonly required by a system administrator: displaying the current queue and removing print jobs in a queue.

<BR>

<P>To display the current print queue for any printer, use the lpq command. It has the following syntax:

<BR>

<BR>

<PRE>

<FONT COLOR="#000080">lpq [-l] [-Pprinter_name] [job_ID ...] [username ...]</FONT></PRE>

<P>With no arguments at all, lpq displays information about the current printer queues. The lpq command normally displays information about who queued the print job, where it is in the queue, the files being printed, and the total size of the files. The -l 
option displays more information about each entry in the printer queue. Usually, only one line of information is displayed.

<BR>

<P>A specific printer can be displayed with the -P option, followed by the printer's name. If no name is supplied, the default system printer is displayed. If one or more job_IDs or usernames are provided, only information about the job or jobs queued by 
the user is shown.

<BR>

<BLOCKQUOTE>

<BLOCKQUOTE>

<HR ALIGN=CENTER>

<BR>

<NOTE>Because users can't access the Linux printer spooling directories, they can remove queued print jobs only with the lprm command. If you are a system administrator, you might want to let all system users know how to use this command to keep unwanted 
print jobs from printing.</NOTE>

<BR>

<HR ALIGN=CENTER>

</BLOCKQUOTE></BLOCKQUOTE>

<P>The lprm command is used to remove files from a printer queue. This command is often mistyped as lpr, which doesn't remove the file from the queue. To use lprm, you must know the print job ID; or, if you are logged in as root, you can remove all jobs 
for a particular printer. The syntax of the lprm command is as follows:

<BR>

<BR>

<PRE>

<FONT COLOR="#000080">lprm [-Pprinter_name] [-] [job_ID ...] [username ...]</FONT></PRE>

<P>If the single hyphen argument is used, lprm removes all jobs owned by the user who issues the command. If you are logged in as root, all print jobs are removed. A particular printer's jobs can be removed by using the -P option. For example, the command

<BR>

<BR>

<PRE>

<FONT COLOR="#000080">lprm -Phplj -</FONT></PRE>

<P>removes all print jobs queued on the printer hplj by the user who issues the command, or all print jobs for that printer if issued by root.

<BR>

<BLOCKQUOTE>

<BLOCKQUOTE>

<HR ALIGN=CENTER>

<BR>

<NOTE>It is easy to accidentally remove all print jobs for a printer when you use the lprm command as root. Take care to use the proper syntax, or you may get frustrated at having to requeue all the jobs!</NOTE>

<BR>

<HR ALIGN=CENTER>

</BLOCKQUOTE></BLOCKQUOTE>

<P>If a print job ID or a username is supplied as an argument, lprm removes that job or all jobs submitted by the user. If no arguments are supplied at all, the currently active job submitted by the user is deleted.

<BR>

<P>When lprm removes files from the queue, it echoes a message to the display. If there are no files to remove, nothing is echoed (and you will be left wondering what, if anything, happened).

<BR>

<P>If you try to use lprm on a job that is currently being printed, it might not be terminated properly because the file might already reside in the printer's buffer. In some cases, terminating a job that is currently printing can cause the printer to 
lock, because some output format files can't handle the termination instructions and freeze when the lock file in the spool directory changes. In cases such as this, the ps command must be used to find the output filter process ID, and then it must be 
killed.

<BR>

<BLOCKQUOTE>

<BLOCKQUOTE>

<HR ALIGN=CENTER>

<BR>

<NOTE>In cases of printer lockup that don't seem to solve themselves with the lpc utility, try killing the lpd daemon and restarting it. If that doesn't work, you will probably have to reboot the entire system.</NOTE>

<BR>

<HR ALIGN=CENTER>

</BLOCKQUOTE></BLOCKQUOTE>

<BR>

<A NAME="E68E329"></A>

<H3 ALIGN=CENTER>

<CENTER>

<FONT SIZE=5 COLOR="#FF0000"><B>Terminals</B></FONT></CENTER></H3>

<BR>

<P>Most Linux systems use only the system console that came with the PC (the PC's screen and keyboard act as the system console). You won't have to make any configuration changes to Linux to use the system console effectively.

<BR>

<P>Some system administrators want to add remote terminals to allow other users to work with Linux simultaneously (it is a multiuser system, after all). New terminals can be added to the system in one of two ways: through a serial port on the back of the 
PC or through a multiport card with many serial ports on it.

<BR>

<BR>

<A NAME="E69E433"></A>

<H4 ALIGN=CENTER>

<CENTER>

<FONT SIZE=4 COLOR="#FF0000"><B>Using Multiport Cards</B></FONT></CENTER></H4>

<BR>

<P>Multiport cards provide an easy and effective method of adding many serial ports to your system. Multiport cards are offered by dozens of vendors in different configurations. They provide from two to 32 additional serial ports per card (for terminals, 
modems, or printers), and can use several different types of connectors (such as DB25 connectors, DB9 connectors, or RJ11 wide telephone-style jacks).

<BR>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?