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

📄 unx02.htm

📁 Linux Unix揭密.高质量电子书籍.对学习Linux有大帮助,欢迎下载学习.
💻 HTM
📖 第 1 页 / 共 4 页
字号:

you make a mistake entering your old password, or if the two new password entries are not identical, then no change is made. Your old password is still in effect. Unless you make the same mistake both times that you enter the new password, you are in no 
danger of erroneously changing your password.

<BR></P>

<H3 ALIGN="CENTER">

<CENTER><A ID="I18" NAME="I18">

<FONT SIZE=4><B>Working on the System</B>

<BR></FONT></A></CENTER></H3>

<P>Most keys on the keyboard are fairly obvious. If you type the S key, an s character appears on your screen. If you hold down the Shift key and type the S key, a capital s character (S) appears on your screen. In addition to the letters and digits, the 
symbols, some of which are above the digits, are familiar&#151;such as the percent sign (%) and the comma (,). There are some UNIX and system-specific special characters in addition to these, which you should become familiar with. They will help you manage 

your work and typing more effectively. The general type of character is called a control character. The name comes from the way in which you type them. First, locate the Control key&#151;there should be one or maybe two on your keyboard. It may be labeled 

Ctrl or some other abbreviation of the word Control. This key is used like the Shift key. You press it but don't release it. While the Control key is depressed, you type another key, often a letter of the alphabet. If you type the Q key while the Control 
key is held, this is called Control+Q, and is commonly written ^Q (the caret symbol, which is found above the digit 6, followed by the alphabetic character).

<BR></P>

<HR ALIGN=CENTER>

<NOTE>

<IMG SRC="note.gif" WIDTH = 35 HEIGHT = 35><B>NOTE:</B> When you see the notation ^Q, this does NOT mean to hold the Control and Shift down while pressing Q. All you do is to hold down the Control key while pressing Q.

<BR></NOTE>

<HR ALIGN=CENTER>

<P>UNIX uses these control keys for various common keyboard actions. They can come in very handy. But the hard part is that different systems have different default Control key settings for these actions. Therefore, first you should find out what your 
current settings are, and then you can change them if you wish. In order to look at what your current settings are, use the stty command. Enter stty -a at your command prompt and look at the results. Refer to the next example for an output of this command.



<BR></P>

<HR ALIGN=CENTER>

<NOTE>

<IMG SRC="imp.gif" WIDTH = 68 HEIGHT = 35><B>TIP: </B>If you're typing and nothing is showing on your screen, a ^S (or stop control character) inadvertently may have been typed. Try typing ^Q (or start control character) and see whether your typed 
characters now appear.

<BR></NOTE>

<HR ALIGN=CENTER>

<PRE>$ stty -a

speed 9600 baud; line = 0; susp &lt;undef&gt;; dsusp &lt;undef&gt;

rows = 44; columns = 120

intr = ^C; quit = ^\; erase = ^H; kill = ^X; swtch &lt;undef&gt;

eof = ^D; eol = ^@; min = 4; time = 0; stop = ^S; start = ^Q

-parenb -parodd cs8 -cstopb hupcl cread -clocal -loblk -crts 

-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl -iuclc 

ixon -ixany -ixoff -rtsxoff -ctsxon -ienqak 

isig icanon iexten -xcase echo echoe echok -echonl -noflsh 

opost -olcuc onlcr -ocrnl -onocr -onlret -ofill -ofdel -tostop tab3 

$</PRE>

<P>Referring to the preceding example of stty output, look for the section that has the words erase, kill, and eof. Associated with each word is a control character. Find the similar part of your stty output. Keep this handy as you read the next topics.

<BR></P>

<H4 ALIGN="CENTER">

<CENTER><A ID="I19" NAME="I19">

<FONT SIZE=3><B>Erase</B>

<BR></FONT></A></CENTER></H4>

<P>Look at the word erase in the stty output. Next to this word is ^H (verbalized as Control+H). Therefore, on my system, Erase, which means to back up over the last character typed, is done by typing ^H. The Erase key is how you can fix your typing 
errors. Remember to look at your stty -a output because your system may be configured differently than this example. Try it out on your system. First, type a character you wish to erase, say, an A. Now type your Control, Backspace, or Delete key associated 

with your Erase. If everything goes right, your cursor should have backed up to be on top of your A and the next key you type will be where the A was. Try typing a correct series of keys, say date&lt;Return&gt;, to make sure that the control character 
actually worked. If you get a message similar to &quot;A^Hdate not found&quot;, then Erase is not working. To make it work correctly, pick the key you want associated with Erase and input the following (assuming that you have picked the backspace key):

