⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ch39.htm

📁 linux-unix130.linux.and.unix.ebooks130 linux and unix ebookslinuxLearning Linux - Collection of 12 E
💻 HTM
📖 第 1 页 / 共 5 页
字号:
<P>If the single hyphen argument is used, <TT>lprm</TT> removes all jobs owned by



the user who issues the command. If you are logged in as <TT>root</TT>, all print



jobs are removed. A particular printer's jobs can be removed by using the <TT>-P</TT>



option. For example, the command<FONT COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF">lprm -Phplj -



</FONT></PRE>



<P>removes all print jobs queued on the printer <TT>hplj</TT> by the user who issues



the command, or all print jobs for that printer if issued by <TT>root</TT>.







<DL>



	<DT></DT>



</DL>











<DL>



	<DD>



<HR>



<A NAME="Heading20<FONT COLOR="#000077"><B>WARNING:</B> </FONT>It is easy to



	accidentally remove all print jobs for a printer when you use the <TT>lprm</TT> command



	as <TT>root</TT>. Take care to use the proper syntax, or you may get frustrated at



	having to requeue all the jobs!



<HR>







</DL>







<P>If a print job ID or a username is supplied as an argument, <TT>lprm</TT> 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.</P>







<P>When <TT>lprm</TT> 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).</P>



<P>If you try to use <TT>lprm</TT> 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 <TT>ps</TT> command must be used to find the output filter process ID, and then



it must be killed.







<DL>



	<DT></DT>



</DL>











<DL>



	<DD>



<HR>



<A NAME="Heading21<FONT COLOR="#000077"><B>NOTE:</B> </FONT>In cases of printer



	lockup that don't seem to solve themselves with the <TT>lpc</TT> utility, try killing



	the <TT>lpd</TT> daemon and restarting it. If that doesn't work, you will probably



	have to reboot the entire system.



<HR>







</DL>







<CENTER>



<H3><A NAME="Heading22<FONT COLOR="#000077">Terminals</FONT></H3>



</CENTER>



<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.</P>



<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.



<CENTER>



<H4><A NAME="Heading23<FONT COLOR="#000077">Using Multiport Cards</FONT></H4>



</CENTER>



<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).</P>



<P>If you are going to use a multiport card, make sure you can find one with software



device drivers that are designed to work with Linux. You can't use any multiport



card designed for other versions of UNIX (or Xenix) without modification. Because



multiport card device drivers are complex binaries, modification is beyond the scope



of most people's programming abilities.</P>



<P>Multiport cards come with complete instructions for installing the device drivers



for the multiport card, as well as configuring the terminals. Because the details



of the configurations change depending on the manufacturer of the multiport card,



you should consult the documentation accompanying the card for more information.



<CENTER>



<H4><A NAME="Heading24<FONT COLOR="#000077">Adding Serial Port Terminals</FONT></H4>



</CENTER>



<P>You can use the serial ports on the PC to add remote terminals. The terminal can



be a dedicated terminal or another PC running terminal emulation software. Linux



doesn't really care about the identity of the remote machine, except when it comes



to sending instructions for screen displays.</P>



<P>The wiring of cables between the remote terminal and the PC hosting the Linux



operating system depends on the type of connectors at both ends. In most cases, the



cable is a DTE (Data Terminal Equipment)-to-DTE type, although some terminals and



PC serial ports require DCE (Data Communications Equipment) cabling. As a general



rule, terminals and remote computers use DTE, and modems use DCE. The difference



between DTE and DCE cabling is in the way the wires run from each end connector.</P>



<P>A typical DCE cable (such as for a modem) uses straight-through wiring, meaning



that pin 1 on the PC end goes to pin 1 on the modem end, pin 2 goes through to pin



2, and so on. This is called a straight cable (also called a modem cable by some).</P>



<P>When connecting a terminal, however, some of the pins must be crossed to permit



signals to pass properly. The wiring of such a cable (often called a null modem cable



or hard-wired cable) requires several crosses or shorts to make the connection valid.



Serial port connectors on a PC are either a DB9 (9-pin) or a DB25 (25-pin) connector.



Not all of the wires in the 25-pin (or the 9-pin, for that matter) are required for



a terminal device. A complete terminal cable can be made of only three pins (send,



receive, and ground), although Linux also uses the Carrier Detect wire to tell when



