﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>IT博客-darkstax-随笔分类-linux系统</title><link>http://www.cnitblog.com/darkstax/category/2493.html</link><description>slackware linux</description><language>zh-cn</language><lastBuildDate>Fri, 30 Sep 2011 13:52:05 GMT</lastBuildDate><pubDate>Fri, 30 Sep 2011 13:52:05 GMT</pubDate><ttl>60</ttl><item><title>The grep Command</title><link>http://www.cnitblog.com/darkstax/archive/2007/11/07/35983.html</link><dc:creator>darkstax</dc:creator><author>darkstax</author><pubDate>Wed, 07 Nov 2007 08:36:00 GMT</pubDate><guid>http://www.cnitblog.com/darkstax/archive/2007/11/07/35983.html</guid><wfw:comment>http://www.cnitblog.com/darkstax/comments/35983.html</wfw:comment><comments>http://www.cnitblog.com/darkstax/archive/2007/11/07/35983.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/darkstax/comments/commentRss/35983.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/darkstax/services/trackbacks/35983.html</trackback:ping><description><![CDATA[<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>4.1. The grep Command</title>
<link rel="STYLESHEET" type="text/css" href="images/style.css">
<link rel="STYLESHEET" type="text/css" href="images/docsafari.css">
</head>
<body >
<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#e6e6e6">
<tr style="background-image: url(images/tile_back.gif);">
<td class="v2" align="left" width="30%">
<a href="ch04.html"><img src="images/previous.gif" width="70" height="19" border="0" align="absmiddle" alt="Previous Section"></a>
</td>
<td class="v2" align="center" width="40%">
<a href="main.html" style="color:white;text-decoration:none;text-underline:none">&nbsp;&lt;&nbsp;Day Day Up&nbsp;&gt;&nbsp;</a>
</td>
<td class="v2" align="right" width="30%">
<a href="ch04lev1sec2.html"><img src="images/next.gif" width="70" height="19" border="0" align="absmiddle" alt="Next Section"></a>
</td>
</tr>
</table>
<br>
<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td valign="top"><a NAME="ch04lev1sec1"></a><h3 class="docSection1Title">4.1. The <tt>grep</tt> Command</h3>
<a NAME="ch04lev2sec1"></a><h4 class="docSection2Title">4.1.1 The Meaning of <tt>grep</tt></h4>
<p class="docText">The name <tt>grep</tt> can be traced back to the <tt>ex</tt> editor. If you invoked that editor and wanted to search for a string, you would type at the <tt>ex</tt> prompt:<a NAME="ch04index08"></a></p>
<pre>
: /pattern/p
</pre><br>
<p class="docText">The first line containing the string <tt>pattern</tt> would be printed as "<tt>p</tt>" by the <tt>print</tt> command. If you wanted all the lines that contained <tt>pattern</tt> to be printed, you would type:</p>
<pre>
: g/pattern/p
</pre><br>
<p class="docText">When <tt>g</tt> precedes <tt>pattern</tt>, it means "all lines in the file," or "perform a global substitution."</p>
<p class="docText">Because the search pattern is called a <span class="docEmphasis">regular expression</span>, we can substitute <tt>RE</tt> for <tt>pattern</tt> and the command reads</p>
<pre>
: g/RE/p
</pre><br>
<p class="docText">And there you have it: the meaning of <tt>grep</tt> and the origin of its name. It means "<span class="docEmphStrong">g</span>lobally search for the <span class="docEmphStrong">r</span>egular <span class="docEmphStrong">e</span>xpression (<tt>RE</tt>) and <span class="docEmphStrong">p</span>rint out the line." The nice part of using <tt>grep</tt> is that you do not have to invoke an editor to perform a search, and you do not need to enclose the regular expression in forward slashes. It is much faster than using <tt>ex</tt> or <tt>vi</tt>.</p>
<a NAME="ch04lev2sec2"></a><h4 class="docSection2Title">4.1.2 How <tt>grep</tt> Works</h4>
<p class="docText">The <tt>grep</tt> command searches for a pattern of characters in a file or multiple files. If the pattern contains whitespace, it must be quoted. The pattern is either a quoted string or a single word,<sup class="docFootnote"><a class="docLink" HREF="#ch04fn01">[1]</a></sup> and all other words following it are treated as filenames. <tt>Grep</tt> sends its output to the screen and does not change or affect the input file in any way.<a NAME="ch04index09"></a></p><blockquote><p class="docFootnote"><sup><a NAME="ch04fn01">[1]</a></sup> A word is also called a token.</p></blockquote>
<p class="docText"><span class="docEmphStrong">FORMAT</span></p>
<pre>
<span class="docEmphStrong">grep word filename filename</span>
</pre><br>
<a NAME="ch04list01"></a><h5 class="docExampleTitle">Example 4.1. </h5>

<pre>
<span class="docEmphStrong">grep Tom /etc/passwd</span>
</pre><br>

<p class="docText"><span class="docEmphStrong">EXPLANATION</span></p>
<p class="docText"><tt>Grep</tt> will search for the pattern <tt>Tom</tt> in a file called <tt>/etc/passwd</tt>. If successful, the line from the file will appear on the screen; if the pattern is not found, there will be no output at all; and if the file is not a legitimate file, an error will be sent to the screen. If the pattern is found, <tt>grep</tt> returns an exit status of 0, indicating success; if the pattern is not found, the exit status returned is 1; and if the file is not found, the exit status is 2.<a NAME="ch04index10"></a></p>
<p class="docText">The <tt>grep</tt> program can get its input from a standard input or a pipe, as well as from files. If you forget to name a file, <tt>grep</tt> will assume it is getting input from standard input, the keyboard, and will stop until you type something. If coming from a pipe, the output of a command will be piped as input to the <tt>grep</tt> command, and if a desired pattern is matched, <tt>grep</tt> will print the output to the screen.</p>
<a NAME="ch04list02"></a><h5 class="docExampleTitle">Example 4.2. </h5>

<pre>
<span class="docEmphStrong">ps -ef | grep root</span>
</pre><br>

<p class="docText"><span class="docEmphStrong">EXPLANATION</span></p>
<p class="docText">The output of the ps command (<tt>ps 杄f</tt> displays all processes running on this system) is sent to <tt>grep</tt> and all lines containing <tt>root</tt> are printed.</p>
<a NAME="ch04lev2sec3"></a><h4 class="docSection2Title">4.1.3 Metacharacters</h4><a NAME="ch04index11"></a>
<p class="docText">A metacharacter is a character that represents something other than itself. <tt>^</tt> and <tt>$</tt> are examples of metacharacters.</p>
<p class="docText">The <tt>grep</tt> command supports a number of regular expression metacharacters (see <a class="docLink" HREF="#ch04table01">Table 4.1</a>) to help further define the search pattern. It also provides a number of options (see <a class="docLink" HREF="#ch04table02">Table 4.2</a>) to modify the way it does its search or displays lines. For example, you can provide options to turn off case sensitivity, display line numbers, display errors only, and so on.<a NAME="ch04index12"></a><a NAME="ch04index13"></a></p>
<a NAME="ch04list03"></a><h5 class="docExampleTitle">Example 4.3. </h5>