<BR></P>

<PRE>$ stty erase '^H'

$</PRE>

<P>Now, try entering the date command again and deleting the A in dAte and replacing it with a.

<BR></P>

<HR ALIGN=CENTER>

<NOTE>

<IMG SRC="note.gif" WIDTH = 35 HEIGHT = 35><B>NOTE:</B> Depending on your display, erasing characters may not actually make the character disappear. Instead, it may reposition the cursor so that the next keystroke overwrites the character.

<BR></NOTE>

<HR ALIGN=CENTER>

<P>The Erase key is one of the most used control keys, because typing without mistakes is difficult to do. Therefore, most keyboards have one or more special keys that are suited to this job. Look for keys labeled &quot;Delete&quot; or 
&quot;Backspace.&quot; One of these usually works as an erase key. Try typing some characters and seeing what happens when you then press Backspace or Delete. Normally the Backspace key is set up to be ^H, so, if your erase is configured to be ^H, 
Backspace most likely will work.

<BR></P>

<H4 ALIGN="CENTER">

<CENTER><A ID="I20" NAME="I20">

<FONT SIZE=3><B>Kill</B>

<BR></FONT></A></CENTER></H4>

<P>The Kill control character is similar to the Erase control character, in that it allows you to back up over typing mistakes. Whereas Erase backs up one character at a time, Kill backs up all the way to the prompt. Therefore, if you are typing a really 
long command and you realize, toward the end, that you forgot to do some other command first, you can start over by typing the control character associated with Kill. If you can't see what your Kill is set to, redo the stty command. In the stty output 
example, the system has kill set to ^X. Again, remember that your system can be configured differently than this example. Now, try typing several characters followed by your Kill control character and see what happens. All the characters should be erased 
and your cursor should be after the prompt.

<BR></P>

<H4 ALIGN="CENTER">

<CENTER><A ID="I21" NAME="I21">

<FONT SIZE=3><B>Stop and Start</B>

<BR></FONT></A></CENTER></H4>

<P>Two other commonly used control characters are Stop and Start. Their normal values are ^S and ^Q, respectively. Stop allows you to temporarily pause what is happening on your screen, and Start allows you to resume activity following a stop. This is 
useful if text is scrolling on your screen too fast for you to read. The Stop control character will pause the scrolling indefinitely so that you can read at your leisure. You might try this during your next login while the Message of the Day is scrolling 

by (see the section earlier in this chapter called &quot;Logging In&quot;). But remember to be prepared and be swift, because that text can scroll by quite quickly. Try to stop the scrolling, and then don't forget to continue the scrolling by typing your 
Start control character.

<BR></P>

<HR ALIGN=CENTER>

<NOTE>

<IMG SRC="note.gif" WIDTH = 35 HEIGHT = 35><B>NOTE:</B> On modern GUIs and high-speed connections Stop and Start give very poor control of output. This is because the output is so fast an entire screen may go by before you type the Stop character.

<BR></NOTE>

<HR ALIGN=CENTER>

<H4 ALIGN="CENTER">

<CENTER><A ID="I22" NAME="I22">

<FONT SIZE=3><B>eof</B>

<BR></FONT></A></CENTER></H4>

<P>The eof control character is used to signal the end of input. The letters eof come from end of file. The normal value of the eof control character is ^D, but be sure to verify this using the stty command. You can see how the eof character is used in the 

section called &quot;Redirecting Input and Output&quot; earlier in this chapter.

<BR></P>

<P>There are several other control characters that we will not look at here. You should refer to the stty command in your system documentation for information. Or better yet, keep reading because we will show you how to find information about commands via 

the UNIX online help facility.

<BR></P>

<P>The stty command is also used to set the value of control characters. You can simply enter stty erase '^H' to change your Erase character to Backspace. Do not enter a Control+H here; rather, enter '^H'. Some shells, including the original Bourne shell, 

treat the caret specially, so you may need the quotes. (Double quotation marks would also work in this example.) Try changing the value of your Erase control character and then use the stty -a command to make sure it happened.

<BR></P>

<HR ALIGN=CENTER>

<NOTE>

<IMG SRC="imp.gif" WIDTH = 68 HEIGHT = 35><B>TIP: </B>Remember that typing the end of file character to your shell might log you out of the system!

<BR></NOTE>

<HR ALIGN=CENTER>

<H3 ALIGN="CENTER">

<CENTER><A ID="I23" NAME="I23">

<FONT SIZE=4><B>Online Help</B>

<BR></FONT></A></CENTER></H3>

<P>One of the most important things to know about UNIX or any computer system is how to get help when you don't know how to use a command. Many commands will give you a usage message if you incorrectly enter the command. This message shows you the correct 

