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

📄 ch05_11.htm

📁 the unix power tools
💻 HTM
字号:
<HTML><!--Distributed by F --><HEAD><TITLE>[Chapter 5] 5.11 Initializing the Terminal with tset </TITLE><METANAME="DC.title"CONTENT="UNIX Power Tools"><METANAME="DC.creator"CONTENT="Jerry Peek, Tim O'Reilly &amp; Mike Loukides"><METANAME="DC.publisher"CONTENT="O'Reilly &amp; Associates, Inc."><METANAME="DC.date"CONTENT="1998-08-04T21:33:15Z"><METANAME="DC.type"CONTENT="Text.Monograph"><METANAME="DC.format"CONTENT="text/html"SCHEME="MIME"><METANAME="DC.source"CONTENT="1-56592-260-3"SCHEME="ISBN"><METANAME="DC.language"CONTENT="en-US"><METANAME="generator"CONTENT="Jade 1.1/O'Reilly DocBook 3.0 to HTML 4.0"><LINKREV="made"HREF="mailto:online-books@oreilly.com"TITLE="Online Books Comments"><LINKREL="up"HREF="ch05_01.htm"TITLE="5. Setting Up Your Terminal"><LINKREL="prev"HREF="ch05_10.htm"TITLE="5.10 Finding What Terminal Names You Can Use "><LINKREL="next"HREF="ch05_12.htm"TITLE="5.12 Initializing the Terminal with tput "></HEAD><BODYBGCOLOR="#FFFFFF"TEXT="#000000"><DIVCLASS="htmlnav"><H1><IMGSRC="gifs/smbanner.gif"ALT="UNIX Power Tools"USEMAP="#srchmap"BORDER="0"></H1><MAPNAME="srchmap"><AREASHAPE="RECT"COORDS="0,0,466,58"HREF="index.htm"ALT="UNIX Power Tools"><AREASHAPE="RECT"COORDS="467,0,514,18"HREF="jobjects/fsearch.htm"ALT="Search this book"></MAP><TABLEWIDTH="515"BORDER="0"CELLSPACING="0"CELLPADDING="0"><TR><TDALIGN="LEFT"VALIGN="TOP"WIDTH="172"><ACLASS="SECT1"HREF="ch05_10.htm"TITLE="5.10 Finding What Terminal Names You Can Use "><IMGSRC="gifs/txtpreva.gif"SRC="gifs/txtpreva.gif"ALT="Previous: 5.10 Finding What Terminal Names You Can Use "BORDER="0"></A></TD><TDALIGN="CENTER"VALIGN="TOP"WIDTH="171"><B><FONTFACE="ARIEL,HELVETICA,HELV,SANSERIF"SIZE="-1">Chapter 5<BR>Setting Up Your Terminal</FONT></B></TD><TDALIGN="RIGHT"VALIGN="TOP"WIDTH="172"><ACLASS="SECT1"HREF="ch05_12.htm"TITLE="5.12 Initializing the Terminal with tput "><IMGSRC="gifs/txtnexta.gif"SRC="gifs/txtnexta.gif"ALT="Next: 5.12 Initializing the Terminal with tput "BORDER="0"></A></TD></TR></TABLE>&nbsp;<HRALIGN="LEFT"WIDTH="515"TITLE="footer"></DIV><DIVCLASS="SECT1"><H2CLASS="sect1"><ACLASS="title"NAME="UPT-ART-0079">5.11 Initializing the Terminal with tset </A></H2><PCLASS="para"><ACLASS="indexterm"NAME="AUTOID-5610"></A>As you log in, especially if you're using a terminal that's shared withother users, it's a good idea to initialize your terminal(reset it to its default state).If your system has <EMCLASS="emphasis">termcap</EM>, use<SPANCLASS="link"><EMCLASS="emphasis">tset</EM> (<ACLASS="linkend"HREF="ch05_03.htm"TITLE="Setting the Terminal Type When You Log In ">5.3</A>)</SPAN>.On systems with <EMCLASS="emphasis">terminfo</EM>, use <SPANCLASS="link"><EMCLASS="emphasis">tput</EM> (<ACLASS="linkend"HREF="ch05_12.htm"TITLE="Initializing the Terminal with tput ">5.12</A>)</SPAN>.</P><PCLASS="para">In fact, despite its role in terminal type setting, you might saythat the&quot;proper&quot; function of <EMCLASS="emphasis">tset</EM> is to initializethe terminal. It outputs an initialization string(if one is defined in the terminal's <EMCLASS="emphasis">termcap</EM> entry),which should set the terminal to a reasonable state.In this role, it overlaps somewhat with<SPANCLASS="link"><EMCLASS="emphasis">stty</EM> (<ACLASS="linkend"HREF="ch41_03.htm"TITLE="Find Out Terminal Settings with stty ">41.3</A>, <ACLASS="linkend"HREF="ch05_09.htm"TITLE="Setting Your Erase, Kill, and Interrupt Characters ">5.9</A>)</SPAN>,settingthe erase and kill characters to CTRL-h and CTRL-x. (Options allowthe user to specify alternate values for these characters,as wellas for the interrupt character.)When done, it prints the following message:</P><PCLASS="para"><BLOCKQUOTECLASS="screen"><PRECLASS="screen">Erase is control-HKill is control-X</PRE></BLOCKQUOTE></P><PCLASS="para">(or whatever else you have set these characters to).This message <ACLASS="indexterm"NAME="AUTOID-5627"></A>can be suppressed by adding the <EMCLASS="emphasis">-Q</EM> (quiet) option.</P><PCLASS="para"><ACLASS="indexterm"NAME="AUTOID-5632"></A>A special form of the <EMCLASS="emphasis">tset</EM> command, called <EMCLASS="emphasis">reset</EM>,is found on some systems. In addition to <EMCLASS="emphasis">tset</EM>'snormal processing, it<SPANCLASS="link"> sets various <EMCLASS="emphasis">stty</EM> modes to what it considers a &quot;reasonable&quot; state . (<ACLASS="linkend"HREF="ch42_04.htm"TITLE="Checklist for Resetting a Messed Up Terminal ">42.4</A>, <ACLASS="linkend"HREF="ch42_02.htm"TITLE="Fixing a Hung Terminal or Job ">42.2</A>)</SPAN>It can thus be used to reset both the terminal and the serial line control parameters in cases where abombing program or user bungling has left the terminal in an unusable state.</P><PCLASS="para"> <ACLASS="indexterm"NAME="AUTOID-5640"></A>There are some cases in which normal end-of-line processing has been disabled, and the system will no longer perform thecarriage return to linefeed translation UNIX requires to work with most terminals. In these cases, you may need to type:</P><PCLASS="para"><BLOCKQUOTECLASS="screen"><PRECLASS="screen"><KBDCLASS="keycap">[CTRL-j]</KBD> <CODECLASS="userinput"><B>reset</B></CODE> <KBDCLASS="keycap">[CTRL-j]</KBD></PRE></BLOCKQUOTE></P><PCLASS="para"> to get <EMCLASS="emphasis">reset</EM> to work.</P><DIVCLASS="sect1info"><PCLASS="SECT1INFO">- <SPANCLASS="authorinitials">TOR</SPAN> <SPANCLASS="bibliomisc">from O'Reilly &amp; Associates' <CITECLASS="citetitle">termcap &amp; terminfo</CITE>, Chapter 4</SPAN></P></DIV></DIV><DIVCLASS="htmlnav"><P></P><HRALIGN="LEFT"WIDTH="515"TITLE="footer"><TABLEWIDTH="515"BORDER="0"CELLSPACING="0"CELLPADDING="0"><TR><TDALIGN="LEFT"VALIGN="TOP"WIDTH="172"><ACLASS="SECT1"HREF="ch05_10.htm"TITLE="5.10 Finding What Terminal Names You Can Use "><IMGSRC="gifs/txtpreva.gif"SRC="gifs/txtpreva.gif"ALT="Previous: 5.10 Finding What Terminal Names You Can Use "BORDER="0"></A></TD><TDALIGN="CENTER"VALIGN="TOP"WIDTH="171"><ACLASS="book"HREF="index.htm"TITLE="UNIX Power Tools"><IMGSRC="gifs/txthome.gif"SRC="gifs/txthome.gif"ALT="UNIX Power Tools"BORDER="0"></A></TD><TDALIGN="RIGHT"VALIGN="TOP"WIDTH="172"><ACLASS="SECT1"HREF="ch05_12.htm"TITLE="5.12 Initializing the Terminal with tput "><IMGSRC="gifs/txtnexta.gif"SRC="gifs/txtnexta.gif"ALT="Next: 5.12 Initializing the Terminal with tput "BORDER="0"></A></TD></TR><TR><TDALIGN="LEFT"VALIGN="TOP"WIDTH="172">5.10 Finding What Terminal Names You Can Use </TD><TDALIGN="CENTER"VALIGN="TOP"WIDTH="171"><ACLASS="index"HREF="index/idx_0.htm"TITLE="Book Index"><IMGSRC="gifs/index.gif"SRC="gifs/index.gif"ALT="Book Index"BORDER="0"></A></TD><TDALIGN="RIGHT"VALIGN="TOP"WIDTH="172">5.12 Initializing the Terminal with tput </TD></TR></TABLE><HRALIGN="LEFT"WIDTH="515"TITLE="footer"><IMGSRC="gifs/smnavbar.gif"SRC="gifs/smnavbar.gif"USEMAP="#map"BORDER="0"ALT="The UNIX CD Bookshelf Navigation"><MAPNAME="map"><AREASHAPE="RECT"COORDS="0,0,73,21"HREF="../index.htm"ALT="The UNIX CD Bookshelf"><AREASHAPE="RECT"COORDS="74,0,163,21"HREF="index.htm"ALT="UNIX Power Tools"><AREASHAPE="RECT"COORDS="164,0,257,21"HREF="../unixnut/index.htm"ALT="UNIX in a Nutshell"><AREASHAPE="RECT"COORDS="258,0,321,21"HREF="../vi/index.htm"ALT="Learning the vi Editor"><AREASHAPE="RECT"COORDS="322,0,378,21"HREF="../sedawk/index.htm"ALT="sed &amp; awk"><AREASHAPE="RECT"COORDS="379,0,438,21"HREF="../ksh/index.htm"ALT="Learning the Korn Shell"><AREASHAPE="RECT"COORDS="439,0,514,21"HREF="../lrnunix/index.htm"ALT="Learning the UNIX Operating System"></MAP></DIV></BODY></HTML>

⌨️ 快捷键说明

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