a terminal is attached and active.</P>



<P>The important pins and their meanings for DTE (computer to terminal) 25-pin cables



are shown in Table 39.1. The cable numbers are changed for 9-pin connectors, but



the crossings are the same. <BR>







<CENTER>



<P><FONT SIZE="4"><B>Table 39.1.</B> DTE cables for a 25-pin connector. </FONT>



<TABLE BORDER="0">



	<TR ALIGN="LEFT" rowspan="1">



		<TD WIDTH="81" ALIGN="LEFT" VALIGN="TOP"><I>Terminal Pin </I></TD>



		<TD WIDTH="83" ALIGN="LEFT" VALIGN="TOP"><I>Computer Pin </I></TD>



		<TD ALIGN="LEFT" VALIGN="TOP"><I>Meaning </I></TD>



	</TR>



	<TR ALIGN="LEFT" rowspan="1">



		<TD WIDTH="81" ALIGN="LEFT" VALIGN="TOP">1 </TD>



		<TD WIDTH="83" ALIGN="LEFT" VALIGN="TOP">1 </TD>



		<TD ALIGN="LEFT" VALIGN="TOP">Ground </TD>



	</TR>



	<TR ALIGN="LEFT" rowspan="1">



		<TD WIDTH="81" ALIGN="LEFT" VALIGN="TOP">2 </TD>



		<TD WIDTH="83" ALIGN="LEFT" VALIGN="TOP">3 </TD>



		<TD ALIGN="LEFT" VALIGN="TOP">Transmit data/receive data </TD>



	</TR>



	<TR ALIGN="LEFT" rowspan="1">



		<TD WIDTH="81" ALIGN="LEFT" VALIGN="TOP">3 </TD>



		<TD WIDTH="83" ALIGN="LEFT" VALIGN="TOP">2 </TD>



		<TD ALIGN="LEFT" VALIGN="TOP">Receive data/transmit data </TD>



	</TR>



	<TR ALIGN="LEFT" rowspan="1">



		<TD WIDTH="81" ALIGN="LEFT" VALIGN="TOP">4 </TD>



		<TD WIDTH="83" ALIGN="LEFT" VALIGN="TOP">4 </TD>



		<TD ALIGN="LEFT" VALIGN="TOP">Ready to send </TD>



	</TR>



	<TR ALIGN="LEFT" rowspan="1">



		<TD WIDTH="81" ALIGN="LEFT" VALIGN="TOP">5 </TD>



		<TD WIDTH="83" ALIGN="LEFT" VALIGN="TOP">5 </TD>



		<TD ALIGN="LEFT" VALIGN="TOP">Clear to send </TD>



	</TR>



	<TR ALIGN="LEFT" rowspan="1">



		<TD WIDTH="81" ALIGN="LEFT" VALIGN="TOP">6 </TD>



		<TD WIDTH="83" ALIGN="LEFT" VALIGN="TOP">20 </TD>



		<TD ALIGN="LEFT" VALIGN="TOP">Data set ready/data terminal ready </TD>



	</TR>



	<TR ALIGN="LEFT" rowspan="1">



		<TD WIDTH="81" ALIGN="LEFT" VALIGN="TOP">7 </TD>



		<TD WIDTH="83" ALIGN="LEFT" VALIGN="TOP">7 </TD>



		<TD ALIGN="LEFT" VALIGN="TOP">Ground </TD>



	</TR>



	<TR ALIGN="LEFT" rowspan="1">



		<TD WIDTH="81" ALIGN="LEFT" VALIGN="TOP">8 </TD>



		<TD WIDTH="83" ALIGN="LEFT" VALIGN="TOP">20 </TD>



		<TD ALIGN="LEFT" VALIGN="TOP">Carrier detect/data terminal ready </TD>



	</TR>



	<TR ALIGN="LEFT" rowspan="1">



		<TD WIDTH="81" ALIGN="LEFT" VALIGN="TOP">20 </TD>



		<TD WIDTH="83" ALIGN="LEFT" VALIGN="TOP">6, 8 </TD>



		<TD ALIGN="LEFT" VALIGN="TOP">Data terminal ready/data set ready, carrier detect </TD>



	</TR>



</TABLE>







</CENTER>



<P>Because most users want to purchase premade cables to connect remote terminals,



we won't deal with building your own cables. Instead, simply visit your local computer