<pre>
<span class="docEmphStrong">grep -n  '^jack:' /etc/passwd</span>
</pre><br>

<a NAME="ch04table01"></a><p><table CELLSPACING="0" FRAME="hsides" RULES="none" CELLPADDING="5"><caption><h5 class="docTableTitle">Table 4.1. <tt>grep</tt>'s Regular Expression Metacharacters</h5></caption><colgroup><col width="104.5"><col width="143"><col width="77"><col width="225.5"></colgroup><thead><tr><th class="thead" scope="col" align="left" valign="top"><p class="docText"><span class="docEmphBoldItalic">Metacharacter</span></p></th><th class="thead" scope="col" align="left" valign="top"><p class="docText"><span class="docEmphBoldItalic">Function</span></p></th><th class="thead" scope="col" align="left" valign="top"><p class="docText"><span class="docEmphBoldItalic">Example</span></p></th><th class="thead" scope="col" align="left" valign="top"><p class="docText"><span class="docEmphBoldItalic">What It Matches</span></p></th></tr></thead><tr><td class="docTableCell" align="left" valign="top"><p class="docText"><tt>^</tt></p></td><td class="docTableCell" align="left" valign="top"><p class="docText">Beginning-of-line anchor</p></td><td class="docTableCell" align="left" valign="top"><p class="docText"><tt>'^love'</tt></p></td><td class="docTableCell" align="left" valign="top"><p class="docText">Matches all lines beginning with <tt>love</tt>.</p></td></tr><tr><td class="docTableCell" align="left" valign="top"><p class="docText"><tt>$</tt></p></td><td class="docTableCell" align="left" valign="top"><p class="docText">End-of-line anchor</p></td><td class="docTableCell" align="left" valign="top"><p class="docText"><tt>'love$'</tt></p></td><td class="docTableCell" align="left" valign="top"><p class="docText">Matches all lines ending with <tt>love</tt>.</p></td></tr><tr><td class="docTableCell" align="left" valign="top"><p class="docText"><tt>.</tt></p></td><td class="docTableCell" align="left" valign="top"><p class="docText">Matches one character</p></td><td class="docTableCell" align="left" valign="top"><p class="docText"><tt>'l..e'</tt></p></td><td class="docTableCell" align="left" valign="top"><p class="docText">Matches lines containing an <tt>l</tt>, followed by two characters, followed by an <tt>e</tt>.</p></td></tr><tr><td class="docTableCell" align="left" valign="top"><p class="docText"><tt>*</tt></p></td><td class="docTableCell" align="left" valign="top"><p class="docText">Matches zero or more characters preceding the asterisk</p></td><td class="docTableCell" align="left" valign="top"><p class="docText"><tt>' *love'</tt></p></td><td class="docTableCell" align="left" valign="top"><p class="docText">Matches lines with zero or more spaces, followed by the pattern <tt>love</tt>.</p></td></tr><tr><td class="docTableCell" align="left" valign="top"><p class="docText"><tt>[ ]</tt></p></td><td class="docTableCell" align="left" valign="top"><p class="docText">Matches one character in the set<a NAME="ch04index14"></a><a NAME="ch04index15"></a></p></td><td class="docTableCell" align="left" valign="top"><p class="docText"><tt>'[Ll]ove'</tt></p></td><td class="docTableCell" align="left" valign="top"><p class="docText">Matches lines containing <tt>love</tt> or <tt>Love</tt>.</p></td></tr><tr><td class="docTableCell" align="left" valign="top"><p class="docText"><tt>[^]</tt></p></td><td class="docTableCell" align="left" valign="top"><p class="docText">Matches one character not in the set</p></td><td class="docTableCell" align="left" valign="top"><p class="docText"><tt>'[^A朘]ove'</tt></p></td><td class="docTableCell" align="left" valign="top"><p class="docText">Matches lines <span class="docEmphasis">not</span> containing a character in the range <tt>A</tt> through <tt>K</tt>, followed by <tt>ove</tt>.</p></td></tr><tr><td class="docTableCell" align="left" valign="top"><p class="docText"><tt>\&lt;</tt></p></td><td class="docTableCell" align="left" valign="top"><p class="docText">Beginning-of-word anchor</p></td><td class="docTableCell" align="left" valign="top"><p class="docText"><tt>'\&lt;love'</tt></p></td><td class="docTableCell" align="left" valign="top"><p class="docText">Matches lines containing a word that begins with <tt>love</tt>.</p></td></tr><tr><td class="docTableCell" align="left" valign="top"><p class="docText"><tt>\&gt;</tt></p></td><td class="docTableCell" align="left" valign="top"><p class="docText">End-of-word anchor</p></td><td class="docTableCell" align="left" valign="top"><p class="docText"><tt>'love\&gt;'</tt></p></td><td class="docTableCell" align="left" valign="top"><p class="docText">Matches lines containing a word that ends with <tt>love</tt>.</p></td></tr><tr><td class="docTableCell" align="left" valign="top"><p class="docText"><tt>\(..\)</tt></p></td><td class="docTableCell" align="left" valign="top"><p class="docText">Tags matched characters</p></td><td class="docTableCell" align="left" valign="top"><p class="docText"><tt>'\(love\)ing'</tt></p></td><td class="docTableCell" align="left" valign="top"><p class="docText">Tags marked portion in a register to be remembered later as number 1. To reference later, use <tt>\1</tt> to repeat the pattern. May use up to nine tags, starting with the first tag at the leftmost part of the pattern. For example, the pattern love is saved in register 1 to be referenced later as <tt>\1</tt>.</p></td></tr><tr><td class="docTableCell" align="left" valign="bottom">
<a NAME="PLID7"></a><div class="v1"></div><pre>
x\{m\}
x\{m,\}
x\{m,n\}<sup class="docFootnote"><a class="docLink" HREF="#ch04tn01">[a]</a></sup>
</pre><br>
</td><td class="docTableCell" align="left" valign="top"><p class="docText">Repetition of character x: m times, at least m times, or between m and n times</p></td><td class="docTableCell" align="left" valign="bottom">
<pre>
'o\{5\}'
'o\{5,\}'
'o\{5,10\}'
</pre><br>
</td><td class="docTableCell" align="left" valign="top"><p class="docText">Matches if line has 5 occurences of <tt>o</tt>, at least 5 occurences of <tt>o</tt>, or between 5 and 10 occurrences of <tt>o</tt>.</p></td></tr></table></p><br><blockquote><p class="docFootnote"><sup><a NAME="ch04tn01">[a]</a></sup> The <tt>\{ \}</tt> metacharacters are not supported
<img BORDER="0" width="14" height="9" ALIGN="left" SRC="images/ccc.gif" ALT=""> on all versions of UNIX or all pattern-matching
<img BORDER="0" width="14" height="9" ALIGN="left" SRC="images/ccc.gif" ALT=""> utilities; they usually work with <tt>vi</tt> and <tt>grep</tt>.</p></blockquote>
<a NAME="ch04table02"></a><p><table CELLSPACING="0" FRAME="hsides" RULES="none" CELLPADDING="5"><caption><h5 class="docTableTitle">Table 4.2. <tt>grep</tt>'s Options</h5></caption><colgroup><col width="60.5"><col width="489.5"></colgroup><thead><tr><th class="thead" scope="col" align="left" valign="top"><p class="docText"><span class="docEmphBoldItalic">Option</span></p></th><th class="thead" scope="col" align="left" valign="top"><p class="docText"><span class="docEmphBoldItalic">What It Does</span></p></th></tr></thead><tr><td class="docTableCell" align="left" valign="top"><p class="docText"><tt>朾</tt></p></td><td class="docTableCell" align="left" valign="top"><p class="docText">Precedes each line by the block number on which it was found. This is sometimes useful in locating disk block numbers by context.<a NAME="ch04index16"></a></p></td></tr><tr><td class="docTableCell" align="left" valign="top"><p class="docText"><tt>朿</tt></p></td><td class="docTableCell" align="left" valign="top"><p class="docText">Displays a count of matching lines rather than displaying the lines that match.<a NAME="ch04index17"></a></p></td></tr><tr><td class="docTableCell" align="left" valign="top"><p class="docText"><tt>杊</tt></p></td><td class="docTableCell" align="left" valign="top"><p class="docText">Does not display filenames.<a NAME="ch04index18"></a></p></td></tr><tr><td class="docTableCell" align="left" valign="top"><p class="docText"><tt>杋</tt></p></td><td class="docTableCell" align="left" valign="top"><p class="docText">Ignores the case of letters in comparisons (i.e., upper- and lowercase are considered identical).<a NAME="ch04index19"></a></p></td></tr><tr><td class="docTableCell" align="left" valign="top"><p class="docText"><tt>杔</tt></p></td><td class="docTableCell" align="left" valign="top"><p class="docText">Lists only the names of files with matching lines (once), separated by newline characters.<a NAME="ch04index20"></a></p></td></tr><tr><td class="docTableCell" align="left" valign="top"><p class="docText"><tt>杗</tt></p></td><td class="docTableCell" align="left" valign="top"><p class="docText">Precedes each line by its relative line number in the file. <a NAME="ch04index21"></a></p></td></tr><tr><td class="docTableCell" align="left" valign="top"><p class="docText"><tt>杝</tt></p></td><td class="docTableCell" align="left" valign="top"><p class="docText">Works silently, that is, displays nothing except error messages. This is useful for checking the exit status.<a NAME="ch04index22"></a></p></td></tr><tr><td class="docTableCell" align="left" valign="top"><p class="docText"><tt>杤</tt></p></td><td class="docTableCell" align="left" valign="top"><p class="docText">Inverts the search to display only lines that do not match.<a NAME="ch04index23"></a></p></td></tr><tr><td class="docTableCell" align="left" valign="top"><p class="docText"><tt>杦</tt></p></td><td class="docTableCell" align="left" valign="top"><p class="docText">Searches for the expression as a word, as if surrounded by <tt>\&lt;</tt> and <tt>\&gt;</tt>. This applies to <tt>grep</tt> only. (Not all versions of <tt>grep</tt> support this feature; e.g., SCO UNIX does not.)<a NAME="ch04index24"></a></p></td></tr></table></p><br>
<p class="docText"><span class="docEmphStrong">EXPLANATION</span></p>
<p class="docText"><tt>Grep</tt> searches the <tt>/etc/passwd</tt> file for <tt>jack</tt>; if <tt>jack</tt> is at the beginning of a line, <tt>grep</tt> prints out the number of the line on which <tt>jack</tt> was found and where in the line <tt>jack</tt> was found.</p>
<a NAME="ch04lev2sec4"></a><h4 class="docSection2Title">4.1.4 <tt>grep</tt> and Exit Status</h4>
<p class="docText">The <tt>grep</tt> command is very useful in shell scripts, because it always returns an exit status to indicate whether it was able to locate the pattern or the file you were looking for. If the pattern is found, <tt>grep</tt> returns an exit status of 0, indicating success; if <tt>grep</tt> cannot find the pattern, it returns 1 as its exit status; and if the file cannot be found, <tt>grep</tt> returns an exit status of 2. (Other UNIX utilities that search for patterns, such as <tt>sed</tt> and <tt>awk</tt>, do not use the exit status to indicate the success or failure of locating a pattern; they report failure only if there is a syntax error in a command.)<a NAME="ch04index25"></a><a NAME="ch04index26"></a></p>
<p class="docText">In the following example, <tt>john</tt> is not found in the <tt>/etc/passwd</tt> file.</p>
<a NAME="ch04list04"></a><h5 class="docExampleTitle">Example 4.4. </h5>