syntax for the command. This can be a quick reminder of the arguments and their order. For many commands, you can get the usage message by using the option -?. The usage message often does not give you any semantic information.

<BR></P>

<P>The UNIX command man is a powerful tool that gives you complete online access to the UNIX manuals. In its simplest form, the man command takes one argument, the name of the command or manual entry on which you need information. Try using the man command 

now&#151;perhaps you could use one of the previous commands you were interested in as the argument. Or, if you want to get a head start on this section, you might try entering man man to get information on the man help facility itself.

<BR></P>

<P>The manual entry is called a man page, even though it is often more than one page long. There are common sections to man pages. Depending on the command, some or all of the sections may be present. At the start of the man page is the Name. This is 
usually a one-liner that gives the command's name along with a phrase describing what it does. Next is the Synopsis, which gives the command's syntax including its arguments and options. In the Synopsis, if an argument is enclosed in square brackets ([]), 

then that argument is optional. If two elements of the syntax are separated with a vertical bar (|), then either one or the other (but not both) of the items is allowed.

<BR></P>

<PRE>$ man page</PRE>

<P>Depending on the man page, there are several more sections that you may see. A few of the more common are Description, Files, and See Also. The Description section contains the details of the command's usage. It describes each option, argument, and the 

interrelations and accepted values of each. This will help you to learn exactly how the command should be used. The Files section contains a list of the UNIX files used by this command. You may want to look at the contents of these files to help you 
understand some of the command's behaviors. The See Also section can be very important when you either want to learn more on a similar topic or don't have quite the right man page. This section lists pointers to related or dependent commands.

<BR></P>

<P>The man command has a very useful option, especially for users who are unfamiliar with UNIX. This option is -k and is used to find all commands that have to do with a word you supply following the -k. For instance, if you would like to find out 
information on printing, you might enter the command man -k print. The man command then searches a special database, called the whatis database, for commands and descriptions that contain the word print. During the search, if print or any word that 
contains print (such as printing) is found, this command is displayed on your screen. Therefore, the final result is a list of all commands having to do with print. Then you can use the man command to find out the details about any or all of the commands 
on this list. On some systems, another way to do this search is via the command apropos, which is equivalent to man -k.

<BR></P>

<P>Although having the complete set of manual entries online is extremely useful, it also takes a fairly large amount of disk space. One option that some people use to help lower the amount of disk space needed is to have the manual entries stored on one 
machine that everyone can access via the network. Because of this, the manual entries may not be stored in the directories expected. In order to show the man command where the entries are stored, you can set the MANPATH variable (see the section 
&quot;Viewing and Setting Environment Variables&quot; that appeared earlier in this chapter).

<BR></P>

<P>Another potential problem you might see when trying to use man has to do with the -k option. Recall that the -k option searches the whatis database for a keyword you specify. This works only if the system administrator has created this database ahead of 

time. The system administrator does this via the catman command. If the database has not yet been created, you will see an error regarding the whatis database not being found whenever you use the -k option (or the apropos command). Ask your system 
administrator to fix this.

<BR></P>

<H3 ALIGN="CENTER">

<CENTER><A ID="I24" NAME="I24">

<FONT SIZE=4><B>Summary</B>

<BR></FONT></A></CENTER></H3>

<P>The start of this chapter helped you prepare for what needs to happen before and during login. The section &quot;Configuring Your Environment&quot; looked at your environment and how you can configure it. Look at the manual entry for the shell you're 
using to find out more about environments. Also read Part II, &quot;Hunt for Shell,&quot; for shell details. The section on &quot;Managing Your Password&quot; discussed how managing your password via the passwd command is important for security reasons. 
Look at the manual entry for passwd if you need more information. The &quot;Working on the System&quot; section helped make your typing easier through the use of control characters. The stty man page is a good place to look for more information on control 

characters. The section on online help is probably the most important section of this chapter; by describing the man command, it showed you how to access the UNIX manual online. Using this, you can look up anything you want or need. The commands that you 
saw in the &quot;Using Commands&quot; section are in the online manual. Use the man command and learn more about them. With this as a start, you should be comfortable with the basics.

<BR></P>

<P><A HREF="unx01.htm"><IMG SRC="bluprev.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="Previous Page"></A>

<A HREF="index.htm"><IMG SRC="blutoc.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="TOC"></A>

<A HREF="unx03.htm"><IMG SRC="blunext.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="Next Page"></A>

<A HREF="index.htm"><IMG SRC="bluprev.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="Home"></A>

</P></BODY></HTML>

⌨️ 快捷键说明

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