store and explain the equipment at both ends, as well as whether you have DB9 (9-pin)



or DB25 (25-pin) connectors at each end. Also note whether the connectors at each



end are male (pins sticking out) or female (no pins). Usually, the PC has male serial



port connectors (requiring a female end on the cable), and a terminal has female



connectors (requiring a male connector on the cable); but, if you're connecting a



remote PC, you need female connectors at both ends.







<DL>



	<DT></DT>



</DL>











<DL>



	<DD>



<HR>



<A NAME="Heading25<FONT COLOR="#000077"><B>NOTE:</B> </FONT>If the wiring of



	a cable isn't clearly indicated and the vendor doesn't know whether it's a straight-through



	or null modem cable, you might need to purchase a null modem device. A null modem



	is a short connector that has the pin crossings within it, effectively converting



	a straight-through cable to a null modem cable, and vice versa.



<HR>







</DL>







<CENTER>



<H4><A NAME="Heading26<FONT COLOR="#000077">The Login Process</FONT></H4>



</CENTER>



<P>To understand the files involved in a terminal configuration, it is useful to



look at the process that occurs whenever a login occurs.</P>



<P>The process begins with the <TT>/etc/init</TT> daemon executing when the Linux



system is booted. The <TT>init</TT> daemon is responsible for running the <TT>/etc/getty</TT>



program for each terminal that is connected to the system. The <TT>init</TT> daemon



knows whether a terminal is connected because of entries in two files: <TT>/etc/ttys</TT>



and <TT>/etc/inittab</TT>. The <TT>/etc/ttys</TT> file lists all ports on the system



and the type of terminal that is connected. The <TT>/etc/inittab</TT> file has a



compete list of all terminals and their parameters. We'll look at both files in more



detail later, in the section &quot;Terminal Files: <TT>/etc/ttys</TT> and <TT>/etc/inittab</TT>.&quot;</P>



<P>When the <TT>/etc/ttys</TT> and <TT>/etc/inittab</TT> files indicate that a terminal



is connected and active, the <TT>init</TT> daemon runs the <TT>/etc/getty</TT> program



for that terminal. The <TT>getty</TT> program sets the communications parameters



for the terminal and displays the login prompt on the screen.</P>



<P>When a user logs in on the terminal, the <TT>getty</TT> process executes the login



program to request a password. The login program then validates the username and



password against the entries in the <TT>/etc/passwd</TT> file. If the login is valid,



the login program displays the message of the day (stored in the file <TT>/etc/motd</TT>)



and executes whatever shell the user is supposed to run (as specified in <TT>/etc/passwd</TT>).



Finally, login sets the <TT>TERM</TT> environment variable and exits.</P>



<P>When the login process terminates, the shell continues to execute and reads the



startup files; then, it generates the shell prompt and waits for the user to issue



instructions.</P>



<P>As you have seen, many files are involved in the startup process, all in the <TT>/etc</TT>



directory. We can look at the important files (at least for terminal characteristics)



in more detail.



<CENTER>



<H4><A NAME="Heading27<FONT COLOR="#000077">What Are /sbin/getty and /etc/gettydefs?</FONT></H4>



</CENTER>



<P>The <TT>sbin/getty</TT> (<TT>/etc/getty</TT> on some systems<TT>)</TT> program



is referred to quite a lot when dealing with terminals, but people often don't clearly



understand what the program does. Quite simply, <TT>/sbin/getty</TT> is a binary



program that sets the communications parameters between Linux and a terminal, including



the speed, protocol, and any special handling of the cable.</P>



<P>The <TT>/sbin/getty</TT> program is called by <TT>/etc/init</TT> when a user is



logging in. When called, <TT>/sbin/getty</TT> opens the serial port or other connection



to the terminal and sets the communications parameters based on information in the



file <TT>/etc/gettydefs</TT> (<TT>getty</TT> definitions). The <TT>getty</TT> process



then generates the login prompt on the remote terminal.</P>



<P>Many special handling and command options are available with the <TT>getty</TT>



process, but most of them are of little interest to users and casual system administrators.



If you want complete information on the <TT>getty</TT> command, consult the man pages



that accompany Linux.</P>



<P>The <TT>/etc/gettydefs</TT> file is used to supply the settings <TT>getty</TT>

⌨️ 快捷键说明

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