<pre>
1   % <span class="docEmphStrong">grep 'john' /etc/passwd</span>          <span class="docEmphasis"># john is not in the passwd file</span>
2   % <span class="docEmphStrong">echo $status</span>      <span class="docEmphasis">(csh)</span>
    <span class="docEmphasis">1</span>
</pre><br>

<p class="docText">or</p>

<pre>
2   $ <span class="docEmphStrong">echo $?</span>           <span class="docEmphasis">(sh, ksh)</span>
     <span class="docEmphasis">1</span>
</pre><br>

<p class="docText"><span class="docEmphStrong">EXPLANATION</span></p>
<div style="font-weight:bold"><ol class="docList" TYPE="1"><li><div style="font-weight:normal"><p class="docList"><tt>Grep</tt> searches for <tt>john</tt> in the <tt>/etc/passwd</tt> file, and if successful, <tt>grep</tt> exits with a status of 0. If <tt>john</tt> is not found in the file, <tt>grep</tt> exits with 1. If the file is not found, an exit status of 2 is returned.</p></div></li><li><div style="font-weight:normal"><p class="docList">The C shell variable, <tt>status</tt>, and the Bourne/Korn shell variable, ?, are assigned the exit status of the last command that was executed.</p></div></li></ol></div>
<ul></ul></td></tr></table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#e6e6e6">
<tr style="background-image: url(images/tile_back.gif);">
<td class="v2" align="left" width="30%">
<a href="ch04.html"><img src="images/previous.gif" width="70" height="19" border="0" align="absmiddle" alt="Previous Section"></a>
</td>
<td class="v2" align="center" width="40%">
<a href="main.html" style="color:white;text-decoration:none;text-underline:none">&nbsp;&lt;&nbsp;Day Day Up&nbsp;&gt;&nbsp;</a>
</td>
<td class="v2" align="right" width="30%">
<a href="ch04lev1sec2.html"><img src="images/next.gif" width="70" height="19" border="0" align="absmiddle" alt="Next Section"></a>
</td>
</tr>
</table>
</body>
</html><img src ="http://www.cnitblog.com/darkstax/aggbug/35983.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/darkstax/" target="_blank">darkstax</a> 2007-11-07 16:36 <a href="http://www.cnitblog.com/darkstax/archive/2007/11/07/35983.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>slackware linux 中文环境设置（step by step）</title><link>http://www.cnitblog.com/darkstax/archive/2006/11/17/19274.html</link><dc:creator>darkstax</dc:creator><author>darkstax</author><pubDate>Fri, 17 Nov 2006 14:57:00 GMT</pubDate><guid>http://www.cnitblog.com/darkstax/archive/2006/11/17/19274.html</guid><wfw:comment>http://www.cnitblog.com/darkstax/comments/19274.html</wfw:comment><comments>http://www.cnitblog.com/darkstax/archive/2006/11/17/19274.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/darkstax/comments/commentRss/19274.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/darkstax/services/trackbacks/19274.html</trackback:ping><description><![CDATA[控制台<br /><br />　　先把控制台的中文弄出来吧。虽然选择很多，不过我还是喜欢cce，安装使用都很简单，运行cce，出中文了。祭起lynx四处转了一圈，工作正常。<br /><br />X<br /><br />　　X要出中文就简单多了。到/etc/profile里把export LC_ALL=POSIX改成<br />export LC_ALL=<br />export LC_LANG=zh_CN.GB2312<br />然后startx，果然已经有些中文字了。<br /><br />　　然后改/etc/X11/XF86Config，加上<br />Section "InputDevice"<br />Identifier "Mouse1"<br />Driver "mouse"<br />Option "Protocol" "IMPS/2"<br />Option "Device" "/dev/input/mice"<br />Option "ZAxisMapping" "4 5"<br />Option "Buttons" "5"<br />EndSection<br />再把ServerLayout里的Mouse改成<br />InputDevice "Mouse1" "CorePointer"<br />再启动X，结果，X说找不到这个鼠标。有点妖。经过一番狂搜，发觉是还有个模块要启：<br />modprobe mousedev<br />ok,己可用了,把这三个modprobe加到/etc/rc.d/rc.modules里。<br /><br />　　俺的这个笔记本内置有一个鼠标，在windows底下两个可以同时用的。在X底下要是也能同时用就爽了。在InputDevice部份再定义一个鼠标(Mouse1)，<br />Section "InputDevice"<br />Identifier "Mouse1"<br />Driver "mouse"<br />Option "Protocol" "IMPS/2"<br />Option "Device" "/dev/input/mice"<br />Option "ZAxisMapping" "4 5"<br />Option "Buttons" "5"<br />EndSection<br />在ServerLayout部份加上<br />InputDevice "Mouse1" "CorePointer"<br />InputDevice "Mouse1" "SendCoreEvents"<br />然后起X，好，这回两鼠标都用上了。 <br /><br />TTF<br /><br />　　X里虽然出中文了，但是难看点。还是弄成TrueType吧。先找来ttf字体文件，就放到/usr/X11/lib/X11/font/ttf里并加到XF86Config的fontpath里。然后搞来并装上freetype1.3和ttmkfdir，本来想耍ft2的，结果用它没法子编译俺下的这个ttmkfdir，又不打算花太多时间折腾，只好退回1.3，还算顺利。然后到ttf目录里ttmkfdir &gt;fonts.dir,进去把每行都复制出*-iso8859-1,*-ascII-0,*-gb2312.1980-0三种，当然第一行的总字体数自然要乘3。然后cp fonts.dir fonts.scale。再启X，祭起xfontsel，果然用kaiti_gb2312等字体了。<br /><br />最后, 俺发现XFree86 4.1.0里面带的freetype居然不支持中文ttf,那么咱只好换xtt了,还好,xtt特顺利. 后来发现俺新装的freetype1.3是可以处理中文的,要用新编译的库文件换调/usr/X11/lib底下的libfreetype*,不过,既然xtt工作,何必再折腾自己呢?<br /><br />　　下一步当然是把GNome的默认字体换成ttf啦，于是在硬盘里一顿乱找，发现/etc/opt/gnome里有俺要的东东，把其下gtk/gtkrc.zh_CN里的所有fontset前面塞上一个KaiTi_GB2312。再找，发现/opt/gnome/etc/gtk底下居然也有一个，自然改之。再看，/opt/gnome/share底下也有，再改，虽然这个其实没什么影响。再startx，不错，全是矢量字啦。<br /><br /><img src ="http://www.cnitblog.com/darkstax/aggbug/19274.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/darkstax/" target="_blank">darkstax</a> 2006-11-17 22:57 <a href="http://www.cnitblog.com/darkstax/archive/2006/11/17/19274.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>slackware 11.0 安装和设置(step by step)</title><link>http://www.cnitblog.com/darkstax/archive/2006/11/09/18996.html</link><dc:creator>darkstax</dc:creator><author>darkstax</author><pubDate>Thu, 09 Nov 2006 06:04:00 GMT</pubDate><guid>http://www.cnitblog.com/darkstax/archive/2006/11/09/18996.html</guid><wfw:comment>http://www.cnitblog.com/darkstax/comments/18996.html</wfw:comment><comments>http://www.cnitblog.com/darkstax/archive/2006/11/09/18996.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/darkstax/comments/commentRss/18996.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/darkstax/services/trackbacks/18996.html</trackback:ping><description><![CDATA[<p>实验室以前装的slackware启动不了了，所以我重新安装了slackware 11.0。安装期间我把安装过程详细地记录下来，希望作为slackware&#8220;手把手&#8221;的安装方案。<br><br><br>第一步：了解安装环境<br><br>安装系统首先要了解你的系统安装环境，如果事先安装了windows操作系统，则可以从windows系统里得知你的硬件环境。方法为在运行对话框里输入：<br>dxdiag<br>这时，会显示系统的基本信息。从中我们可以得到显卡，磁盘等重要的信息。<br><br>安装环境：<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;系统：slackware 11.0<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 处理器：Intel(R) Pentium(R) 4 CPU 3.00GHz (2 CPUs)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;内存：1024MB RAM<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;显卡：RADEON X300/X550 Series<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 制造商：ATI Technologies Inc.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;显存：256.0 MB<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 显示模式：1280&#215;1024 (32bit) (75Hz)<br>&nbsp;&nbsp;&nbsp; 磁盘控制器：ATA Storage Controllers<br><br>知道这些安装环境，对我们以后的安装（如选择内核，安装显卡驱动等）有很大的帮助。<br><br>第二步：预安装<br><br>现在的电脑尤其是实验室的电脑，一般都没有软驱和光驱，这样我们只能通过硬盘或者网络安装来实现我们的目的。网络安装对网络环境要求较高，我还没有试过。这里所描述的均为从硬盘安装。<br><br>上面说过，由于电脑没有软驱和光驱，我们只好从U盘启动。首先准备一张没有重要数据的U盘，将其接入电脑。为了制作一张U盘启动盘，我们介绍一个实用的小工具，liubenBootU，只有250K大小。启动后，工作模式选择ZIP模式，点击&#8220;开始&#8221;，它将格式化U盘并将dos环境拷入到U盘中。这样，我们从U盘启动后将直接进入纯dos环境。<br><br>待会儿进入dos后我们需要用grub加载内核，那么grub放在哪里呢？放在硬盘上，当然可以。不过要是就放在这个U盘上不是更方便吗？嘿嘿，我们干脆把slackware第一张盘里解压出来的内核文件bzImage和initrd.img也放在这个U盘上，这样从grub启动后就可以直接加载内核文件安装系统了。当然，系统安装文件是放在硬盘上的。如果你有那么大的U盘，放在U盘上也未尝不可啊。:-) 这里还要注意一点，由于我们的硬盘是串行硬盘，选择内核时要注意了，需要支持硬盘类型的内核，否则加载内核后不能识别硬盘，安装就无法继续了。我选择的是sata.i内核文件。<br><br>启动盘做好了，我们还需要修改主板设置，将其设置为从U盘启动。现在的各种主板型号不同，功能也不相同，多数还是支持从U盘启动的。如果不支持，那就没办法了。首先插入U盘，这一步很重要，如果现在没有插入U盘，在主板BIOS选项里将不会出现U盘这一选项。进入主板BIOS，选择boot菜单，一般都是在这里设置。我用的主板BIOS系统在这个菜单下有两个选项，一个为&#8220;boot device priority&#8221;，另一个为&#8220;removable devices&#8221;。在&#8220;removable devices&#8221;里我们将首选项设置为我们的U盘名字，我这里为&#8220;se at land&#8221;，然后进入&#8220;boot device priority&#8221;将首选项设置为从U盘启动，这样就设置完毕。<br><br>第三步：硬盘安装<br><br>从U盘启动后，进入dos系统，我们找到grub目录，进入后直接敲grub命令，将会启动grub（grub的详细介绍请看这里）。然后选择内核文件和根分区镜像文件，进入系统安装。<br><br>在安装之前，我们首先要将磁盘分好区。用命令<br>fdisk -l<br>查看磁盘的状态，然后按照提示分区。最少要增加两个分区，一个为swap分区，大小为内存大小的两倍，另一个为根分区，大小自定义。<br><br>分完区后就可以使用命令<br>setup<br>安装文件系统。安装过程很容易，随着它的提示一步一步来就可以了，具体的过程就不在赘述。这里只注意一点，当要求选择安装方式时，要选择从硬盘安装。硬盘必须为fat分区，不能为ntfs分区，安装内核不能识别ntfs格式。安装文件不是镜像文件，而是每个镜像文件解压后的slackware目录。安装程序将安装这个目录中所有的后缀为.tar.gz格式的软件包。第三张盘为支持kde桌面系统的多国语言包，只需要安装中文字体文件即可。<br><br>安装完毕后，用lilo重写MBR。再经过一些简单的设置，slackware系统就安装成功了。<br><br>第四步：系统设置<br><br>安装完系统后，需要一些初始的系统设置，还要安装一些驱动程序和使用工具。具体请参考文章<a href="http://www.cnitblog.com/darkstax/archive/2006/10/20/18184.html">slackware初始设置</a>。</p>
<p>现在，系统安装设置就算告于段落了。现在就开始享受slackware给你带来的快乐吧。:-)</p>
<img src ="http://www.cnitblog.com/darkstax/aggbug/18996.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/darkstax/" target="_blank">darkstax</a> 2006-11-09 14:04 <a href="http://www.cnitblog.com/darkstax/archive/2006/11/09/18996.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>slackware从10.2升级到11.0(step by step)</title><link>http://www.cnitblog.com/darkstax/archive/2006/11/08/18953.html</link><dc:creator>darkstax</dc:creator><author>darkstax</author><pubDate>Wed, 08 Nov 2006 01:35:00 GMT</pubDate><guid>http://www.cnitblog.com/darkstax/archive/2006/11/08/18953.html</guid><wfw:comment>http://www.cnitblog.com/darkstax/comments/18953.html</wfw:comment><comments>http://www.cnitblog.com/darkstax/archive/2006/11/08/18953.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/darkstax/comments/commentRss/18953.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/darkstax/services/trackbacks/18953.html</trackback:ping><description><![CDATA[
		<p>Slackware 10.2 to 11.0 Upgrade HOWTO  &lt;<a href="mailto:volkerdi@slackware.com">volkerdi@slackware.com</a>&gt;</p>
		<p>This document explains how to upgrade from Slackware 10.2 to Slackware 11.0</p>
		<p>-----------------------------------------------------------------------------</p>
		<p>
				<br />Before you begin, I would strongly recommend making a backup of your<br />system, or, if not the entire system, at least the /etc directory.  You<br />might find that you need to refer to a few things after the upgrade<br />process is complete. Back it up, or take your chances.</p>
		<p>OK, now that everything is safely backed up, let's proceed. :-)</p>
		<p>To do this, you'll need the Slackware 11.0 packages.  If these are on a CD,<br />create a new directory to mount the CD on so that it doesn't get in the<br />way during the upgrade:</p>
		<p>
				<strong>
						<font color="#000000">mkdir /packages<br />mount /dev/cdrom /packages</font>
				</strong>
		</p>
		<p>The packages don't have to be on a CD-ROM, as an alternative you could<br />copy the slackware directory (the one with the various package<br />subdirectories in it, basically the "slackware" directory from the install<br />CD) to someplace like /root/slackware/.  The important thing is that you<br />know where the slackware packages directory is.  We'll use /root/slackware<br />in the following examples.</p>
		<p>
				<br />0.  Put your machine in single-user mode:<br />    <strong>telinit 1</strong></p>
		<p>
				<br />1.  Upgrade your glibc shared libraries.  This is important, or things<br />    might go haywire during the first part of the upgrade:</p>
		<p>    <strong>upgradepkg /root/slackware/a/glibc-solibs-*.tgz</strong></p>
		<p>
				<br />2.  Upgrade your package utilities:</p>
		<p>    <strong>upgradepkg /root/slackware/a/pkgtools-*.tgz</strong></p>
		<p>
				<br />3.  Install sed.  You should already have this, but since it's used by<br />    the package utilities it is best to be sure:</p>
		<p>    <strong>upgradepkg <font style="BACKGROUND-COLOR: #ee82ee" color="#000000">--install-new</font> /root/slackware/a/sed-*.tgz</strong></p>
		<p>
				<br />4.  Upgrade everything else (and install new packages):<br /></p>
		<p>    <strong>upgradepkg <font style="BACKGROUND-COLOR: #ee82ee" color="#000000">--install-new</font> /root/slackware/*/*.tgz</strong></p>
		<p>
				<br />5.  Make sure your system will boot.  If you use LILO, make sure the<br />    paths in /etc/lilo.conf point to a valid kernel and then type 'lilo'<br />    to reinstall LILO.  If you use a bootdisk, you'll need to use<br />    makebootdisk to make a new bootdisk using the kernel in /boot.</p>
		<p>
				<br />6.  Fix your config files.  Some of the config files in /etc are going to <br />    need your attention.  You'll find the new incoming config files on <br />    your system with the ".new" extension.  You may need to fill these in <br />    with information from your old config files and then move them over.</p>
		<p>    Feel brave?  You can use this little script to install all of the<br />    .new config files in /etc.  If you've made any local changes you'll<br />    need to add them to the newly installed files.  Your old config files<br />    will be copied to *.bak.  Anyway, it might be an easier starting<br />    point.  Here it is:</p>
		<p> </p>
		<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
				<img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />
				<span style="COLOR: #000000">     </span>
				<span style="COLOR: #008000">#</span>
				<span style="COLOR: #008000">!/bin/sh</span>
				<span style="COLOR: #008000">
						<br />
						<img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />
				</span>
				<span style="COLOR: #000000">     cd </span>
				<span style="COLOR: #000000">/</span>
				<span style="COLOR: #000000">etc<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />     find </span>
				<span style="COLOR: #000000">.</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000">name </span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">*.new</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">|</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #0000ff">while</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #0000ff">read</span>
				<span style="COLOR: #000000"> configfile ; </span>
				<span style="COLOR: #0000ff">do</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />       </span>
				<span style="COLOR: #0000ff">if</span>
				<span style="COLOR: #000000"> [ </span>
				<span style="COLOR: #000000">!</span>
				<span style="COLOR: #000000"> </span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">$configfile</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">./rc.d/rc.inet1.conf.new</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">\</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />         </span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000">a </span>
				<span style="COLOR: #000000">!</span>
				<span style="COLOR: #000000"> </span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">$configfile</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">./group.new</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">\</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />         </span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000">a </span>
				<span style="COLOR: #000000">!</span>
				<span style="COLOR: #000000"> </span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">$configfile</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">./passwd.new</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">\</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />         </span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000">a </span>
				<span style="COLOR: #000000">!</span>
				<span style="COLOR: #000000"> </span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">$configfile</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">./shadow.new</span>
				<span style="FONT-WEIGHT: bold; COLOR: #000000">"</span>
				<span style="COLOR: #000000"> ]; then<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />         cp </span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000">a $(echo </span>
				<span style="COLOR: #800080">$configfile</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">|</span>
				<span style="COLOR: #000000"> rev </span>
				<span style="COLOR: #000000">|</span>
				<span style="COLOR: #000000"> cut </span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000">f </span>
				<span style="COLOR: #800000">2</span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000">d </span>
				<span style="COLOR: #000000">.</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">|</span>
				<span style="COLOR: #000000"> rev) </span>
				<span style="COLOR: #000000">\</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />           $(echo </span>
				<span style="COLOR: #800080">$configfile</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">|</span>
				<span style="COLOR: #000000"> rev </span>
				<span style="COLOR: #000000">|</span>
				<span style="COLOR: #000000"> cut </span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000">f </span>
				<span style="COLOR: #800000">2</span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000">d </span>
				<span style="COLOR: #000000">.</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">|</span>
				<span style="COLOR: #000000"> rev)</span>
				<span style="COLOR: #000000">.</span>
				<span style="COLOR: #000000">bak </span>
				<span style="COLOR: #800000">2</span>
				<span style="COLOR: #000000">&gt;</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">/</span>
				<span style="COLOR: #000000">dev</span>
				<span style="COLOR: #000000">/</span>
				<span style="COLOR: #000000">null<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />         mv </span>
				<span style="COLOR: #800080">$configfile</span>
				<span style="COLOR: #000000"> $(echo </span>
				<span style="COLOR: #800080">$configfile</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">|</span>
				<span style="COLOR: #000000"> rev </span>
				<span style="COLOR: #000000">|</span>
				<span style="COLOR: #000000"> cut </span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000">f </span>
				<span style="COLOR: #800000">2</span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000">d </span>
				<span style="COLOR: #000000">.</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">|</span>
				<span style="COLOR: #000000"> rev)<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />       fi<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />     done</span>
		</div>
		<p> </p>
		<p>    You'll probably also need to edit your /etc/X11/xorg.conf to change<br />    the name of the keyboard driver from "Keyboard" to "kbd".  I don't<br />    know why this changed, but it did.</p>
		<p>
				<br />7.  Return to multi-user mode:<br />    <strong>telinit 3</strong></p>
		<p>
				<br />8.  Remove obsolete packages.</p>
		<p>    If you go into /var/log/packages and take a look at the package list:</p>
		<p>    <strong>ls -lt | less</strong></p>
		<p>    You may spot some old, obsolete, or discontinued packages.  If so,<br />    you can remove these using 'removepkg'.</p>
		<p>
				<br />9.  Remove KDE language bloat.  By upgrading all packages using<br />    --install-new you've probably installed all of the KDE language<br />    translations from the KDEI series, which will use up about <br />    500MB.  If you need only US English, you may remove the KDE<br />    language packs like this:</p>
		<p>
				<strong>    cd /var/log/packages<br />    removepkg kde-i18n* koffice-l10n*</strong>
		</p>
		<p>    Even if you need one of these, it might be best to start by<br />    removing them all, and then go back and install the ones you<br />    need with installpkg.    </p>
		<p> </p>
		<p>At this point you should be running Slackware 11.0.  :-)</p>
		<p>I wish everyone good luck with this!</p>
		<p>---<br />Patrick Volkerding<br /><a href="mailto:volkerdi@slackware.com">volkerdi@slackware.com</a></p>
<img src ="http://www.cnitblog.com/darkstax/aggbug/18953.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/darkstax/" target="_blank">darkstax</a> 2006-11-08 09:35 <a href="http://www.cnitblog.com/darkstax/archive/2006/11/08/18953.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>slackware初始设置</title><link>http://www.cnitblog.com/darkstax/archive/2006/10/20/18184.html</link><dc:creator>darkstax</dc:creator><author>darkstax</author><pubDate>Fri, 20 Oct 2006 05:16:00 GMT</pubDate><guid>http://www.cnitblog.com/darkstax/archive/2006/10/20/18184.html</guid><wfw:comment>http://www.cnitblog.com/darkstax/comments/18184.html</wfw:comment><comments>http://www.cnitblog.com/darkstax/archive/2006/10/20/18184.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/darkstax/comments/commentRss/18184.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/darkstax/services/trackbacks/18184.html</trackback:ping><description><![CDATA[
		<p>安装好slackware后需要对系统进行如下初始设置：<br /><br />0. 默认进入桌面系统<br />slackware默认工作在系统级别3模式，为命令行终端模式。<br />修改inittab使系统工作在系统级别4模式，即桌面系统模式。<br /><br />1. bash的环境变量<br />.profile是存放在主目录下的普通正文文件（Text　File），通过 <br />设置环境变量（Variable）和终端模式，可以使环境个人化，每 <br />次注册进入系统时，shell会读入.profile文件，并执行所列出的 <br />指令。 </p>
		<p>每当系统管理员创建新用户的户口时，系统都会自动构造一个相 <br />应的<strong>.profile</strong>文件；而整个系统的环境文件就放置在 <br /><strong>/etc/.profile</strong>中。<br /><br />关掉系统声音的方法<br />把BEEP的声音永远关掉：<br />如果用的是bash作shell，在~/.profile的最后添加<br /><strong>setterm -blength 0</strong><br />在 console 下： <strong>setterm -blength 0</strong><br />在 X-win 的 terminal 下： <strong>xset -b</strong><br /><br />2. fcitx设置<br />fcitx需要设置环境变量XMODIFIERS<br />进入/etc/profile.d，在lang.sh中可以看到<br /><strong>export LNAG=en_US</strong><br />在后面加上<br /><strong>export XMODIFIERS="@im=fcitx"</strong><br />这样就设置了环境变量。<br />另外，fcitx需要在LC_CTYPE为中文环境时才能运行。<br />在~/.profile中添加<br /><strong>export LC_CTYPE=zh_CN.gbk<br /></strong>注意，在lang.sh中声明是不行的，这样X的shell中LC_CTYPE<br />为中文环境，但console shell本身的环境还是英文环境。<br />要把console本身的LC_CTYPE设为中文环境。<br /><br />3. 拷贝字体文件<br />将windows下的simsun，tahoma等字体文件拷贝<br />到/usr/share/fonts目录，这样启动桌面后可以显示<br />中文字体。<br /><br />4. 安装显卡驱动<br />安装ati显卡驱动，安装提示安装。安装完毕后还需要设置参数，<br />命令为aticonfig，具体用法见命令帮助。一般需要设置显卡的<br />初始化文件和分辨率。ati显卡支持1280x1024模式。<br /><br />5. 让slackware能够自动关闭电源<br />slackware默认是不会自动关闭电源的，这主要是针对服务器设置的。<br />对于普通PC来说用起来就不方便了。<br />修改<strong>/etc/rc.d/rc.modules</strong>，片断如下：<br />#### APM support ###<br /># APM is a BIOS specification for saving power using several different<br /># techniques. This is mostly useful for battery powered laptops.<br /><strong>/sbin/modprobe apm</strong><br /><br />让普通用户可以关机<br />同样为服务器而设置的，普通用户不能关机。<br /><strong>#chmod +s /sbin/halt</strong><br />这样，普通用户使用 <strong>/sbin/halt -p</strong>能够关机了。</p>
<img src ="http://www.cnitblog.com/darkstax/aggbug/18184.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/darkstax/" target="_blank">darkstax</a> 2006-10-20 13:16 <a href="http://www.cnitblog.com/darkstax/archive/2006/10/20/18184.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>XFree86和X.Org之间的关系</title><link>http://www.cnitblog.com/darkstax/archive/2006/10/19/18165.html</link><dc:creator>darkstax</dc:creator><author>darkstax</author><pubDate>Thu, 19 Oct 2006 11:20:00 GMT</pubDate><guid>http://www.cnitblog.com/darkstax/archive/2006/10/19/18165.html</guid><wfw:comment>http://www.cnitblog.com/darkstax/comments/18165.html</wfw:comment><comments>http://www.cnitblog.com/darkstax/archive/2006/10/19/18165.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/darkstax/comments/commentRss/18165.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/darkstax/services/trackbacks/18165.html</trackback:ping><description><![CDATA[
		<ul type="disc">
				<li>
						<p>
								<a href="http://www.xfree86.org/" target="_top">
										<font color="#002c99">The XFree86 Project, Inc</font>
								</a>
						</p>
						<div class="itemizedlist">
								<ul type="circle">
										<li>
												<p>XFree86是由X11R6发展出来的最初专门给Intel X86 结构PC机使用的X Window的系统。</p>
										</li>
										<li>
												<p>而后XFree86发展成为几乎适用于所有类UNIX操作系统的X Window系统。</p>
										</li>
										<li>
												<p>XFree86是一个开放源代码的基于X11的桌面基础构架。</p>
										</li>
										<li>
												<p>Red Hat 9中使用的X Window系统就是 XFree86 4.3。</p>
										</li>
										<li>
												<p>XFree86从2004年发布的版本4.4起不再遵从GPL许可证发行，而是遵循新的XFree86 1.1 许可证。</p>
										</li>
										<li>
												<p>由于XFree86不再遵从GPL许可证发行，导致许多发行套件不再使用XFree86，转而使用Xorg。</p>
										</li>
								</ul>
						</div>
				</li>
				<li>
						<p>
								<a href="http://osmond.cn/rh9/slides/foil53.html???" target="_top">
										<font color="#002c99">The XOrg Foundation（X.org）</font>
								</a>
						</p>
						<div class="itemizedlist">
								<ul type="circle">
										<li>
												<p>Xorg 是由 X.Org 基金会发行的开放源代码 X Window 系统实现的 X 服务。</p>
										</li>
										<li>
												<p>Xorg 遵从GPL许可证发行。</p>
										</li>
										<li>
												<p>Xorg 基于 XFree86 4.4RC2 和 X11R6.6 的代码。</p>
										</li>
										<li>
												<p>X.Org 基金会在 2004 年 4 月发布了 X11R6.7。</p>
										</li>
										<li>
												<p>在 2005 年 2 月发布了 X11R6.8.2。</p>
										</li>
								</ul>
						</div>
				</li>
		</ul>
<img src ="http://www.cnitblog.com/darkstax/aggbug/18165.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/darkstax/" target="_blank">darkstax</a> 2006-10-19 19:20 <a href="http://www.cnitblog.com/darkstax/archive/2006/10/19/18165.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>基本的UNIX命令</title><link>http://www.cnitblog.com/darkstax/archive/2006/04/18/9339.html</link><dc:creator>darkstax</dc:creator><author>darkstax</author><pubDate>Tue, 18 Apr 2006 12:49:00 GMT</pubDate><guid>http://www.cnitblog.com/darkstax/archive/2006/04/18/9339.html</guid><description><![CDATA[
		<strong>设定口令</strong>
		<br />   如果想设置或改变个人的密码，随时可以以命令 passwd 来改变。<br /><br /><strong>虚拟主控台(virtual console)</strong><br />   在 linux 下提供了虚拟控制台的功能，它允许你在同一时刻进行不同的工作。如，你可以在一个控制台安装一个冗长的程序，然后在另外一个控制台轻松的阅读邮件和浏览网页等。 linux 下的切换控制台命令为按住左边的 Alt 键，然后按 F1 到 F8 切换。<br /><br /><strong>常用的命令<br /></strong><br />目录<br />   登陆到系统后，系统会把你放在个人主目录下，用命令 pwd 可以查看当前目录。 pwd 即为 print working directory 的缩写。你可以用命令 pwd 来证实这一点：<br />   $ pwd<br />      /home/bill<br /><br />   如果我们想切换目录，可以用命令 cd 来完成这一点：<br />   $ cd /usr/bin<br />   $ pwd<br />      /usr/bin<br /><br />   如果输入 cd ，会出现什么现象呢？ cd 将会把目录切换到你的主目录下。此外， ~ 用来代表主目录。如   ~/program 表示 program 是放在你的主目录下的。<br /><br />   你可以在主目录下创建这个 program 目录，用下面任意一个命令即可：<br />   $ mkdir program<br />   或者使用完整的路径，<br />   $ mkdir /home/bill/program<br /><br />   现在切换到这个目录下：<br />   $ cd program<br />   $ pwd<br />      /home/bill/program<br /><br />   有时候我们目录陷的太深，想返回上一层应该怎么办呢，难道又要输入冗长的路径名？在 linux 下，.. 用来代表上一层目录。如果想返回上一层目录，我们输入：<br />   $ cd ..<br /><br />   和 mkdir 相对应的是 rmdir ，这个命令可以用来删除目录：<br />   $ rmdir program<br /><br />列出文件<br />   键入 ls 不加任何参数，将会列出当前目录的文件，当然你也可以键入你相列出的目录：<br />   $ ls /home<br /><br />   有些系统提供了比较花哨的 ls ，它会把一些特殊的文件如目录和可执行文件等用粗体字甚至是有颜色的字来显示。在这类系统中，如果想改变系统的预设颜色，你可以编辑 /etc/DIR_COLORS ，或者将它复制到你的主目录下，并命名为 .dir_colors ，然后编辑。<br /><br />   正如大部分的 UNIX 命令一样，你可以在 ls 命令后加上以 -(连字号)为开头的选项来控制它，不要忘记在 - 前留下一个空白号。其中 -a 是一个比较有用的选项，这里的 a 是 all 的意思。加上这个选项，ls 将会列出一些你想象不到的文件。 其中 . 是表示当前的目录， .. 是表示上一层目录，而以 . 开头的文件表示的是隐藏文件，它在一般的 ls 中不显示出来。<br /><br />   另一个有用的参数是 -l ，它是 long  的意思，这个选项可以显示文件的详细信息。如<br />文件类型   权限   物理连接数   所有者   群组   文件字节数   上次修改的日期和时间   文件名称<br /><br />浏览文件<br />   使用编辑器是阅读文件内容的一种方法，就想下面这样：<br />   $ emacs .bashrc<br /><br />   如果你只是想快速的扫过它，而不是编辑，你可以用下面的命令：<br />   $ cat .bashrc<br /><br />   但是对于比较大的文件，它向上扫动的太快以至于无法阅读，人们通常使用 more 命令来替代。<br />   $ more .bashrc<br /><br />   less 是 more 变化来的一个命令，它比 more 的功能更为强大。如你可以在文件的一个位置作上标记，等一会儿再回到那里。<br /><br />符号连接(symbolic link)<br />   当需要引用一个位置的文件，而在此位置该文件不存在，可以在此位置建立该文件的一个连接来解决问题。这个机制就是符号连接(symbolic link)。UNIX 提供了 links 这个命令来处理此类状况。符号连接是一种指向另一个文件的虚拟文件(dummy file)，如果你阅读、编辑或执行这个符号连接，系统会很聪明的直接作用到那个真的文件上。<br /><br />   以 prog 为例，如果你要建立一个连接 prog， 让它连接到真实文件 prog.1 上，执行如下命令：<br />   $ ln -s prog.1 prog<br />   现在你已经建立了一个叫 prog 的虚拟文件，当你执行 prog 时，实际上执行的是 prog.1 这个文件。<br /><br /><strong>Shell<br /></strong>   你可以使用一下的命令找出你目前正在使用的 shell：<br />   $ echo $SHELL<br />   你可以用 chsh 这个命令来改变你的 shell：<br />   $ chsh<br /><br /><strong>常用的按键以及用法<br /></strong>   当你键入一个命令后，按下退格键(backspace)，应该会清楚最后一个字符；Ctrl-U应该会删除整行(Ctrl-U 表示先按下 Ctrl 再按下 U)；当你输完一个命令正在执行时，Ctrl-C 可以中断它，而 Ctrl-Z 可以暂停它。当你想要再继续进行下去时，可以键入 fg (foregroud) 把它拉回前台继续执行。<br /><br />   如果其中任何的按键失效了，有可能是你的终端没有正确的设置，你可以用 stty 这个命令来修复它：<br />   $ stty function key<br />   其中 function 表示你想作的事，key 表示你按下的键，可以用 ^ 来表示 Ctrl 键。<br /><br />   下面的命令用来设定我们刚刚所描述的功能：<br />   $ stty erase ^H<br />   $ stty kill ^U<br />   $ stty intr ^C<br />   $ stty susp ^Z<br />   注意：^H 是退格键所产生的 ASCII 代码。<br /><br />   另外，你也可以用 stty -a 来显示目前的终端配置。但其结果并非人人都能理解，因为 stty 是一个多用途的复杂命令，有些用途你需要对你的终端有很深入的了解。<img src ="http://www.cnitblog.com/darkstax/aggbug/9339.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/darkstax/" target="_blank">darkstax</a> 2006-04-18 20:49 <a href="http://www.cnitblog.com/darkstax/archive/2006/04/18/9339.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>