﻿<?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>C++博客-斜树的空间-随笔分类-linux编程学习</title><link>http://www.cppblog.com/Viking/category/14096.html</link><description>集中精力，放弃一切的去做一件事情，只要尽力了，即使失败了，你也不会后悔！</description><language>zh-cn</language><lastBuildDate>Sat, 07 Jan 2012 04:07:58 GMT</lastBuildDate><pubDate>Sat, 07 Jan 2012 04:07:58 GMT</pubDate><ttl>60</ttl><item><title>Debian下LAMP环境的搭建</title><link>http://www.cppblog.com/Viking/archive/2011/12/25/apache2.html</link><dc:creator>张贵川</dc:creator><author>张贵川</author><pubDate>Sun, 25 Dec 2011 06:03:00 GMT</pubDate><guid>http://www.cppblog.com/Viking/archive/2011/12/25/apache2.html</guid><wfw:comment>http://www.cppblog.com/Viking/comments/162774.html</wfw:comment><comments>http://www.cppblog.com/Viking/archive/2011/12/25/apache2.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Viking/comments/commentRss/162774.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Viking/services/trackbacks/162774.html</trackback:ping><description><![CDATA[<span class="Apple-style-span" style="font-family: Arial; line-height: 26px; background-color: #ffffff; "><div style="text-align: center; "><font size="4"><span style="font-weight: bold; ">Debian下LAMP环境的搭建</span></font></div>以前安装LAMP环境都是采用下载软件包自己编译安装的方法搭建的。当时以为采用apt的方式来安装时软件包版本的陈旧是一个问题，另一个主要的问题就是并不知道apt将这些软件包安装到什么地方，从而使得自己要修改一个配置文件或是启动一个服务命令时都找不到。采用手工编译安装的方法，虽然可以很好的控制软件包的安装位置，但是却不得不自己去解决各种的依赖关系。如编译PHP时，就是因为各种的依赖关系而不能进正确的configure过程。当然如果是Debian的环境下，可以使用apt来安装需要的各种软件依赖，但是如果是在其他的发版本下，这样的关系的解决就是一个很费力的过程。<br />在Debian的环境下搭建LAMP时，只是使用apt来安装各种缺失的依赖关系，这样的使用就显得有一些大材小用的感觉了。其实采用apt的方式来搭建LAMP也可以安装到最新的版本，而且可以自动的解决各种的依赖关系，实在是一个相当不错的选择。似乎很好的验证了这句话：Debian上软件包的安装还是要采用apt的方式。下面我们就采apt的方式来安装我们的LAMP环境：<br /><br /><span style="font-weight: bold; color: #0080ff; ">1 安装MySQL</span><br /><br /># apt-get install mysql-server-5.0<br /><br />这样安装的是MySQL的5.0版本，而且可以自动的解决各种依赖关系，从而会安装上服务器端与客户端以及各种相应的软件包。<br /><br /><span style="font-weight: bold; color: #0080ff; ">2 安装Apache2</span><br /><br /># apt-get install apache2<br /><br />这样安装的是Apache的2.x版本，如果采用的是<br /><br /># apt-get install apache<br /><br />则安装的是Apache的1.x版本。<br /><br /><span style="font-weight: bold; color: #0080ff; ">3 安装PHP5</span><br /><br /># apt-get install php5<br /><br />这样就会安装PHP5版本，而且会自动的安装上各种所需要的模块。如Apache2与MySQL的相应Module等。<br /><br />这样我们就已经成功的搭建了我们的LAMP开发环境了。我们可以简单的进行一个测试：<br /><br />1 apt在成功的安装了MySQL后，默认启动了MySQL服务器，我们可以用下面的命令来与之建立连接：<br /><br /># mysql<br /><br />如果显示了mysql提示符，则说我们的MySQL安装是成功的。<br /><br />2 apt在成功的安装了Apache2后，默认启动了Apache2守护进程，我们可以在我们的浏览器地址栏中输入localhost，如果可以看到默认的主页，则说我们的Apache2安装是成功的。<br /><br />3 我们可以简单的写一个PHP的脚本如php.php放在Apache2目录下，默认为/var/www/目录。脚本内容如下：<br /><br />&lt;?php<br /><br />phpinfo();<br /><br />?&gt;<br /><br />这样以后在我们的浏览器地址栏中输入<br /><br />http://localhost/php.php<br /><br />如果可以正确的解析，则说明我们的PHP的安装是成功的。<br /><br />在这里我们要注意的一点就是，如果我们的PHP脚本没有正确的进行解析，我们可以重启Apache2来试一下，因为这时Apache2需要重启来装入相应在的PHP模块，命令娱下：<br /><br /># /etc/rc2.d/S91apache2 restart<br /><br />当然S91apache2要依据我们系统的相应文件而定。<br /><br />另外在默认的情况，Debian在启动时会启动Apache2与MySQL服务器，如果并不希望这样做，我们可以参考一下<a href="http://blog.chinaunix.net/u/19185/showart_183018.html" target="_blank" style="color: #ff9900; text-decoration: none; ">Debian系统启动脚本</a>的相关内容。<br /><br />我基本上是参照这篇博文来做的，当然，实现安装了，apt-spy 工具来加快source源！<br /><br /></span><img src ="http://www.cppblog.com/Viking/aggbug/162774.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Viking/" target="_blank">张贵川</a> 2011-12-25 14:03 <a href="http://www.cppblog.com/Viking/archive/2011/12/25/apache2.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Debian chinese fonts install</title><link>http://www.cppblog.com/Viking/archive/2011/09/30/debian.html</link><dc:creator>张贵川</dc:creator><author>张贵川</author><pubDate>Fri, 30 Sep 2011 15:47:00 GMT</pubDate><guid>http://www.cppblog.com/Viking/archive/2011/09/30/debian.html</guid><wfw:comment>http://www.cppblog.com/Viking/comments/157259.html</wfw:comment><comments>http://www.cppblog.com/Viking/archive/2011/09/30/debian.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Viking/comments/commentRss/157259.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Viking/services/trackbacks/157259.html</trackback:ping><description><![CDATA[&nbsp;&nbsp; here is my script for install Chinese fonts.<br /><br />the &nbsp; desired effect: I wanna to install my new Debian system like this, with all En environment include mene, desktop, system fonts but displays nicely chines on web pages &nbsp; and emails .so , do it like this:<br /><br />First Step: <br />&nbsp;&nbsp; <br /><div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%;"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #000000;">su&nbsp;</span><span style="color: #000000;">-</span><span style="color: #000000;">&nbsp;root<br />dpkg-reconfigure locales<br /></span></div>restart you system .<br />config the language you want to use.<br /><br />chose below opition:<br /><div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%;"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #000000;">en_US.ISO</span><span style="color: #000000;">-</span><span style="color: #000000;">8859</span><span style="color: #000000;">-</span><span style="color: #000000;">1</span><span style="color: #000000;"><br />en_US.UTF</span><span style="color: #000000;">-</span><span style="color: #000000;">8</span><span style="color: #000000;"><br />zh_CN.GB2312<br />zh_CN.UTF</span><span style="color: #000000;">-</span><span style="color: #000000;">8</span><span style="color: #000000;"><br />zh_CN.GBK<br />zh_TW.BIG5<br />zh_TW.UTF</span><span style="color: #000000;">-</span><span style="color: #000000;">8</span></div><div><code><br />use command to check does them selected.<br /></code><div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%;"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #000000;">#locale </span><span style="color: #000000;">-</span><span style="color: #000000;">a<br /><div>C<br />en_US<br />en_US.iso88591<br />en_US.utf8<br />POSIX<br />zh_CN<br />zh_CN.gb2312<br />zh_CN.gbk<br />zh_CN.utf8<br />zh_TW<br />zh_TW.big5<br />zh_TW.utf8<br />#</div></span></div><br />Second Step:&nbsp;&nbsp; <br />this step to install all&nbsp; font deb package.<br />fonts package list:<br /><div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%;"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #000000;">&nbsp;ttf</span><span style="color: #000000;">-</span><span style="color: #000000;">arphic</span><span style="color: #000000;">-</span><span style="color: #000000;">ukai<br />&nbsp;ttf</span><span style="color: #000000;">-</span><span style="color: #000000;">arphic</span><span style="color: #000000;">-</span><span style="color: #000000;">uming<br />&nbsp;ttf</span><span style="color: #000000;">-</span><span style="color: #000000;">arphic</span><span style="color: #000000;">-</span><span style="color: #000000;">gbsn00lp<br />&nbsp;ttf</span><span style="color: #000000;">-</span><span style="color: #000000;">arphic</span><span style="color: #000000;">-</span><span style="color: #000000;">bkai00mp&nbsp;<br />&nbsp;ttf</span><span style="color: #000000;">-</span><span style="color: #000000;">arphic</span><span style="color: #000000;">-</span><span style="color: #000000;">bsmi00lp<br /></span></div></div>go to Debian Search web-page search for all these packages.<br /><div>http://packages.debian.org/search?keywords=search</div><br />download all these pakages and use this command: &nbsp; &nbsp; dpkg -i &nbsp; PackageName.deb &nbsp;&nbsp; to install.<br /><br /><br />Three Step:<br />Enjoy your life!<br /><br /><br />why I record in En: because I have gradute from my school, I do not need always write chinese , so I delay to install my input method on my new Debian system.<img src ="http://www.cppblog.com/Viking/aggbug/157259.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Viking/" target="_blank">张贵川</a> 2011-09-30 23:47 <a href="http://www.cppblog.com/Viking/archive/2011/09/30/debian.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>rpm </title><link>http://www.cppblog.com/Viking/archive/2011/07/16/abc.html</link><dc:creator>张贵川</dc:creator><author>张贵川</author><pubDate>Sat, 16 Jul 2011 08:09:00 GMT</pubDate><guid>http://www.cppblog.com/Viking/archive/2011/07/16/abc.html</guid><wfw:comment>http://www.cppblog.com/Viking/comments/151162.html</wfw:comment><comments>http://www.cppblog.com/Viking/archive/2011/07/16/abc.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Viking/comments/commentRss/151162.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Viking/services/trackbacks/151162.html</trackback:ping><description><![CDATA[rpm 安装时候的档案库资讯就在/var/lib/rpm/ 目录中，以后rpm包安装时都要来查询这个目录中的档案看是否有安装过，以及升级时版本的比较，和rpm包的数字签名都存在这个档案库目录中<br /><br /><div>rpm 安装使用：<br /><br />rpm -ivh rp-pppoe-3.5-32.1.i386.rpm<br />-i ：install 的意思<br />-v ：察看更細部的安裝資訊畫面<br />-h ：以安裝資訊列顯示安裝進度<br /><br />rpm 网络安装：<br />rpm -ivh http://website.name/path/pkgname.rpm<br /><br />rpm 的一些相关参数：<br /><br />--nodeps:<br />使用時機：當發生軟體屬性相依問題而無法安裝，但你執意安裝時<br />危險性： 軟體會有相依性的原因是因為彼此會使用到對方的機制或功能，如果強制安裝而不考慮軟體的屬性相依， 則可能會造成該軟體的無法正常使用！<br /><br />--replacefiles:<br />使用時機：&nbsp; 如果在安裝的過程當中出現了『某個檔案已經被安裝在你的系統上面』的資訊，又或許出現版本不合的訊息 (confilcting files) 時，可以使用這個參數來直接覆蓋檔案。<br />危險性： 覆蓋的動作是無法復原的！所以，你必須要很清楚的知道被覆蓋的檔案是真的可以被覆蓋喔！否則會欲哭無淚！<br /><br />--replacepkgs:<br />使用時機：&nbsp; 重新安裝某個已經安裝過的軟體！如果妳要安裝一堆 RPM 軟體檔案時，可以使用 rpm -ivh *.rpm ，但若某些軟體已經安裝過了， 此時系統會出現『某軟體已安裝』的資訊，導致無法繼續安裝。此時可使用這個選項來重複安裝喔！<br /><br />--force:<br />使用時機：這個參數其實就是 --replacefiles 與 --replacepkgs 的綜合體！<br /><br />--test:<br />使用時機：&nbsp; 想要測試一下該軟體是否可以被安裝到使用者的 Linux 環境當中，可找出是否有屬性相依的問題。範例為：<br />rpm -ivh pkgname.i386.rpm --test<br /><br />--nosignature:<br />使用時機：&nbsp; 想要略過數位簽章的檢查時，可以使用這個選項。<br /><br />--prefix NEW_PATH<br />使用時機：&nbsp; 要將軟體安裝到其他非正規目錄時。舉例來說，妳想要將某軟體安裝到 /usr/local 而非正規的 /bin, /etc 等目錄， 就可以使用『 --prefix /usr/local 』來處理了。<br /><br />rpm升级时候使用的参数：<br />-Uvh ： (U指 update)<br />後面接的軟體即使沒有安裝過，則系統將予以直接安裝； 若後面接的軟體有安裝過舊版，則系統自動更新至新版；<br /><br />-Fvh : (F 指 fresh)<br />如果後面接的軟體並未安裝到你的 Linux 系統上，則該軟體不會被安裝；亦即只有已安裝至你 Linux 系統內的軟體會被『升級』！<br /><br />注意：<br />通常有的朋友在進行整個作業系統的舊版軟體修補時，喜歡這麼進行：<br /><br />&nbsp;&nbsp; 1. 先到各發展商的 errata 網站或者是國內的 FTP 映像站捉下來最新的 RPM 檔案；<br />&nbsp;&nbsp; 2. 使用 -Fvh 來將你的系統內曾安裝過的軟體進行修補與升級！(真是方便呀！)<br /><br />所以，在不曉得 yum 功能的情況下，妳依舊可以到 CentOS 的映設站台下載 updates 資料，然後利用上述的方法來一口氣升級！ 當然囉，升級也是可以利用 --nodeps/--force 等等的參數啦！<br /><br />-qi :<br />列出該軟體的詳細資訊 (information)，包含開發商、版本與說明等；<br /><br />-qa :<br />列出所有的，已經安裝在本機 Linux 系統上面的所有軟體名稱；<br /><br />-q:<br />僅查詢，後面接的軟體名稱是否有安裝；<br /><br />-qc :<br />列出該軟體的所有設定檔 (找出在 /etc/ 底下的檔名而已)<br /><br />-qd :<br />列出該軟體的所有說明檔 (找出與 man 有關的檔案而已)<br /><br />-qR:<br />列出與該軟體有關的相依軟體所含的檔案 (Required 的意思)<br /><br />-qpl&nbsp; name.rpm&nbsp;&nbsp; :<br />可查看该 rpm 包内的内容<br /><br />例子：<br />[root@www ~]# rpm -qf /bin/sh<br />bash-3.2-21.el5<br /># 這個參數後面接的可是『檔案』吶！不像前面都是接軟體喔！<br /># 這個功能在查詢系統的某個檔案屬於哪一個軟體所有的。<br /><br />如果我誤砍了某個重要檔案，例如 /etc/crontab，偏偏不曉得他屬於哪一個軟體，該怎麼辦？<br />雖然已經沒有這個檔案了，不過沒有關係，因為 RPM 有記錄在 /var/lib/rpm 當中的資料庫啊！所以直接下達：<br />rpm -qf /etc/crontab<br />就可以知道是那個軟體囉！重新安裝一次該軟體即可！<br /><br />当/var/lib/rpm/ 目录内的资料库损毁时，可用：<br />rpm --rebuilddb&nbsp;&nbsp; &lt;==重建資料庫<br /><br /><br /><br /></div>&nbsp;&nbsp; &nbsp;&nbsp; <img src ="http://www.cppblog.com/Viking/aggbug/151162.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Viking/" target="_blank">张贵川</a> 2011-07-16 16:09 <a href="http://www.cppblog.com/Viking/archive/2011/07/16/abc.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>vim实用快捷键子总结</title><link>http://www.cppblog.com/Viking/archive/2011/04/13/144154.html</link><dc:creator>张贵川</dc:creator><author>张贵川</author><pubDate>Wed, 13 Apr 2011 13:38:00 GMT</pubDate><guid>http://www.cppblog.com/Viking/archive/2011/04/13/144154.html</guid><wfw:comment>http://www.cppblog.com/Viking/comments/144154.html</wfw:comment><comments>http://www.cppblog.com/Viking/archive/2011/04/13/144154.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Viking/comments/commentRss/144154.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Viking/services/trackbacks/144154.html</trackback:ping><description><![CDATA[在VIM编程时候本人最喜欢用操作：<div>复制光标所在单词方法：</div><div>viw, 或者 yiw</div><div>viw是进入可视模式，yiw在编辑模式就可用</div><img src ="http://www.cppblog.com/Viking/aggbug/144154.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Viking/" target="_blank">张贵川</a> 2011-04-13 21:38 <a href="http://www.cppblog.com/Viking/archive/2011/04/13/144154.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>手把手教你把VIM改造成为IDE开发环境</title><link>http://www.cppblog.com/Viking/archive/2011/03/27/vimIDE.html</link><dc:creator>张贵川</dc:creator><author>张贵川</author><pubDate>Sun, 27 Mar 2011 03:45:00 GMT</pubDate><guid>http://www.cppblog.com/Viking/archive/2011/03/27/vimIDE.html</guid><wfw:comment>http://www.cppblog.com/Viking/comments/142788.html</wfw:comment><comments>http://www.cppblog.com/Viking/archive/2011/03/27/vimIDE.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Viking/comments/commentRss/142788.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Viking/services/trackbacks/142788.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 此文纯属转载：手把手教你把Vim改装成一个IDE编程环境(图文)                        By:            吴垠                            Date:            2007-09-07                            Version:      ...&nbsp;&nbsp;<a href='http://www.cppblog.com/Viking/archive/2011/03/27/vimIDE.html'>阅读全文</a><img src ="http://www.cppblog.com/Viking/aggbug/142788.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Viking/" target="_blank">张贵川</a> 2011-03-27 11:45 <a href="http://www.cppblog.com/Viking/archive/2011/03/27/vimIDE.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>rpm 使用的一个问题？</title><link>http://www.cppblog.com/Viking/archive/2011/03/27/rpm.html</link><dc:creator>张贵川</dc:creator><author>张贵川</author><pubDate>Sun, 27 Mar 2011 02:46:00 GMT</pubDate><guid>http://www.cppblog.com/Viking/archive/2011/03/27/rpm.html</guid><wfw:comment>http://www.cppblog.com/Viking/comments/142787.html</wfw:comment><comments>http://www.cppblog.com/Viking/archive/2011/03/27/rpm.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Viking/comments/commentRss/142787.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Viking/services/trackbacks/142787.html</trackback:ping><description><![CDATA[在光盘镜像package 目录中：<br>用rpm 命令 ： rpm -qpl *.rpm | grep libstdc++-libc6.2-2.so.3 <br>可以查出某个 rpm 包中含有 libstdc++-libc.6.2-2.so.3 ，但不知道具体是哪个包？<br>问题是怎么反回去？<br><br><img src ="http://www.cppblog.com/Viking/aggbug/142787.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Viking/" target="_blank">张贵川</a> 2011-03-27 10:46 <a href="http://www.cppblog.com/Viking/archive/2011/03/27/rpm.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>一个linux大侠的blog</title><link>http://www.cppblog.com/Viking/archive/2011/03/26/vim.html</link><dc:creator>张贵川</dc:creator><author>张贵川</author><pubDate>Sat, 26 Mar 2011 02:45:00 GMT</pubDate><guid>http://www.cppblog.com/Viking/archive/2011/03/26/vim.html</guid><wfw:comment>http://www.cppblog.com/Viking/comments/142747.html</wfw:comment><comments>http://www.cppblog.com/Viking/archive/2011/03/26/vim.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Viking/comments/commentRss/142747.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Viking/services/trackbacks/142747.html</trackback:ping><description><![CDATA[<br>
http://blog.csdn.net/wooin/archive/2007/10/31/1858917.aspx
<br><img src ="http://www.cppblog.com/Viking/aggbug/142747.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Viking/" target="_blank">张贵川</a> 2011-03-26 10:45 <a href="http://www.cppblog.com/Viking/archive/2011/03/26/vim.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>linux 中安装 mplayer</title><link>http://www.cppblog.com/Viking/archive/2011/02/27/140754.html</link><dc:creator>张贵川</dc:creator><author>张贵川</author><pubDate>Sun, 27 Feb 2011 11:39:00 GMT</pubDate><guid>http://www.cppblog.com/Viking/archive/2011/02/27/140754.html</guid><wfw:comment>http://www.cppblog.com/Viking/comments/140754.html</wfw:comment><comments>http://www.cppblog.com/Viking/archive/2011/02/27/140754.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Viking/comments/commentRss/140754.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Viking/services/trackbacks/140754.html</trackback:ping><description><![CDATA[<table>
    <tbody>
        <tr>
            <tr>
                <td><strong>1.下载相关codes ( http://www.mplayerhq.hu/MPlayer/ ) 主要都在这里</strong>
                <p>　　Mplayer-1.0rc1.tar.bz2(主程序)( http://www.mplayerhq.hu/MPlayer/releases/MPlayer-1.0rc1.tar.bz2 )</p>
                <p>　　Abyss-1.6.tar.bz2 (皮肤) (http://www2.mplayerhq.hu/MPlayer/skins/Abyss-1.6.tar.bz2)</p>
                <p>　　all-20060611.tar.bz2(http://www.mplayerhq.hu/MPlayer/releases/codecs/all-20060611.tar.bz2 )</p>
                <p>　　windows-all-20060611.zip(建议不要在win下使用. rar,用. zip)</p>
                <p>　　( http://www.mplayerhq.hu/MPlayer/releases/codecs/windows-all-20060611.zip )</p>
                <p>　　这是我的mplayer的一些组件,你可以去http://www.mplayerhq.hu/MPlayer/ 下载你自己喜欢的皮肤和字体.</p>
                <p><strong>2.安装过程(请把你的终端打开)</strong></p>
                <p>　　a.安装相应的解码</p>
                <p>　　进入主目录后,以root身份安装 ,这样改变身份:在终端输入su或者su root ,然后输入密码就ok啦,有没有看到 $ 变成了 #</p>
                <p>　　接着</p>
                <p>　　mkdir /usr/lib/codecs</p>
                <p>　　mkdir /usr/lib/wincodecs</p>
                <p>　　tar jxvf all-20060611.tar.bz2</p>
                <p>　　mv all-20060611/* /usr/lib/codecs</p>
                <p>　　unzip windows-all-20060611.zip</p>
                <p>　　mv windows-all-20060611/* /usr/lib/wincodecs</p>
                <p>　　b.安装mplayer</p>
                <p>　　tar jxvf MPlayer-1.0rc1.tar.bz2</p>
                <p>　　cd MPlayer-1.0rc1</p>
                <p>　　./configure --prefix=/usr/local/mplayer --enable-gui
                --enable-freetype --with-codecsdir=/usr/lib/codecs/
                --with-win32libdir=/usr/lib/wincodecs/ --language=zh_CN</p>
                <p>　　注意:</p>
                <p>　　--prefix=/usr/local/mplayer 是安装路径</p>
                <p>　　--enable-gui 安装图形化用户界面</p>
                <p>　　--enable-freetype 调节字体</p>
                <p>　　--with-codecsdir=/usr/lib/codecs/</p>
                <p>　　--with-win32libdir=/usr/lib/wincodecs 指定解码位置</p>
                <p>　　--language=zh_CN 中文</p>
                <p>　　接着</p>
                <p>　　make</p>
                <p>　　make install</p>
                <p>　　c.安装皮肤</p>
                <p>　　tar jxvf Abyss-1.6.tar.bz2</p>
                <p>　　mv Abyss /usr/local/mplayer/share/mplayer/skins/</p>
                <p>　　cd /usr/local/mplayer/share/mplayer/skins/</p>
                <p>　　mv Abyss default</p>
                <p>　　至此mplayer已经成为了万能播放器</p>
                <p>　　执行程序在 /usr/local/mplayer/bin中</p>
                <p>　　你可以在终端中输入gmplayer,也可以在桌面建立起动器来使用mplayer</p>
                <p>　　赶紧运行一下，看看有没有问题</p>
                <p>　　你一定会发现我们还没有装字体，运行mplayer后它也会提示没有字体</p>
                <p>　　你就从自己电脑中拷个字体到主目录下的.mplayer文件夹下，并把你的字体改名为subfont.ttf,问题就解决了，或者做个链接也行,只要你喜欢</p>
                <p>　　字体你可以上网下载，mplayer网站也有，你电脑里也有字体，在/usr/share/fonts/chinese下(/usr
                /share/fonts/chinese/TrueType/uming.ttf就可以用)你就直接cp
                /usr/share/fonts/chinese/TrueType/uming.ttf $HOME/.mplayer下</p>
                <p>　　每个用户都有自己的环境变量HOME,再cd $HOME/.mplayer 接着</p>
                <p>　　mv uming.ttf subfont.ttf 结束!</p>
                </td>
            </tr>
        </tr>
    </tbody>
</table><img src ="http://www.cppblog.com/Viking/aggbug/140754.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Viking/" target="_blank">张贵川</a> 2011-02-27 19:39 <a href="http://www.cppblog.com/Viking/archive/2011/02/27/140754.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>linux 中调整亮度的方法</title><link>http://www.cppblog.com/Viking/archive/2010/11/05/132593.html</link><dc:creator>张贵川</dc:creator><author>张贵川</author><pubDate>Fri, 05 Nov 2010 12:10:00 GMT</pubDate><guid>http://www.cppblog.com/Viking/archive/2010/11/05/132593.html</guid><wfw:comment>http://www.cppblog.com/Viking/comments/132593.html</wfw:comment><comments>http://www.cppblog.com/Viking/archive/2010/11/05/132593.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Viking/comments/commentRss/132593.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Viking/services/trackbacks/132593.html</trackback:ping><description><![CDATA[<p>2种常见方法：</p>
<p>1</p>
<p>xgamma -gamma 0.7</p>
<p>最后的小数值最好设置在1.0以下。</p>
<p>2</p>
<p>[root@rocrocket fonts]# cat /proc/acpi/video/VGA/LCD/brightness<br>
levels:&nbsp; 0 0 0 40 100<br>
current: 100<br>
[root@rocrocket fonts]# echo 40 &gt; /proc/acpi/video/VGA/LCD/brightness</p><img src ="http://www.cppblog.com/Viking/aggbug/132593.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Viking/" target="_blank">张贵川</a> 2010-11-05 20:10 <a href="http://www.cppblog.com/Viking/archive/2010/11/05/132593.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>qemu</title><link>http://www.cppblog.com/Viking/archive/2010/10/19/130420.html</link><dc:creator>张贵川</dc:creator><author>张贵川</author><pubDate>Tue, 19 Oct 2010 04:33:00 GMT</pubDate><guid>http://www.cppblog.com/Viking/archive/2010/10/19/130420.html</guid><wfw:comment>http://www.cppblog.com/Viking/comments/130420.html</wfw:comment><comments>http://www.cppblog.com/Viking/archive/2010/10/19/130420.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Viking/comments/commentRss/130420.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Viking/services/trackbacks/130420.html</trackback:ping><description><![CDATA[qemu 用起来确实比bochs快很多了。<br>并且也没有出现像bochs切换后就无法相应键盘的情况。<br><br>qemu安装dos步骤：<br>qemu-img create dos.img 50M<br>qemu -hda dos.img -cdrom dos72.iso -boot d&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ==========(here a mean boot from first floppy, c mean boot from first hard-disk, d boot from <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ==========(first CD&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br><br><font id="remark_view" style="font-size: 14px;">如果时两张光盘，换盘的时候按control+alt+2到了一个
shell下面，提示符是(qemu)，跟bash一样，可以命令tab补齐的我们可以直接输入命令，change fda
DOS71_2.IMG这样就可以了<br><br></font>
<br><br><img src ="http://www.cppblog.com/Viking/aggbug/130420.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Viking/" target="_blank">张贵川</a> 2010-10-19 12:33 <a href="http://www.cppblog.com/Viking/archive/2010/10/19/130420.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>fedora 中添加字体</title><link>http://www.cppblog.com/Viking/archive/2010/10/19/130406.html</link><dc:creator>张贵川</dc:creator><author>张贵川</author><pubDate>Tue, 19 Oct 2010 02:39:00 GMT</pubDate><guid>http://www.cppblog.com/Viking/archive/2010/10/19/130406.html</guid><wfw:comment>http://www.cppblog.com/Viking/comments/130406.html</wfw:comment><comments>http://www.cppblog.com/Viking/archive/2010/10/19/130406.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Viking/comments/commentRss/130406.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Viking/services/trackbacks/130406.html</trackback:ping><description><![CDATA[<p><strong>ps：再转一篇南北的字体修改教程。我在fedora 13中实践成功。当中有些文件稍有改变。具体安装的时候灵活找一下。<br></strong></p>
<p><strong>作者：</strong>北南南北<br>
<strong>来自：</strong>LinuxSir.Org<br>
<strong>摘要：</strong>在Fedora Core
5.0中，对中文支持极为友好，我们可以自己添加自己的字体，以适合我们做文档、图形的需要。这样有更多的字体供我们选择；现在把简单的方法说一下。可能
也不太简单，还是要改一改文件的。初学的弟兄看看吧，可能一下就会了；</p>
<p><font size="4"><strong><br>
目录<br>
</strong></font></p>
<ul><a href="http://fedora.linuxsir.org/main/node/133?q=node/133#1">1、首先我们要在
    /usr/share/fonts/chinese目录中建一个文件夹；</a><br><a href="http://fedora.linuxsir.org/main/node/133?q=node/133#2">2、执行
    ttmkfdir命令在字体目录；</a><br><a href="http://fedora.linuxsir.org/main/node/133?q=node/133#3">3、更改
    fonts.conf文件，添加我们添加字体的目录；（可选） </a><br><a href="http://fedora.linuxsir.org/main/node/133?q=node/133#4">4、更改
    /etc/X11/xorg.conf文件；（可选）</a><br><a href="http://fedora.linuxsir.org/main/node/133?q=node/133#5">5、应用程序的设
    置；</a>
    <ul><a href="http://fedora.linuxsir.org/main/node/133?q=node/133#5.1">5.1
        GNOME桌面环境的的字体设置；</a><br><a href="http://fedora.linuxsir.org/main/node/133?q=node/133#5.2">5.2
        Firefox 浏览器的字体设置；</a><br><a href="http://fedora.linuxsir.org/main/node/133?q=node/133#5.3">5.3
        关于OpenOffice 的字体设置；</a><br><a href="http://fedora.linuxsir.org/main/node/133?q=node/133#5.4">5.4
        AbiWord的字体设置；</a></ul>
        <p><a href="http://fedora.linuxsir.org/main/node/133?q=node/133#6">6、存在的
        问题；</a><br>
        <a href="http://fedora.linuxsir.org/main/node/133?q=node/133#7">7、关于本文；</a><br>
        <a href="http://fedora.linuxsir.org/main/node/133?q=node/133#8">8、后记；</a><br>
        <a href="http://fedora.linuxsir.org/main/node/133?q=node/133#9">9、相关文档；</a>
        </p>
    </ul>
    <p><font color="blue"><strong><br>
    +++++++++++++++++++++++++++++++++++++++<br>
    正文<br>
    +++++++++++++++++++++++++++++++++++++++<br>
    </strong></font><br>
    <font id="1" size="4"><strong><br>
    1、首先我们要在/usr/share/fonts/chinese目录中建一个文件夹；<br>
    </strong></font><br>
    比如名为custom<br>
    </p>
    <div class="codeblock"><code>[root@localhost ~]# mkdir
    /usr/share/fonts/chinese/custom</code></div>
    <p>然后把您的字体复制过去就行了；比如我把Windows中的所有字体都复制过去了。里面有Tahoma，Simsun，STSONG ...
    ... </p>
    <p>然后再执行；</p>
    <div class="codeblock"><code>[root@localhost ~]# chmod -R 755&nbsp;
    /usr/share/fonts/chinese/custom</code></div>
    <p>当然要用到超级权限，如果您用的是普通用户，要用su 切换到root ，这个我们在前面的超级权限控制中有讲到；您不妨查一下文档；</p>
    <p><font id="2" size="4"><strong><br>
    2、执行ttmkfdir命令在字体目录；<br>
    </strong></font></p>
    <p>首先我们进入 /usr/share/fonts/chinese/custom目录；</p>
    <div class="codeblock"><code>[root@localhost ~]# cd
    /usr/share/fonts/chinese/custom/</code></div>
    <p>然后执行；</p>
    <div class="codeblock"><code>[root@localhost custom]# ttmkfdir
    -e&nbsp; /usr/share/X11/fonts/encodings/encodings.dir</code></div>
    <p>这样就生成一个fonts.scale的文件；自己看看吧。<br>
    <font id="3" size="4"><strong><br>
    3、更改fonts.conf文件，添加我们添加字体的目录；（可选）<br>
    </strong></font><br>
    在/etc/fonts目录中找到 fonts.conf文件，然后添加如下一行；</p>
    <p>/usr/share/fonts/chinese/custom</p>
    <p>添加到哪呢？找一找吧，下面是添加成功后的示例；</p>
    <div class="codeblock"><code>&lt;!-- Font directory list --&gt;<br>&lt;dir&gt;/usr/share/fonts/chinese/custom&lt;/dir&gt;<br>&lt;dir&gt;/usr/share/fonts&lt;/dir&gt;</code></div>
    <br>
    <font id="4" size="4"><strong><br>
    4、更改 /etc/X11/xorg.conf文件；（可选）<br>
    </strong></font>
    <p>在    FontPath     "unix/:7100"一行的前面加上一行如下；</p>
    <div class="codeblock"><code>FontPath
    "/usr/share/fonts/chinese/custom"</code></div>
    <p><font size="4"><strong>退出桌面，或者重启xfs服务器；</strong></font></p>
    <p>您可以按ctrl+alt+backspace组合键；<br>
    也可以以root权限执行<br>
    </p>
    <div class="codeblock"><code>[root@localhost beinan]#
    /etc/init.d/xfs restart<br>重新启动 xfs：<br>关闭
    xfs：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [确定]<br>启动
    xfs：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [确定]</code></div>
    <p><font id="5" size="4"><strong><br>
    5、应用程序的设置；<br>
    </strong></font><br>
    这个就简单了吧，在程序上用什么字体，就自己选择一下，也没有什么难的；不过桌面字体可能要设置一下。如果您认为不好的话；</p>
    <p><font id="5.1" size="3"><strong><br>
    5.1   GNOME桌面环境的的字体设置；<br>
    </strong></font></p>
    <p>桌面-&gt;首选项-&gt;字体</p>
    <p>我设置的内容如下：</p>
    <p>桌面程序字体   Tahoma  10<br>
    文档字体    Tahoma 10<br>
    桌面字体   Tahoma  10<br>
    窗口标题字体  Tahoma Bold 11<br>
    等宽字体  Monospace</p>
    <p>字体渲染  最佳形状</p>
    <p><font id="5.2" size="4"><strong><br>
    5.2  Firefox 浏览器的字体设置；<br>
    </strong></font><br>
    编辑－＞首选项－＞内容－＞字体和颜色－＞高级</p>
    <p>语言编码：简体中文<br>
    比例字体：无衬线字体    大小：16<br>
    衬线字体：Tahoma<br>
    无衬线字体：Tahoma<br>
    等宽字体：Monospace  大小：16<br>
    屏幕解析度：96dpi  最小字体：12</p>
    <p>要把允许页面选择字体而无需使用上面的字体选中；</p>
    <p>默认字体编码可以不用设置，自己看着办吧；<br>
    <font id="5.3" size="3"><strong><br>
    5.3   关于OpenOffice 的字体设置；<br>
    </strong></font><br>
    OpenOffice的默认字体可能不适合我们的需要，我们习惯用宋体，也就是simsun字体；所以这时我们要设置一下。</p>
    <p>工具－＞选项－＞语言设定 ，在这个选项里，自己点点看吧；大部份不用设置；</p>
    <p>工具－＞选项－＞OpenOffice Writer </p>
    <p>标准字体西文：我用的都是Tahoma；<br>
    标准字体（中日韩）：我都设置成了simsun；<br>
    <font id="5.4" size="3"><strong><br>
    5.4  AbiWord的字体设置；<br>
    </strong></font></p>
    <p>AbiWord的文档字体，如果用默认的话，一般是打不上字的，这时我们要改一下模板；</p>
    <p>一般的情况下AbiWord 安装在
    /usr/share/AbiSuite-2.4目录中，这个需要您自己找找看了。我们在以前有说过怎么查找软件的安装目录；</p>
    <p>我们找到/usr/share/AbiSuite-2.4/templates，然后找到 normal.awt-zh_CN
    文件；最好您先备份一下；</p>
    <p>找到如下的字样；</p>
    <div class="codeblock"><code>font-family:Times New Roman;</code></div>
    <p>改为：</p>
    <div class="codeblock"><code>font-family:font-family:STSong;</code></div>
    <p>当然您得有STSong这个字体，我们在前面提到的复制字体的事，那是个前提；</p>
    <p><font id="6" size="3"><strong><br>
    6、存在的问题；<br>
    </strong></font><br>
    <br>
    好象添加上字体后，系统的速度就降了下来，第一次进入桌面时有点迟钝；大家测试一下看看吧；<br>
    <font id="7" size="3"><strong><br>
    7、关于本文；<br>
    </strong></font><br>
    没有技术含量，不值不提；老酒装在新瓶里，还是那瓶酒；实践是检测真理的唯一标准；<br>
    <font id="8" size="3"><strong><br>
    8、后记；<br>
    </strong></font><br>
    希望能看到大家分享自己的学习成果，分享你我的快乐；帮助他人和得到帮助，都是一种快乐，不是吗？<br>
    这段时间，我没有太多的时间 ，今年的事情特别多，有时得在早上或者晚上写文档，至于修改都放在白天进行，白天没有大块的时间 ，请大家理解理解；谢谢；<br>
    如果有一点时间，我也会接着写文档的，&#8220;时间是海绵里的水，一挤就有了&#8221;，呵。。。。。。</p>
    继续之中。。。。。<br>
    <font id="9" size="3"><strong><br>
    9、相关文档；</strong></font>
    <br><img src ="http://www.cppblog.com/Viking/aggbug/130406.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Viking/" target="_blank">张贵川</a> 2010-10-19 10:39 <a href="http://www.cppblog.com/Viking/archive/2010/10/19/130406.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>关于 bochs 和 bochs 调试</title><link>http://www.cppblog.com/Viking/archive/2010/10/19/130405.html</link><dc:creator>张贵川</dc:creator><author>张贵川</author><pubDate>Tue, 19 Oct 2010 02:36:00 GMT</pubDate><guid>http://www.cppblog.com/Viking/archive/2010/10/19/130405.html</guid><wfw:comment>http://www.cppblog.com/Viking/comments/130405.html</wfw:comment><comments>http://www.cppblog.com/Viking/archive/2010/10/19/130405.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Viking/comments/commentRss/130405.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Viking/services/trackbacks/130405.html</trackback:ping><description><![CDATA[



bochs这个很拉风的虚拟机。却有一个让我郁闷的问题：<br>每次进入虚拟机后，比如进入了free-dos，然后切换回终端，再次切换回来后就无法相应键盘输入了。<br>及每次失去焦点后就无法再次相应键盘了。大小写键可以相应。<br>问赵博，他的机子可以，看配置，一样。蛋疼的是我的就时会有这样的毛病，时而相应，时而死机。<br>目前位置还是没有找到方法解决。<br><br>/**********************************************************/<br>今天终于蛋疼的找到bochs不能相应的原因了。<br>我平常 切换 软件 都使用 ALT + TAB 组合键切换，原来bochs对这两个按键相应有问题。<br>用alt + tab 切换 后 再切换回去就 不响应键盘了。<br>如果是用鼠标切换，那就可以相应了！<br><br>这是一个习惯的郁闷问题！<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ----------------------------10.22<br><br>偶然发现原来也可以使bochs相应切换后的按键问题了。<br>从其他程序切换回来后，再按一下alt键就又可以输入了。。。^_^。<br>这时我调alt + tab 换为 ctrl + tab 组合键作切换程序的时候，发现切换回来后再按下ctrl键就又可以继续输入。不然还是和以前一样。<br>再调回 alt + tab，道理一样，再按下 alt 键又可以继续输入了。。。。<br>/********************************************************/<div>我的调试新技巧：</div><div>其实也不是新的，在<span style="font-family: verdana, arial, sans-serif; font-size: 11px; ">ochsrc_sample.txt&nbsp;</span>有说明：</div><div>在bochs的配置文件最后一句加上：magic_break:enabled=1, 然后在程序里加上xchg bx, bx, 在bochs运行到这里的时候就会停止，这样就可以继续调试下去.....</div><div>用 xp /nuf &nbsp;addr &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 如：xp /10bx &nbsp;0x00500000,&nbsp;</div><div>最好用help x &nbsp;查看xp 和 x 的命令使用方法。个人喜欢用的 &nbsp;x /10mx &nbsp;es:edi &nbsp; 用mx 组合.</div><div>查看内存内容暂时不会。以及GDB+BOCHS调试也还不会.....</div><div><br></div><div>当然，还又其他的调试方法，这需要去研究钩子一类的东西，我研究了就发上来：</div><img src ="http://www.cppblog.com/Viking/aggbug/130405.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Viking/" target="_blank">张贵川</a> 2010-10-19 10:36 <a href="http://www.cppblog.com/Viking/archive/2010/10/19/130405.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>安装debian （大便）系统</title><link>http://www.cppblog.com/Viking/archive/2010/10/18/130228.html</link><dc:creator>张贵川</dc:creator><author>张贵川</author><pubDate>Mon, 18 Oct 2010 01:47:00 GMT</pubDate><guid>http://www.cppblog.com/Viking/archive/2010/10/18/130228.html</guid><wfw:comment>http://www.cppblog.com/Viking/comments/130228.html</wfw:comment><comments>http://www.cppblog.com/Viking/archive/2010/10/18/130228.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Viking/comments/commentRss/130228.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Viking/services/trackbacks/130228.html</trackback:ping><description><![CDATA[<h3>grub</h3>
<p>修改grub文件，使启动项指向该iso文件
</p>
<pre>sudo gedit /boot/grub/menu.lst</pre>
<p>复制下面的部分到menu.lst文件
</p>
<pre>title Ubuntu 9.10 LiveCD<br>root (hd0,3)<br>kernel /vmlinuz boot=casper iso-scan/filename=/ubuntu-9.10-desktop-i386.iso ro quiet splash locale=zh_CN.UTF-8 <br>initrd /initrd.lz <br>boot</pre>
<p>说明：第二行的root (hd0,3)部分依据你的具体情况而定
如果你的/media/disk/位置是 (hd0,1) ，那么你就应该设置为(hd0,1)
设置好后保存退出
多说一句，理论上来说把iso文件放在磁盘的任意位置（包括U盘）都是可以安装的，但是hd编号你必须要搞清楚，尽量让启动安装一次性成功。
</p>
<br>这里是从ubuntu liveCD安装方法上找的一段东西。关键是注意 iso-scan 这句。这个只对ubuntu系统管用。<br><br>如果是硬盘安装debian系统，从debian安装CD上提取出来的vmlinuz 和 initrd.gz 是不能引导系统的。<br>只有下载硬盘版的vmlinuz 和 initrd.gz 。可以从下面网址得到：<br><a  href="http://mirror.switch.ch/ftp/pub/debian/dists/stable/main/installer-i386/current/images/hd-media/">http://mirror.switch.ch/ftp/pub/debian/dists/stable/main/installer-i386/current/images/hd-media/</a><br>之后的grub安装引导我就不多说了。<br>多说一个grub使用的小技巧：<br>&gt;cat (hd0,&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ---------------- 然后按tab键便可以看到所有hd0上的分区（不要再问可以看到分区又什么用）<br>&gt;cat (hd0, 3)/&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ----------------同上按tab键可以看到分区中的内容（如能挂载）<br>&nbsp;<br>还有一点要说的是，grub 不支持ntfs文件系统。所以不要吧 vmlinuz 和 initrd.gz 和 镜像放到 ntfs 格式的分区中。<br><br> <img src ="http://www.cppblog.com/Viking/aggbug/130228.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Viking/" target="_blank">张贵川</a> 2010-10-18 09:47 <a href="http://www.cppblog.com/Viking/archive/2010/10/18/130228.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>简述Linux 文件系统的目录结构</title><link>http://www.cppblog.com/Viking/archive/2010/10/17/130187.html</link><dc:creator>张贵川</dc:creator><author>张贵川</author><pubDate>Sun, 17 Oct 2010 00:18:00 GMT</pubDate><guid>http://www.cppblog.com/Viking/archive/2010/10/17/130187.html</guid><wfw:comment>http://www.cppblog.com/Viking/comments/130187.html</wfw:comment><comments>http://www.cppblog.com/Viking/archive/2010/10/17/130187.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Viking/comments/commentRss/130187.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Viking/services/trackbacks/130187.html</trackback:ping><description><![CDATA[<!-- begin content -->
<p><strong>作者：</strong>北南南北<br>
<strong>来自：</strong>LinuxSir.Org<br>
<strong>摘要：</strong>
Linux文件系统是呈树形结构，了解Linux文件系统的目录结构，对于我们驾驭Linux还是有必要的。本文对Linux下比较重要的目录加以解说，
以答初学者所说的&#8220;杂乱无章&#8221;目录结构，给一个简要的说明。 </p>
<p><font size="4"><strong><br>
目录<br>
</strong></font></p>
<ul><a href="http://www.linuxsir.org/main/?q=node/189#1">1、什么是文件系统； </a><br><a href="http://www.linuxsir.org/main/?q=node/189#2">2、文件系统的组织结构简说；</a><br><a href="http://www.linuxsir.org/main/?q=node/189#3">3、文件系统的组织结构分析； </a><br><a href="http://www.linuxsir.org/main/?q=node/189#4">4、本文未尽事宜； </a><br><a href="http://www.linuxsir.org/main/?q=node/189#5">5、关于本文；</a><br><a href="http://www.linuxsir.org/main/?q=node/189#6">6、后记； </a><br><a href="http://www.linuxsir.org/main/?q=node/189#7">7、参考文档；</a><br><a href="http://www.linuxsir.org/main/?q=node/189#8">8、相关文档；</a></ul>
    <p><font color="blue"><strong><br>
    ++++++++++++++++++++++++++++++++++++++++++++++<br>
    正文<br>
    ++++++++++++++++++++++++++++++++++++++++++++++<br>
    </strong></font></p>
    <p>Linux文件系统结的结构是树形结构，其入口从/开始，了解Linux文件系统的结构，对于我们需要掌握的基础知识点之一。</p>
    <p><font id="1" size="4"><br>
    1、什么是文件系统；<br>
    </font></p>
    <p><strong>请参见：</strong><a href="http://www.linuxsir.org/main/?q=node/115">《Linux
    文件系统概述》</a></p>
    <p><font id="2" size="4"><br>
    2、文件系统的组织结构简说；<br>
    </font></p>
    <p>当您使用Linux的时候，如果您通过ls -la /  就会发现，在/下包涵很多的目录，比如etc、usr、var、bin ... ...
    等目录，而在这些目录中，我们进去看看，发现也有很多的目录或文件。文件系统在Linux下看上去就象树形结构，所以我们可以把文件系统的结构形象的称为
    树形结构。</p>
    <p>查看文件系统的结构，我们可以通过tree命令来实现； </p>
    <div class="codeblock"><code>[root@localhost ~]# tree </code></div>
    <p>不过tree 这个命令目前在Fedora Core 5.0 中已经消失，在Slackware
    10.2的版本中仍有保留。不过其它版本的Linux应该有；由tree命令的输出结果来看，最顶端应该是/，我们称/为Linux的root，也就是
    Linux操作系统的文件系统。Linux的文件系统的入口就是/，所有的目录、文件、设备都在/之下，/就是Linux文件系统的组织者，也是最上级的
    领导者。</p>
    <p>下面我们把Linux文件系统的树形结构的主要目录列一下，主要 </p>
    <p><font id="3" size="4"><br>
    3、文件系统的组织结构分析；<br>
    </font></p>
    <p>文件系统的组织结构分析，我们能分析什么呢？也就是当我们列/目录时，所看到的/usr、/etc ... ... /var
    等目录是做什么用的，这些目录是不是有些特定的用途。无论哪个哪个版本的Linux系统，都有这些目录，这些目录应该是标准的。当然各个Linux发行版
    本也会存在一些小小的差异，但总体来说，还是大体差不多。</p>
    <p>Linux发行版本之间的差别其实很少，差别主要表现在系统管理的特色工具以及软件包管理方式的不同，除此之外，没有什么大的差别；
    比如Fedora软件包管理工具是rpm，而Slackware是pkgtool 或installpkg等；</p>
    <p>言归正传，我们接着说文件系统组织结构。</p>
    <p>/   Linux文件系统的入口，也是处于最高一级的目录； </p>
    <p>/bin   基础系统所需要的那些命令位于此目录，也是最小系统所需要的命令；比如
    ls、cp、mkdir等命令；功能和/usr/bin类似，这个目录中的文件都是可执行的，普通用户都可以使用的命令。做为基础系统所需要的最基础的命
    令就是放在这里。</p>
    <p>/boot  Linux的内核及引导系统程序所需要的文件，比如 vmlinuz initrd.img
    文件都位于这个目录中。在一般情况下，GRUB或LILO系统引导管理器也位于这个目录；</p>
    <p>/dev  设备文件存储目录，比如声卡、磁盘... ...</p>
    <p>/etc  系统配置文件的所在地，一些服务器的配置文件也在这里；比如用户帐号及密码配置文件；</p>
    <p>/home  普通用户家目录默认存放目录；</p>
    <p>/lib  库文件存放目录</p>
    <p>/lost+found
    在ext2或ext3文件系统中，当系统意外崩溃或机器意外关机，而产生一些文件碎片放在这里。当系统启动的过程中fsck工具会检查这里，并修复已经损
    坏的文件系统。 有时系统发生问题，有很多的文件被移到这个目录中，可能会用手工的方式来修复，或移到文件到原来的位置上。</p>
    <p>/media  即插即用型存储设备的挂载点自动在这个目录下创建，比如USB盘系统自动挂载后，会在这个目录下产生一个目录
    ；CDROM/DVD自动挂载后，也会在这个目录中创建一个目录，类似cdrom 的目录。这个只有在最新的发行套件上才有，比如Fedora Core
    4.0 5.0 等。可以参看/etc/fstab的定义；</p>
    <p>/misc </p>
    <p>/mnt  这个目录一般是用于存放挂载储存设备的挂载目录的，比如有cdrom
    等目录。可以参看/etc/fstab的定义。有时我们可以把让系统开机自动挂载文件系统，把挂载点放在这里也是可以的。主要看/etc/fstab中怎
    么定义了；比如光驱可以挂载到/mnt/cdrom 。</p>
    <p>/opt 表示的是可选择的意思，有些软件包也会被安装在这里，也就是自定义软件包，比如在Fedora Core
    5.0中，OpenOffice就是安装在这里。有些我们自己编译的软件包，就可以安装在这个目录中；通过源码包安装的软件，可以通过
    ./configure --prefix=/opt/目录 。</p>
    <p>/proc
    操作系统运行时，进程（正在运行中的程序）信息及内核信息（比如cpu、硬盘分区、内存信息等）存放在这里。/proc目录伪装的文件系统proc的挂载
    目录，proc并不是真正的文件系统，它的定义可以参见 /etc/fstab 。</p>
    <p>/root                   Linux超级权限用户root的家目录；</p>
    <p>/sbin
    大多是涉及系统管理的命令的存放，是超级权限用户root的可执行命令存放地，普通用户无权限执行这个目录下的命令，这个目录和/usr/sbin;
    /usr/X11R6/sbin或/usr/local/sbin目录是相似的；
    我们记住就行了，凡是目录sbin中包含的都是root权限才能执行的。</p>
    <p>/tmp 临时文件目录，有时用户运行程序的时候，会产生临时文件。/tmp就用来存放临时文件的。/var/tmp目录和这个目录相似。</p>
    <p>/usr
    这个是系统存放程序的目录，比如命令、帮助文件等。这个目录下有很多的文件和目录。当我们安装一个Linux发行版官方提供的软件包时，大多安装在这里。
    如果有涉及服务器配置文件的，会把配置文件安装在/etc目录中。/usr目录下包括涉及字体目录/usr/share/fonts ，帮助目录
    /usr/share/man或/usr/share/doc，普通用户可执行文件目录/usr/bin 或/usr/local/bin
    或/usr/X11R6/bin ，超级权限用户root的可执行命令存放目录，比如 /usr/sbin 或/usr/X11R6/sbin
    或/usr/local/sbin 等；还有程序的头文件存放目录/usr/include。 </p>
    <p>/var 这个目录的内容是经常变动的，看名字就知道，我们可以理解为vary的缩写，/var下有/var/log
    这是用来存放系统日志的目录。/var/www目录是定义Apache服务器站点存放目录；/var/lib
    用来存放一些库文件，比如MySQL的，以及MySQL数据库的的存放地；</p>
    <p><strong>我们再补充一下一些比较重要的目录的用途； </strong></p>
    <p>/etc/init.d 这个目录是用来存放系统或服务器以System V模式启动的脚本，这在以System
    V模式启动或初始化的系统中常见。比如Fedora/RedHat；<br>
    /etc/xinit.d 如果服务器是通过xinetd模式运行的，它的脚本要放在这个目录下。有些系统没有这个目录，
    比如Slackware，有些老的版本也没有。在Rehat/Fedora中比较新的版本中存在。</p>
    <p>/etc/rc.d   这是Slackware发行版有的一个目录，是BSD方式启动脚本的存放地；比如定义网卡，服务器开启脚本等。</p>
    <p>/etc/X11 是X-Windows相关的配置文件存放地；<br>
    比如下面的例子：</p>
    <div class="codeblock"><code>[root@localhost ~]# /etc/init.d/sshd
    start&nbsp;&nbsp; 注：启动sshd服务器<br>[root@localhost ~]# /etc/init.d/sshd stop
    注：停止sshd服务器<br>启动 sshd：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    [确定]</code></div>
    <p>这就是典型的sshd 服务器 System V模式启动脚本，通过这运行这个脚本可以启动sshd服务器了。</p>
    <p>/usr/bin 这个目录是可执行程序的目录，普通用户就有权限执行；
    当我们从系统自带的软件包安装一个程序时，他的可执行文件大多会放在这个目录。比如安装gaim软件包时。相似的目录是/usr/local/bin；
    有时/usr/bin中的文件是/usr/local/bin的链接文件； </p>
    <p>/usr/sbin 这个目录也是可执行程序的目录，但大多存放涉及系统管理的命令。只有root权限才能执行；相似目录是/sbin
    或/usr/local/sbin或/usr/X11R6/sbin等；</p>
    <p>/usr/local
    这个目录一般是用来存放用户自编译安装软件的存放目录；一般是通过源码包安装的软件，如果没有特别指定安装目录的话，一般是安装在这个目录中。这个目录下
    面有子目录。自己看看吧。</p>
    <p>/usr/lib  和/lib 目录相似，是库文件的存储目录；</p>
    <p>/usr/share 系统共用的东西存放地，比如 /usr/share/fonts 是字体目录，是用户都共用的吧。</p>
    <p>/usr/share/doc和/usr/share/man帮助文件，也是共用的吧；</p>
    <p>/usr/src 是内核源码存放的目录，比如下面有内核源码目录，比如 linux 、linux-2.xxx.xx
    目录等。有的系统也会把源码软件包安装在这里。比如Fedora/Redhat，当我们安装file.src.rpm的时候，这些软件包会安装在/usr
    /src/redhat相应的目录中。请参考： <a href="http://fedora.linuxsir.org/main/?q=src.spec.html">《file.src.rpm
    使用方法的简单介绍》 </a> 。另外Fedhat 4.0
    5.0，他的内核源码包的目录位于/usr/src/kernels目录下的某个目录中（只有安装后才会生成相应目录）；</p>
    <p>/var/adm
    比如软件包安装信息、日志、管理信息等，在Slackware操作系统中是有这个目录的。在Fedora中好象没有；自己看看吧。<br>
    /var/log 系统日志存放，分析日志要看这个目录的东西；<br>
    /var/spool 打印机、邮件、代理服务器等假脱机目录；</p>
    <p><font id="4" size="4"><br>
    4、本文未尽事宜；<br>
    </font></p>
    <p>由于Linux发行版很多，总有一点差别，但总体上还是差不多。多列目录看看就慢慢明白了。Windows的好多目录，我们也不是一样不知道它是用
    来做什么的，但我们一样用Windows。再说目前Linux一样可以点鼠标来查看这些目录，没有什么难的。如果不会用命令，点鼠标总会看，对不对？</p>
    <p><font id="5" size="4"><br>
    5、关于本文；<br>
    </font></p>
    <p>本文是Linux文件系统的一个组成部份，对于一个系列文档来说，还是必不可缺的，它也是基础文档之一。因为我想能过本文引出Linux文件相关的
    操作的文章 。为新手写的... .... </p>
    <p><font id="6" size="4"><br>
    6、后记；<br>
    </font><br>
    写文档是一个坚持的过程，写文档还是给了我很多的乐趣
    ，权限休闲而写，并没有感觉到有多痛苦；如果一件事被当成压力，也没有什么乐趣而言，如果果真如此，不如不做。在随后，我可能写一写Linux文件相关的
    内容，比如创建、删除、移动、属性、权限等；</p>
    <p><font id="7" size="4"><br>
    7、参考文档<br>
    </font></p>
    <p>man fstab </p>
    <p><font id="8" size="4"><br>
    8、相关文档<br>
    </font></p>
    <p><a href="http://www.linuxsir.org/main/?q=node/115">《Linux 文件系统概述》</a></p>
    <br><img src ="http://www.cppblog.com/Viking/aggbug/130187.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Viking/" target="_blank">张贵川</a> 2010-10-17 08:18 <a href="http://www.cppblog.com/Viking/archive/2010/10/17/130187.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>linux学习方向</title><link>http://www.cppblog.com/Viking/archive/2010/10/14/129927.html</link><dc:creator>张贵川</dc:creator><author>张贵川</author><pubDate>Thu, 14 Oct 2010 13:00:00 GMT</pubDate><guid>http://www.cppblog.com/Viking/archive/2010/10/14/129927.html</guid><wfw:comment>http://www.cppblog.com/Viking/comments/129927.html</wfw:comment><comments>http://www.cppblog.com/Viking/archive/2010/10/14/129927.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Viking/comments/commentRss/129927.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Viking/services/trackbacks/129927.html</trackback:ping><description><![CDATA[<meta http-equiv="content-type" content="text/html; charset=utf-8"><span  style="color: rgb(37, 76, 81); font-family: Arial; font-size: 12px; line-height: 18px; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; ">首先说明希望学linux的朋友能够忘记windows,最起码忘记windows下的盘符、应用程序等基础的东西，其次要深刻明白linux和windows是2个不同的系统平台，可以去对比着学习，但不要直接拿windows那套东西直接套用到linux学习中。<br style="line-height: normal; "><br style="line-height: normal; ">学习方向：<br style="line-height: normal; "><br style="line-height: normal; ">一、桌面系统，就是系统安装好后的视窗系统，在windows下叫windows，在linux下叫 X Windows，其实只是名字不一样而已(ps:看看红旗做的桌面，真是跟windows要做象有多象，真晕，这样虽然有助于linux桌面的使用，但对于linux系统的推广真是没什么好处)<br style="line-height: normal; "><br style="line-height: normal; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 很多初学linux人的安装好linux后，进入其 X windows桌面，兴奋不已，以为大工告成，linux自己会了，这种想法是很可怕的；如果我告诉你linux的X windows环境不是linux 系统，它只是在linux下面运行的应用程序(类似于在windows下运行office2000)，你是怎么想的？<br style="line-height: normal; "><br style="line-height: normal; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; windows下的应用程序几乎是不能直接在linux系统下安装和使用，学编程的应该明白，所以不要去找windows工具盘安装你的RAR,QQ,realone等常用工具，你是装不上的。<br style="line-height: normal; "><br style="line-height: normal; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 你可以尝试去安装你硬件的最新驱动程序，安装linux下的常用工具，做一些linux简单的汉化，你就会理解经常在论坛里问这方面问题的朋友的困难了。<br style="line-height: normal; "><br style="line-height: normal; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 总之，学桌面，不是学linux系统。<br style="line-height: normal; "><br style="line-height: normal; "><br style="line-height: normal; ">二、内核源代码学习。跟unix操作系统一样都是用C语言编写。<br style="line-height: normal; "><br style="line-height: normal; ">&nbsp;&nbsp;&nbsp;&nbsp; 去买正版的linux系统(不是很贵)，会附带一张或者2张linux源代码盘，<br style="line-height: normal; ">&nbsp;&nbsp;&nbsp;&nbsp; linux程序员从这里开始,是起点也是终点~~~~<br style="line-height: normal; ">&nbsp;&nbsp;&nbsp;&nbsp; c就是比较NB,可以本人放弃~~~不是那块料啊!!!!<br style="line-height: normal; "><br style="line-height: normal; ">&nbsp;&nbsp;&nbsp;&nbsp; 很羡慕能经常写些读核日记的朋友，强啊！支持你们~~~~~~~~~<br style="line-height: normal; ">&nbsp;&nbsp;&nbsp;&nbsp; 有兴趣的朋友可以尝试~~~从身边做c的朋友那里看到，以后会受益终身的!<br style="line-height: normal; "><br style="line-height: normal; "><br style="line-height: normal; ">三、系统管理<br style="line-height: normal; "><br style="line-height: normal; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 也就是管理linux系统环境:SHELL、图形、系统服务、硬件驱动等等。<br style="line-height: normal; "><br style="line-height: normal; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 系统管理LINUX跟UNIX类似(是看了些unix系统管理才这样说的)，基本上都是通过命令-----&gt;配置文件-----&gt;脚本文件。<br style="line-height: normal; "><br style="line-height: normal; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 初学这建议从这里开始,不要一味去安装Xwindows,这个X windows环境只要你尽量保持经常使用，相信学会是自然而然的事情.(感觉那真实没什么好学的，只要计算机应用在1年以上的朋友，应该都能在下面操作吧)<br style="line-height: normal; "><br style="line-height: normal; "><br style="line-height: normal; ">四、应用开发<br style="line-height: normal; "><br style="line-height: normal; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 在linux应用上，LINUX确实跟它的竞争对手WINDOWS相比还有一定的差距.(大家都用的饿是盗版啊，如果都用正版的系统，你看用linux的多还是用windows的多，开发 linux程序的人多还是开发windows程序的人多，钱在那里摆着呢)<br style="line-height: normal; "><br style="line-height: normal; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 不过在高端的应用上，linux的市场是越来越大，如：<br style="line-height: normal; "><br style="line-height: normal; ">linux内核开发；<br style="line-height: normal; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ----PDA个人掌上电脑；<br style="line-height: normal; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ----专用的网络设备；防火墙设备，VPN设备。。。我都见过，是用linux编写的，国产的，现在销售的十分不错；<br style="line-height: normal; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ----硬件驱动程序<br style="line-height: normal; "><br style="line-height: normal; "><br style="line-height: normal; ">linux网络编程：<br style="line-height: normal; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ----php编程，建立动态站点；<br style="line-height: normal; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ----jsp编程，<br style="line-height: normal; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ----perl,cgi编程；<br style="line-height: normal; ">linux系统下数据库的开发：<br style="line-height: normal; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ----my sql中小型数据库系统；<br style="line-height: normal; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ----oracle数据库<br style="line-height: normal; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ----DB2数据库，IBM数据库系统<br style="line-height: normal; "><br style="line-height: normal; ">五、服务器领域<br style="line-height: normal; "><br style="line-height: normal; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 一说linux，很多自然就想到了做服务器，但现在网络服务器方面，linux的市场占有率确实是第一的；<br style="line-height: normal; "><br style="line-height: normal; "><br style="line-height: normal; ">linux服务器领域：<br style="line-height: normal; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ----代理服务器，使用的是linux的iptables功能；<br style="line-height: normal; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ----电影服务器，使用的是linux的samba服务的功能，文件和打印共享服务器<br style="line-height: normal; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ----游戏服务器，cs服务器，在linux系统下使用cs的linux版本建立的服务器<br style="line-height: normal; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ----客户存档服务器，采用的linux的ftp服务器,常用的有:wu-ftp,pro-ftp软件建立的<br style="line-height: normal; "><br style="line-height: normal; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ----www服务器，使用的是linux下的apache服务器软件<br style="line-height: normal; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ----ftp服务器，下载服务器，使用的是linux下的wu-ftp,pro-ftp,vs-ftp软件<br style="line-height: normal; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ----mail服务器，采用的是linux下的sendmail，qmail软件<br style="line-height: normal; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ----dns服务器，使用的是linux下的bind软件<br style="line-height: normal; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ----数据库服务器，使用的是mysql或者oracle软件<br style="line-height: normal; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ----防火墙，软件防火墙服务器，使用的是linux的iptables功能建立的<br style="line-height: normal; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ----路由器，软路由器，使用的是linux下的routed软件建立的<br style="line-height: normal; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ----拨号服务器，vpn服务器等等<br style="line-height: normal; "><br style="line-height: normal; "><br style="line-height: normal; ">六、系统集成<br style="line-height: normal; "><br style="line-height: normal; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 范围太广，内容太多。相信IBM等建立的linux研发中心主要就是做这个的。<br style="line-height: normal; "></span>
<img src ="http://www.cppblog.com/Viking/aggbug/129927.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Viking/" target="_blank">张贵川</a> 2010-10-14 21:00 <a href="http://www.cppblog.com/Viking/archive/2010/10/14/129927.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>bochs使用</title><link>http://www.cppblog.com/Viking/archive/2010/10/14/129827.html</link><dc:creator>张贵川</dc:creator><author>张贵川</author><pubDate>Thu, 14 Oct 2010 03:43:00 GMT</pubDate><guid>http://www.cppblog.com/Viking/archive/2010/10/14/129827.html</guid><wfw:comment>http://www.cppblog.com/Viking/comments/129827.html</wfw:comment><comments>http://www.cppblog.com/Viking/archive/2010/10/14/129827.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Viking/comments/commentRss/129827.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Viking/services/trackbacks/129827.html</trackback:ping><description><![CDATA[<meta http-equiv="content-type" content="text/html; charset=utf-8"><span  style="color: rgb(37, 76, 81); font-family: Arial; font-size: 12px; line-height: 18px; "><table style="table-layout: fixed; width: 900px; "><tbody><tr><td style="color: rgb(37, 76, 81); font-family: Arial; word-wrap: break-word; word-break: break-all; visibility: visible !important; zoom: 1 !important; filter: none; font-size: 12px; line-height: 18px; "><div id="blog_text" class="cnt" style="color: rgb(37, 76, 81); font-family: Arial; word-wrap: break-word; word-break: normal; visibility: visible !important; zoom: 1 !important; filter: none; font-size: 12px; line-height: 18px; overflow-x: hidden; overflow-y: hidden; position: static; ">&nbsp;使用插件？&nbsp;<br style="line-height: normal; ">- 用户资源&nbsp;<br style="line-height: normal; ">尝试状态页：告知什么已经尝试做过了，并在Bochs网站上搜寻谁获得了这个工作。&nbsp;<br style="line-height: normal; ">SourceForget&nbsp;<br style="line-height: normal; ">&nbsp;&nbsp;&nbsp;&nbsp; - 查找漏洞报告&nbsp;<br style="line-height: normal; ">&nbsp;&nbsp;&nbsp;&nbsp; - 如何报告问题（象第6章那样提交FIXME请求）&nbsp;<br style="line-height: normal; ">&nbsp;&nbsp;&nbsp;&nbsp; - 如何提出特色请求&nbsp;<br style="line-height: normal; "><br style="line-height: normal; ">5.1 命令行参数&nbsp;<br style="line-height: normal; ">下表列出了可以用在命令行上的参数。其他参数参见<span style="line-height: normal; text-decoration: underline; "><wbr style="line-height: normal; ">bochsrc</span><wbr style="line-height: normal; ">章节。&nbsp;<br style="line-height: normal; ">表5-1 命令行参数&nbsp;<br style="line-height: normal; ">参数&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 描述&nbsp;<br style="line-height: normal; ">-q&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 快速启动（跳过配置界面）&nbsp;<br style="line-height: normal; ">-f filename&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 定义配置文件&nbsp;<br style="line-height: normal; ">-n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 不尝试加载配置文件&nbsp;<br style="line-height: normal; ">-r&nbsp;&nbsp; path&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 定义状况还原文件的路径（如果save/restore支持被编译进来的话）&nbsp;<br style="line-height: normal; ">--help&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 显示帮助信息和退出&nbsp;<br style="line-height: normal; ">启动Bochs后这些参数会被直接处理。下一步是加载默认的或者指定的配置文件（除非使用了-n参数予以禁止）。然后其余的命令行（bochsrc选项）被依据语法分析。读取配置文件后命令行参数会覆盖配置文件的设置。&nbsp;<br style="line-height: normal; "><br style="line-height: normal; ">5.2 搜索配置文件件的顺序&nbsp;<br style="line-height: normal; ">如果在命令行上没有指定配置文件，有没有把加载配置文件禁止，Bochs会搜索一个默认的配置文件。以下是搜索顺序：&nbsp;<br style="line-height: normal; ">&nbsp;&nbsp;&nbsp;&nbsp; 1.在当前目录中的.bochsrc文件&nbsp;<br style="line-height: normal; ">&nbsp;&nbsp;&nbsp;&nbsp; 2.在当前目录中的bochsrc文件&nbsp;<br style="line-height: normal; ">&nbsp;&nbsp;&nbsp;&nbsp; 3.在当前目录中的bochsrc.txt文件&nbsp;<br style="line-height: normal; ">&nbsp;&nbsp;&nbsp;&nbsp; 4.（仅限win32）在当前目录中的bochsrc.bxrc文件&nbsp;<br style="line-height: normal; ">&nbsp;&nbsp;&nbsp;&nbsp; 5.（仅限Unix）在用户home目录中的.bochsrc文件&nbsp;<br style="line-height: normal; ">&nbsp;&nbsp;&nbsp;&nbsp; 6.（仅限Unix）在/etc目录中的bochsrc文件&nbsp;<br style="line-height: normal; "><br style="line-height: normal; ">5.3 'textconfig'模式的配置界面&nbsp;<br style="line-height: normal; ">'textconfig'模式的配置界面是Bochs配置系统的文本模式版本。它是一系列菜单（使用 stdin/stdout），根据这一系列菜单允许你编辑所有控制Bochs行为的设置。如果你没有写一个配置界面行，Bochs会为你选择'textconfig'模式的配置界面作为默认设置（除非Bochs被编译为仅限使用wxWidgets模式）。&nbsp;<br style="line-height: normal; ">'textconfig'模式的配置界面有以下三部分组成：&nbsp;<br style="line-height: normal; ">开始菜单&nbsp;<br style="line-height: normal; ">顶端工具栏&nbsp;<br style="line-height: normal; ">运行时配置&nbsp;<br style="line-height: normal; "><br style="line-height: normal; ">5.3.1 开始菜单&nbsp;<br style="line-height: normal; ">如果你没有使用快速启动参数（-q）来启动Bochs，Bochs配置主菜单将出现：&nbsp;<br style="line-height: normal; ">------------------------------&nbsp;<br style="line-height: normal; ">Bochs Configuration: Main Menu&nbsp;<br style="line-height: normal; ">------------------------------&nbsp;<br style="line-height: normal; ">This is the Bochs Configuration Interface, where you can describe themachine that you want to simulate.&nbsp;&nbsp; Bochs has already searched for aconfiguration file (typically called bochsrc.txt) and loaded it if itcould be found.&nbsp;&nbsp; When you are satisfied with the configuration, goahead and start the simulation.&nbsp;<br style="line-height: normal; ">You can also start bochs with the -q option to skip these menus.&nbsp;<br style="line-height: normal; ">1. Restore factory default configuration&nbsp;<br style="line-height: normal; ">2. Read options from...&nbsp;<br style="line-height: normal; ">3. Edit options&nbsp;<br style="line-height: normal; ">4. Save options to...&nbsp;<br style="line-height: normal; ">5. Begin simulation&nbsp;<br style="line-height: normal; ">6. Quit now&nbsp;<br style="line-height: normal; ">Please choose one: [5]&nbsp;<br style="line-height: normal; ">在这里你可以载入、编辑和保存配置，最后开始仿真。可以没有配置文件而启动Bochs，然后使用这里的&#8220;Edit options&#8221;编辑所有的设置。如果你想把这次的配置应用到以后的Bochs登陆，请不要忘记保存这次的配置信息。&nbsp;<br style="line-height: normal; "><br style="line-height: normal; ">5.3.2 Bochs顶端工具栏&nbsp;<br style="line-height: normal; "><wbr style="line-height: normal; "><wbr style="line-height: normal; "><div forimg="1" style="color: rgb(37, 76, 81); font-family: Arial; word-wrap: break-word; word-break: break-all; visibility: visible !important; zoom: 1 !important; filter: none; font-size: 18px; line-height: normal; text-decoration: none; "><img class="blogimg" border="0" orgsrc="http://b17.photo.store.qq.com/http_imgload.cgi?/rurl4_b=d2fd771124b90db52a0f76910f4b1cd677dda5741ce96c328689f58a9998ef39751ada92330011b5f4ddc67d33af6c44d92f289a2a6c91a59a493fac23c8d0372e5a8d6fe8b282381927f52c5e5d21f4a1a1f957" small="0" src="http://hiphotos.baidu.com/jundao1997/pic/item/d52aab7ae515a3c82e73b39e.jpg" style="line-height: normal; border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px; "></div><br style="line-height: normal; ">顶端工具栏出现在Bochs仿真窗口的顶部。如果你单击这些按钮中的某一个可以控制Bochs的运行时行为。&nbsp;<br style="line-height: normal; ">软盘按钮&nbsp;<br style="line-height: normal; ">在此你可以切换软盘媒体的状态（插入/弹出）。Win32版的Bochs会弹出一个小对话框，让你更改软盘镜像。你可以在配置文件中使用floppya/floppyb选项来安装软驱。&nbsp;<br style="line-height: normal; ">光驱按钮&nbsp;<br style="line-height: normal; ">在此你可以切换光盘媒体的状态（插入/弹出）。你可以在配置文件中使用<span style="line-height: normal; text-decoration: underline; "><wbr style="line-height: normal; ">ata(0-3)-master/-slave</span><wbr style="line-height: normal; ">选项来安装光驱。&nbsp;<br style="line-height: normal; ">鼠标按钮&nbsp;<br style="line-height: normal; ">这个按钮具有让你激活主机鼠标事件的作用。一旦鼠标事件被捕获，你就不能再使用这个按钮来禁止捕获了。在这种情况下，使用&#8220;Ctrl+第三鼠标按钮&#8221;来禁止鼠标事件的捕获。&nbsp;<br style="line-height: normal; "><wbr style="line-height: normal; "><wbr style="line-height: normal; ">支持两键鼠标切换捕获模式现在还没有完成。一些显示库还不支持新特性，但是它已经支持X11、SDL、wxWidgets和Win32。&nbsp;<br style="line-height: normal; ">用户按钮&nbsp;<br style="line-height: normal; ">如果你想发送通过user_shortcut选项定义的键盘快捷键到客户端，按这个按钮。根据使用的display_library选项，有可能在发送之前编辑快捷键。&nbsp;<br style="line-height: normal; ">复制按钮&nbsp;<br style="line-height: normal; ">按这个按钮后文本模式屏的文本能被输出到剪贴板，这个按钮在图形模式下无效。&nbsp;<br style="line-height: normal; ">粘贴按钮&nbsp;<br style="line-height: normal; ">剪贴板上的文本作为模拟按键，也可通过Bochs粘贴到客户操作系统。键盘映射必须支持这一特色功能。&nbsp;<br style="line-height: normal; ">快照按钮&nbsp;<br style="line-height: normal; ">如果你想保存一个文本模式屏的快照按这个按钮。Windows32版的Bochs会弹出一个&#8220;Save as...&#8221;对话框。其他平台会利用修改&#8220;snapshot.txt&#8221;文件实现。&nbsp;<br style="line-height: normal; ">配置按钮&nbsp;<br style="line-height: normal; ">这个按钮会停止Bochs仿真而开始运行时配置。（见下文）&nbsp;<br style="line-height: normal; ">复位按钮&nbsp;<br style="line-height: normal; ">按此按钮触发一次硬件复位。&nbsp;<br style="line-height: normal; ">电源按钮&nbsp;<br style="line-height: normal; ">这个按钮停止仿真并退出Bochs。&nbsp;<br style="line-height: normal; ">在你的主机平台上，这些功能中有的执行或工作起来会有所不同。&nbsp;<br style="line-height: normal; "><br style="line-height: normal; ">5.3.3 运行时配置&nbsp;<br style="line-height: normal; ">如果你想在运行时改变某些设置，你不得不按顶端工具栏上的配置按钮。仿真停止，运行时菜单出现在Windows或xterm的终端控制台上。（译者注：<span style="line-height: normal; font-weight: bold; "><wbr style="line-height: normal; ">xterm</span><wbr style="line-height: normal; ">是一个X Window System上的标准虚拟终端。）&nbsp;<br style="line-height: normal; ">---------------------&nbsp;<br style="line-height: normal; ">Bochs Runtime Options&nbsp;<br style="line-height: normal; ">---------------------&nbsp;<br style="line-height: normal; ">1. Floppy disk 0: /dev/fd0, size=1.44M, inserted&nbsp;<br style="line-height: normal; ">2. Floppy disk 1: floppyb.img, size=1.44M, inserted&nbsp;<br style="line-height: normal; ">3. 1st CDROM: (master on ata1) /dev/cdrom, ejected&nbsp;<br style="line-height: normal; ">4. 2nd CDROM: (slave on ata1) /dev/cdrecorder, ejected&nbsp;<br style="line-height: normal; ">5. 3rd CDROM: (not present)&nbsp;<br style="line-height: normal; ">6. 4th CDROM: (not present)&nbsp;<br style="line-height: normal; ">7. (not implemented)&nbsp;<br style="line-height: normal; ">8. Log options for all devices&nbsp;<br style="line-height: normal; ">9. Log options for individual devices&nbsp;<br style="line-height: normal; ">10. VGA Update Interval: 100000&nbsp;<br style="line-height: normal; ">11. Mouse: disabled&nbsp;<br style="line-height: normal; ">12. Keyboard paste delay: 100000&nbsp;<br style="line-height: normal; ">13. Userbutton shortcut: ctrlaltdel&nbsp;<br style="line-height: normal; ">14. Instruction tracing: off (doesn't exist yet)&nbsp;<br style="line-height: normal; ">15. Continue simulation&nbsp;<br style="line-height: normal; ">16. Quit nowPlease choose one:&nbsp;&nbsp; [15]&nbsp;<br style="line-height: normal; ">在运行时配置中，你可以改变软盘/光盘镜像或者设备，改变日志选项或者调整其他设置。如果你在使用特定的设备时有麻烦，你可以为此设备改变日志选项，结果是获得更多的信息（例如：报告调试信息）。然而，这不能在配置文件中做到。&nbsp;<br style="line-height: normal; "><br style="line-height: normal; ">5.4 保存和还原仿真&nbsp;<br style="line-height: normal; ">从2.3版开始，Bochs具有有限的&#8220;保存/还原&#8221;支持。CPU(s)、内存和所有设备的状态可以被保存。当运行Bochs时，顶端工具栏会有一个&#8220;Suspend&#8221;按钮。依据配置接口和图形用户界面，使用此按钮会有一个让你输入路径的提示，或者让你选择图形用户界面文件夹的对话框。允许在任何时候保存仿真状态，但是我们推荐但仿真空闲时去做这件事。当按下OK/Enter之后，Bochs会把一套文件保存到选定的文件夹中。然而硬盘镜像的状态不被处理，所以Bochs会询问你保存状态后是否想继续。我们不推荐你继续，除非你正运行一个只读的客户系统（例如：Live-CD）。&nbsp;<br style="line-height: normal; ">（译者注：<span style="line-height: normal; font-weight: bold; "><wbr style="line-height: normal; ">Live CD（台译为：自生系统）</span><wbr style="line-height: normal; ">是：&#8220;事先储存于某种可移动存储介质上，可不特定于计算机硬件（non-hardware-specific）而启动的操作系统（通常亦包括一些其他软件）&#8221;，不需安装至计算机的本地外部存储器 - 硬盘。采用的介质包括CD-ROM (Live CD)，DVD (Live DVD)，闪存盘（Live USB）甚至是软盘等。退出自生系统并重新开机后，计算机就可以恢复到原本的操作系统。自生系统的运作机制，是透过&#8220;把原本放在硬盘里的档案，放到内存的虚拟磁盘中&#8221;来运作；因此系统内存愈大，则执行速度愈快。资料来源<a href="http://zh.wikipedia.org/wiki/LiveCD" target="_blank" eventslistuid="e3" style="font-size: 12px; color: rgb(37, 76, 81); text-decoration: none; font-family: 'Courier New', Courier, monospace; line-height: normal; ">http://zh.wikipedia.org/wiki/LiveCD</a><wbr style="line-height: normal; ">）&nbsp;<br style="line-height: normal; ">要还原保存的仿真状态，你可以选择在文本模式下的开始菜单中的还原功能，或者在命令行中指定还原路径：&nbsp;<br style="line-height: normal; ">bochs -r /path/to/save-restore-data&nbsp;<br style="line-height: normal; ">于是Bochs使用保存的配置和日志选项启动，恢复硬件状态开始仿真。在还原模式，Bochs会从命令行中忽略bochsrc选项，也不加载常规的配置文件。（第5章 完）<br style="line-height: normal; "></div><div><br></div></td></tr></tbody></table></span>
<img src ="http://www.cppblog.com/Viking/aggbug/129827.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Viking/" target="_blank">张贵川</a> 2010-10-14 11:43 <a href="http://www.cppblog.com/Viking/archive/2010/10/14/129827.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>linux mount命令使用</title><link>http://www.cppblog.com/Viking/archive/2010/10/14/129824.html</link><dc:creator>张贵川</dc:creator><author>张贵川</author><pubDate>Thu, 14 Oct 2010 02:32:00 GMT</pubDate><guid>http://www.cppblog.com/Viking/archive/2010/10/14/129824.html</guid><wfw:comment>http://www.cppblog.com/Viking/comments/129824.html</wfw:comment><comments>http://www.cppblog.com/Viking/archive/2010/10/14/129824.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Viking/comments/commentRss/129824.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Viking/services/trackbacks/129824.html</trackback:ping><description><![CDATA[<meta http-equiv="content-type" content="text/html; charset=utf-8"><span  style="color: rgb(51, 51, 51); font-family: Verdana, Arial, Helvetica, sans-serif, 宋体; font-size: 14px; line-height: 25px; ">挂接命令(mount)&nbsp;<br>　　首先，介绍一下挂接(mount)命令的使用方法，mount命令参数非常多，这里主要讲一下今天我们要用到的。<br><br>　　命令格式：<br><br>　　mount [-t vfstype] [-o options] device dir<br><br>　　其中：<br><br>　　1.-t vfstype 指定文件系统的类型，通常不必指定。mount 会自动选择正确的类型。常用类型有：<br><br>　　光盘或光盘镜像：iso9660<br><br>　　DOS fat16文件系统：msdos<br><br>　　Windows 9x fat32文件系统：vfat<br><br>　　Windows NT ntfs文件系统：ntfs<br><br>　　Mount Windows文件网络共享：smbfs<br><br>　　UNIX(LINUX) 文件网络共享：nfs<br><br>　　2.-o options 主要用来描述设备或档案的挂接方式。常用的参数有：<br><br>　　loop：用来把一个文件当成硬盘分区挂接上系统<br><br>　　ro：采用只读方式挂接设备<br><br>　　rw：采用读写方式挂接设备<br><br>　　iocharset：指定访问文件系统所用字符集<br><br>　　3.device 要挂接(mount)的设备。<br><br>　　4.dir设备在系统上的挂接点(mount point)。<br><br>　　挂接光盘镜像文件<br><br>　　由于近年来磁盘技术的巨大进步，新的电脑系统都配备了大容量的磁盘系统，在Windows下许多人都习惯把软件和资料做成光盘镜像文件通过虚拟光驱来使用。这样做有许多好处：一、减轻了光驱的磨损;二、现在硬盘容量巨大存放几十个光盘镜像文件不成问题，随用随调十分方便;三、硬盘的读取速度要远远高于光盘的读取速度，CPU占用率大大降低。其实linux系统下制作和使用光盘镜像比Windows系统更方便，不必借用任何第三方软件包。<br><br>　　1、从光盘制作光盘镜像文件。将光盘放入光驱，执行下面的命令。<br><br>　　　#cp /dev/cdrom /home/sunky/mydisk.iso 或<br><br>　　　#dd if=/dev/cdrom of=/home/sunky/mydisk.iso<br><br>　　　注：执行上面的任何一条命令都可将当前光驱里的光盘制作成光盘镜像文件/home/sunky/mydisk.iso<br><br>　　2、将文件和目录制作成光盘镜像文件，执行下面的命令。<br><br>　　　#mkisofs -r -J -V mydisk -o /home/sunky/mydisk.iso /home/sunky/ mydir<br><br>　　　注：这条命令将/home/sunky/mydir目录下所有的目录和文件制作成光盘镜像文件/home/sunky/mydisk.iso，光盘卷标为：mydisk<br><br>　　3、光盘镜像文件的挂接(mount)<br><br>　　　#mkdir /mnt/vcdrom<br><br>　　　注：建立一个目录用来作挂接点(mount point)<br><br>　　　#mount -o loop -t iso9660 /home/sunky/mydisk.iso /mnt/vcdrom<br><br>　　　注：使用/mnt/vcdrom就可以访问盘镜像文件mydisk.iso里的所有文件了。　　<br><br>挂接移动硬盘<br><br>　　对linux系统而言，USB接口的移动硬盘是当作SCSI设备对待的。插入移动硬盘之前，应先用fdisk &#8211;l 或 more /proc/partitions查看系统的硬盘和硬盘分区情况。<br><br>　　[root at pldyrouter /]# fdisk -l<br><br>　　Disk /dev/sda: 73 dot 4 GB, 73407820800 bytes<br><br>　　255 heads, 63 sectors/track, 8924 cylinders<br><br>　　Units = cylinders of 16065 * 512 = 8225280 bytes<br><br>　　Device Boot Start End Blocks Id System<br><br>　　/dev/sda1 1 4 32098+ de Dell Utility<br><br>　　/dev/sda2 * 5 2554 20482875 7 HPFS/NTFS<br><br>　　/dev/sda3 2555 7904 42973875 83 Linux<br><br>　　/dev/sda4 7905 8924 8193150 f Win95 Ext'd (LBA)<br><br>　　/dev/sda5 7905 8924 8193118+ 82 Linux swap<br><br>　　在这里可以清楚地看到系统有一块SCSI硬盘/dev/sda和它的四个磁盘分区/dev/sda1 -- /dev/sda4, /dev/sda5是分区/dev/sda4的逻辑分区。接好移动硬盘后，再用fdisk &#8211;l 或 more /proc/partitions查看系统的硬盘和硬盘分区情况<br><br>　　[root at pldyrouter /]# fdisk -l<br><br>　　Disk /dev/sda: 73 dot 4 GB, 73407820800 bytes<br><br>　　255 heads, 63 sectors/track, 8924 cylinders<br><br>　　Units = cylinders of 16065 * 512 = 8225280 bytes<br><br>　　Device Boot Start End Blocks Id System<br><br>　　/dev/sda1 1 4 32098+ de Dell Utility<br><br>　　/dev/sda2 * 5 2554 20482875 7 HPFS/NTFS<br><br>　　/dev/sda3 2555 7904 42973875 83 Linux<br><br>　　/dev/sda4 7905 8924 8193150 f Win95 Ext'd (LBA)<br><br>　　/dev/sda5 7905 8924 8193118+ 82 Linux swap<br><br>　　Disk /dev/sdc: 40.0 GB, 40007761920 bytes<br><br>　　255 heads, 63 sectors/track, 4864 cylinders<br><br>　　Units = cylinders of 16065 * 512 = 8225280 bytes<br><br>　　Device Boot Start End Blocks Id System<br><br>　　/dev/sdc1 1 510 4096543+ 7 HPFS/NTFS<br><br>　　/dev/sdc2 511 4864 34973505 f Win95 Ext'd (LBA)<br><br>　　/dev/sdc5 511 4864 34973473+ b Win95 FAT32<br><br>　　大家应该可以发现多了一个SCSI硬盘/dev/sdc和它的两个磁盘分区/dev/sdc1?、/dev/sdc2,其中/dev/sdc5是/dev/sdc2分区的逻辑分区。我们可以使用下面的命令挂接/dev/sdc1和/dev/sdc5。<br><br>　　　#mkdir -p /mnt/usbhd1<br><br>　　　#mkdir -p /mnt/usbhd2<br><br>　　　注：建立目录用来作挂接点(mount point)<br><br>　　　#mount -t ntfs /dev/sdc1 /mnt/usbhd1<br><br>　　　#mount -t vfat /dev/sdc5 /mnt/usbhd2&nbsp;<br><br>　　　注：对ntfs格式的磁盘分区应使用-t ntfs 参数，对fat32格式的磁盘分区应使用-t vfat参数。若汉字文件名显示为乱码或不显示，可以使用下面的命令格式。<br><br>　　　#mount -t ntfs -o iocharset=cp936 /dev/sdc1 /mnt/usbhd1<br><br>　　　#mount -t vfat -o iocharset=cp936 /dev/sdc5 /mnt/usbhd2<br><br>　　linux系统下使用fdisk分区命令和mkfs文件系统创建命令可以将移动硬盘的分区制作成linux系统所特有的ext2、ext3格式。这样，在linux下使用就更方便了。使用下面的命令直接挂接即可。<br><br>　　　#mount /dev/sdc1 /mnt/usbhd1　<br><br>挂接U盘<br><br>　　和USB接口的移动硬盘一样对linux系统而言U盘也是当作SCSI设备对待的。使用方法和移动硬盘完全一样。插入U盘之前，应先用fdisk &#8211;l 或 more /proc/partitions查看系统的硬盘和硬盘分区情况。<br><br>　　[root at pldyrouter root]# fdisk -l<br><br>　　Disk /dev/sda: 73 dot 4 GB, 73407820800 bytes<br><br>　　255 heads, 63 sectors/track, 8924 cylinders<br><br>　　Units = cylinders of 16065 * 512 = 8225280 bytes<br><br>　　Device Boot Start End Blocks Id System<br><br>　　/dev/sda1 1 4 32098+ de Dell Utility<br><br>　　/dev/sda2 * 5 2554 20482875 7 HPFS/NTFS<br><br>　　/dev/sda3 2555 7904 42973875 83 Linux<br><br>　　/dev/sda4 7905 8924 8193150 f Win95 Ext'd (LBA)<br><br>　　/dev/sda5 7905 8924 8193118+ 82 Linux swap<br><br>　　插入U盘后，再用fdisk &#8211;l 或 more /proc/partitions查看系统的硬盘和硬盘分区情况。<br><br>　　[root at pldyrouter root]# fdisk -l<br><br>　　Disk /dev/sda: 73 dot 4 GB, 73407820800 bytes<br><br>　　255 heads, 63 sectors/track, 8924 cylinders<br><br>　　Units = cylinders of 16065 * 512 = 8225280 bytes<br><br>　　Device Boot Start End Blocks Id System<br><br>　　/dev/sda1 1 4 32098+ de Dell Utility<br><br>　　/dev/sda2 * 5 2554 20482875 7 HPFS/NTFS<br><br>　　/dev/sda3 2555 7904 42973875 83 Linux<br><br>　　/dev/sda4 7905 8924 8193150 f Win95 Ext'd (LBA)<br><br>　　/dev/sda5 7905 8924 8193118+ 82 Linux swap<br><br>　　Disk /dev/sdd: 131 MB, 131072000 bytes<br><br>　　9 heads, 32 sectors/track, 888 cylinders<br><br>　　Units = cylinders of 288 * 512 = 147456 bytes<br><br>　　Device Boot Start End Blocks Id System<br><br>　　/dev/sdd1 * 1 889 127983+ b Win95 FAT32<br><br>　　Partition 1 has different physical/logical endings:<br><br>　　phys=(1000, 8, 32) logical=(888, 7, 31)<br><br>　　系统多了一个SCSI硬盘/dev/sdd和一个磁盘分区/dev/sdd1,/dev/sdd1就是我们要挂接的U盘。<br><br>　　#mkdir -p /mnt/usb<br><br>　　注：建立一个目录用来作挂接点(mount point)<br><br>　　#mount -t vfat /dev/sdd1 /mnt/usb<br><br>　　注：现在可以通过/mnt/usb来访问U盘了, 若汉字文件名显示为乱码或不显示，可以使用下面的命令。<br><br>　　#mount -t vfat -o iocharset=cp936 /dev/sdd1 /mnt/usb<br><br>挂接Windows文件共享<br><br>　　Windows网络共享的核心是SMB/CIFS，在linux下要挂接(mount)windows的磁盘共享，就必须安装和使用samba软件包。现在流行的linux发行版绝大多数已经包含了samba软件包，如果安装linux系统时未安装samba请首先安装samba。当然也可以到<a href="http://www.samba.org/" target="_blank" style="color: rgb(7, 81, 154); text-decoration: none; ">www.samba.org</a>网站下载......新的版本是3.0.10版。<br><br>　　当windows系统共享设置好以后，就可以在linux客户端挂接(mount)了，具体操作如下：<br><br>　　# mkdir &#8211;p /mnt/samba&nbsp;<br><br>　　注：建立一个目录用来作挂接点(mount point)<br><br>　　# mount -t smbfs -o username=administrator,password=pldy123 //10.140.133.23/c$ /mnt/samba<br><br>　　注：administrator 和 pldy123 是ip地址为10.140.133.23 windows计算机的一个用户名和密码，c$是这台计算机的一个磁盘共享<br><br>　　如此就可以在linux系统上通过/mnt/samba来访问windows系统磁盘上的文件了。以上操作在redhat as server 3、redflag server 4.1、suse server 9以及windows NT 4.0、windows 2000、windows xp、windows 2003环境下测试通过。<br><br>　　挂接UNIX系统NFS文件共享<br><br>　　类似于windows的网络共享，UNIX(Linux)系统也有自己的网络共享，那就是NFS(网络文件系统)，下面我们就以SUN Solaris2.8和REDHAT as server 3 为例简单介绍一下在linux下如何mount nfs网络共享。<br><br>　　在linux客户端挂接(mount)NFS磁盘共享之前，必须先配置好NFS服务端。<br><br>　　1、Solaris系统NFS服务端配置方法如下：<br><br>　　　(1)修改 /etc/dfs/dfstab, 增加共享目录<br><br>　　　　　　share -F nfs -o rw /export/home/sunky<br><br>　　　(2)启动nfs服务<br><br>　　　　　　# /etc/init.d/nfs.server start<br><br>　　　(3)NFS服务启动以后，也可以使用下面的命令增加新的共享<br><br>　　　　　　# share /export/home/sunky1<br><br>　　　　　　# share /export/home/sunky2<br><br>　　　注：/export/home/sunky和/export/home/sunky1是准备共享的目录<br><br>　　2、linux系统NFS服务端配置方法如下：<br><br>　　　(1)修改 /etc/exports,增加共享目录<br><br>　　/export/home/sunky 10.140.133.23(rw)<br><br>　　/export/home/sunky1 *(rw)<br><br>　　/export/home/sunky2 linux-client(rw)&nbsp;<br><br>　　　注：/export/home/目录下的sunky、sunky1、sunky2是准备共享的目录，10.140.133.23、*、linux- client是被允许挂接此共享linux客户机的IP地址或主机名。如果要使用主机名linux-client必须在服务端主机/etc/hosts文件里增加linux-client主机ip定义。格式如下：<br><br>　　　10.140.133.23 linux-client<br><br>　　　(2)启动与停止NFS服务<br><br>　　　/etc/rc.d/init.d/portmap start (在REDHAT中PORTMAP是默认启动的)&nbsp;<br><br>　　　/etc/rc.d/init.d/nfs start 启动NFS服务<br><br>　　　/etc/rc.d/init.d/nfs stop 停止NFS服务<br><br>　　　注：若修改/etc/export文件增加新的共享，应先停止NFS服务，再启动NFS服务方能使新增加的共享起作用。使用命令exportfs -rv也可以达到同样的效果。<br><br>　　3、linux客户端挂接(mount)其他linux系统或UNIX系统的NFS共享<br><br>　　　# mkdir &#8211;p /mnt/nfs<br><br>　　　注：建立一个目录用来作挂接点(mount point)<br><br>　　　#mount -t nfs -o rw 10.140.133.9:/export/home/sunky /mnt/nfs<br><br>　　　注：这里我们假设10.140.133.9是NFS服务端的主机IP地址，当然这里也可以使用主机名，但必须在本机/etc/hosts文件里增加服务端ip定义。/export/home/sunky为服务端共享的目录。<br><br>　　如此就可以在linux客户端通过/mnt/nfs来访问其它linux系统或UNIX系统以NFS方式共享出来的文件了。以上操作在redhat as server 3、redflag server4.1、suse server 9以及Solaris 7、Solaris 8、Solaris 9 for x86&amp;sparc环境下测试通过。</span>

<div><font  color="#333333" face="Verdana, Arial, Helvetica, sans-serif, 宋体" size="4"><span  style="font-size: 14px; line-height: 25px;"><br></span></font></div><div><font  color="#333333" face="Verdana, Arial, Helvetica, sans-serif, 宋体" size="4"><span  style="font-size: 14px; line-height: 25px;">LOOP设备</span></font></div><div><font  color="#333333" face="Verdana, Arial, Helvetica, sans-serif, 宋体" size="4"><span  style="font-size: 14px; line-height: 25px;"><meta http-equiv="content-type" content="text/html; charset=utf-8"><span  style="font-family: Arial; font-size: 12px; line-height: 18px; border-collapse: collapse; "><h1 id="subject_tpc" class="read_h1" style="outline-style: none; outline-width: initial; outline-color: initial; margin-top: 5px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 16px; font-weight: 700; color: rgb(1, 76, 144); line-height: 1.2; ">loop 设备 (循环设备)</h1><div class="tpc_content" style="outline-style: none; outline-width: initial; outline-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 2px; padding-bottom: 20px; padding-left: 2px; word-break: break-all; word-wrap: break-word; font-family: Arial; line-height: 1.8em; "><div id="p_tpc" class="c" style="outline-style: none; outline-width: initial; outline-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; word-break: break-all; word-wrap: break-word; clear: both; font: normal normal normal 0px/0px Arial; overflow-x: hidden; overflow-y: hidden; height: 0px; width: 0px; "></div><div class="f14 mb10" id="read_tpc" style="outline-style: none; outline-width: initial; outline-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; word-break: break-all; word-wrap: break-word; font-size: 14px; "><strong style="outline-style: none; outline-width: initial; outline-color: initial; font-weight: 700; ">1. loop 设备介绍</strong><br style="outline-style: none; outline-width: initial; outline-color: initial; ">在类 UNIX 系统里，loop 设备是一种伪设备(pseudo-device)，或者也可以说是仿真设备。它能使我们像块设备一样访问一个文件。<br style="outline-style: none; outline-width: initial; outline-color: initial; "><br style="outline-style: none; outline-width: initial; outline-color: initial; ">在使用之前，一个 loop 设备必须要和一个文件进行连接。这种结合方式给用户提供了一个替代块特殊文件的接口。因此，如果这个文件包含有一个完整的文件系统，那么这个文件就可以像一个<u style="outline-style: none; outline-width: initial; outline-color: initial; ">磁盘设备</u>一样被 mount 起来。<u style="outline-style: none; outline-width: initial; outline-color: initial; "><br style="outline-style: none; outline-width: initial; outline-color: initial; "><br style="outline-style: none; outline-width: initial; outline-color: initial; "></u>上面说的文件格式，我们经常见到的是 CD 或 DVD 的 ISO 光盘镜像文件或者是软盘(硬盘)的 *.img 镜像文件。通过这种 loop mount (回环mount)的方式，这些镜像文件就可以被 mount 到当前文件系统的一个目录下。<u style="outline-style: none; outline-width: initial; outline-color: initial; "><br style="outline-style: none; outline-width: initial; outline-color: initial; "><br style="outline-style: none; outline-width: initial; outline-color: initial; "></u>至此，顺便可以再理解一下 loop 之含义：对于第一层文件系统，它直接安装在我们计算机的物理设备之上；而对于这种被 mount 起来的镜像文件(它也包含有文件系统)，它是建立在第一层文件系统之上，这样看来，它就像是在第一层文件系统之上再绕了一圈的文件系统，所以称为 loop。<u style="outline-style: none; outline-width: initial; outline-color: initial; "><br style="outline-style: none; outline-width: initial; outline-color: initial; "><br style="outline-style: none; outline-width: initial; outline-color: initial; "></u>在 Linux 里，loop 设备的设备名形如：<u style="outline-style: none; outline-width: initial; outline-color: initial; "><br style="outline-style: none; outline-width: initial; outline-color: initial; "></u><blockquote class="blockquote3" style="outline-style: none; outline-width: initial; outline-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 5px; padding-right: 10px; padding-bottom: 5px; padding-left: 10px; quotes: none; clear: left; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: dashed; border-right-style: dashed; border-bottom-style: dashed; border-left-style: dashed; border-top-color: rgb(204, 204, 204); border-right-color: rgb(204, 204, 204); border-bottom-color: rgb(204, 204, 204); border-left-color: rgb(204, 204, 204); background-image: url(http://www.groad.net/bbs/images/blockquote3.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(247, 247, 247); background-position: 100% 0%; background-repeat: no-repeat no-repeat; "><div class="quote" style="outline-style: none; outline-width: initial; outline-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; word-break: break-all; word-wrap: break-word; color: rgb(153, 153, 153); font-size: 12px; ">引用</div><div class="text" style="outline-style: none; outline-width: initial; outline-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; word-break: break-all; word-wrap: break-word; ">ls /dev/loop*<br style="outline-style: none; outline-width: initial; outline-color: initial; ">/dev/loop0&nbsp; /dev/loop2&nbsp; /dev/loop4&nbsp; /dev/loop6<br style="outline-style: none; outline-width: initial; outline-color: initial; ">/dev/loop1&nbsp; /dev/loop3&nbsp; /dev/loop5&nbsp; /dev/loop7<br style="outline-style: none; outline-width: initial; outline-color: initial; ">... ...</div></blockquote><u style="outline-style: none; outline-width: initial; outline-color: initial; "><br style="outline-style: none; outline-width: initial; outline-color: initial; "></u>例如，要在一个目录下 mount 一个包含有磁盘镜像的文件，需要分 2 步走：<br style="outline-style: none; outline-width: initial; outline-color: initial; "><blockquote class="blockquote3" style="outline-style: none; outline-width: initial; outline-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 5px; padding-right: 10px; padding-bottom: 5px; padding-left: 10px; quotes: none; clear: left; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: dashed; border-right-style: dashed; border-bottom-style: dashed; border-left-style: dashed; border-top-color: rgb(204, 204, 204); border-right-color: rgb(204, 204, 204); border-bottom-color: rgb(204, 204, 204); border-left-color: rgb(204, 204, 204); background-image: url(http://www.groad.net/bbs/images/blockquote3.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(247, 247, 247); background-position: 100% 0%; background-repeat: no-repeat no-repeat; "><div class="quote" style="outline-style: none; outline-width: initial; outline-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; word-break: break-all; word-wrap: break-word; color: rgb(153, 153, 153); font-size: 12px; ">引用</div><div class="text" style="outline-style: none; outline-width: initial; outline-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; word-break: break-all; word-wrap: break-word; ">losetup /dev/loop0 disk.img&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="outline-style: none; outline-width: initial; outline-color: initial; color: rgb(0, 0, 255); ">#使磁盘镜像文件与循环设备连结起来</span><br style="outline-style: none; outline-width: initial; outline-color: initial; ">mount /dev/loop0 /home/groad/disk_test&nbsp;&nbsp;&nbsp;<span style="outline-style: none; outline-width: initial; outline-color: initial; color: rgb(0, 0, 255); ">#将循环设备 mount 到目录 disk_test 下</span></div></blockquote><br style="outline-style: none; outline-width: initial; outline-color: initial; ">经过上面的两个命令后，镜像文件就如同一个文件系统挂载在 disk_test 目录下，当然我们也可以往镜像里面添加文件。<u style="outline-style: none; outline-width: initial; outline-color: initial; "><br style="outline-style: none; outline-width: initial; outline-color: initial; "><br style="outline-style: none; outline-width: initial; outline-color: initial; "></u>其实上面的两个步骤可以写成一个步骤：<br style="outline-style: none; outline-width: initial; outline-color: initial; "><blockquote class="blockquote3" style="outline-style: none; outline-width: initial; outline-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 5px; padding-right: 10px; padding-bottom: 5px; padding-left: 10px; quotes: none; clear: left; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: dashed; border-right-style: dashed; border-bottom-style: dashed; border-left-style: dashed; border-top-color: rgb(204, 204, 204); border-right-color: rgb(204, 204, 204); border-bottom-color: rgb(204, 204, 204); border-left-color: rgb(204, 204, 204); background-image: url(http://www.groad.net/bbs/images/blockquote3.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(247, 247, 247); background-position: 100% 0%; background-repeat: no-repeat no-repeat; "><div class="quote" style="outline-style: none; outline-width: initial; outline-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; word-break: break-all; word-wrap: break-word; color: rgb(153, 153, 153); font-size: 12px; ">引用</div><div class="text" style="outline-style: none; outline-width: initial; outline-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; word-break: break-all; word-wrap: break-word; ">mount -t minix -o loop ./disk.img ./disk_test</div></blockquote><br style="outline-style: none; outline-width: initial; outline-color: initial; ">其中，加了 -o loop 指定后，那么也就相当于执行了第一行的 losetup 命令。做一个简单的试验可以证明一点，首先分开执行 losetup 和 mount 命令，那么我们看到我们可以 mount 的是 /dev/loop0 这个设备。当我们在 mount 中指定参数 -o loop 时，镜像文件其实已和 /dev/loop1 相关联，这里我们在挂载镜像文件后，尝试再执行一下 mount -t minix /dev/loop1 ./disk_test 来验证，它会得到提示：<br style="outline-style: none; outline-width: initial; outline-color: initial; "><blockquote class="blockquote3" style="outline-style: none; outline-width: initial; outline-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 5px; padding-right: 10px; padding-bottom: 5px; padding-left: 10px; quotes: none; clear: left; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: dashed; border-right-style: dashed; border-bottom-style: dashed; border-left-style: dashed; border-top-color: rgb(204, 204, 204); border-right-color: rgb(204, 204, 204); border-bottom-color: rgb(204, 204, 204); border-left-color: rgb(204, 204, 204); background-image: url(http://www.groad.net/bbs/images/blockquote3.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(247, 247, 247); background-position: 100% 0%; background-repeat: no-repeat no-repeat; "><div class="quote" style="outline-style: none; outline-width: initial; outline-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; word-break: break-all; word-wrap: break-word; color: rgb(153, 153, 153); font-size: 12px; ">引用</div><div class="text" style="outline-style: none; outline-width: initial; outline-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; word-break: break-all; word-wrap: break-word; ">linux-z13e:/usr/local/share/bochs/Linux011/temp # mount -t minix /dev/loop1 ./test_dir/&nbsp;<br style="outline-style: none; outline-width: initial; outline-color: initial; ">mount: /dev/loop1 already mounted or ./test_dir/ busy<br style="outline-style: none; outline-width: initial; outline-color: initial; ">mount: according to mtab, /dev/loop1 is already mounted on /usr/local/share/bochs/Linux011/temp/test_dir</div></blockquote><u style="outline-style: none; outline-width: initial; outline-color: initial; "><br style="outline-style: none; outline-width: initial; outline-color: initial; "></u><br style="outline-style: none; outline-width: initial; outline-color: initial; ">最后，要卸载的话，就直接 umount /dev/loop0 即可。</div><div class="f14 mb10" id="read_tpc" style="outline-style: none; outline-width: initial; outline-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; word-break: break-all; word-wrap: break-word; font-size: 14px; "><br></div><div class="f14 mb10" id="read_tpc" style="outline-style: none; outline-width: initial; outline-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; word-break: break-all; word-wrap: break-word; font-size: 14px; "><meta http-equiv="content-type" content="text/html; charset=utf-8"><span  style="font-size: 12px; line-height: 18px; "><h1 id="subject_tpc" class="read_h1" style="outline-style: none; outline-width: initial; outline-color: initial; margin-top: 5px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 16px; font-weight: 700; color: rgb(1, 76, 144); line-height: 1.2; ">losetup -- 设置循环设备</h1><div class="tpc_content" style="outline-style: none; outline-width: initial; outline-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 2px; padding-bottom: 20px; padding-left: 2px; word-break: break-all; word-wrap: break-word; font-family: Arial; line-height: 1.8em; "><div id="p_tpc" class="c" style="outline-style: none; outline-width: initial; outline-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; word-break: break-all; word-wrap: break-word; clear: both; font: normal normal normal 0px/0px Arial; overflow-x: hidden; overflow-y: hidden; height: 0px; width: 0px; "></div><div class="f14 mb10" id="read_tpc" style="outline-style: none; outline-width: initial; outline-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; word-break: break-all; word-wrap: break-word; font-size: 14px; "><strong style="outline-style: none; outline-width: initial; outline-color: initial; font-weight: 700; ">格式</strong>：<br style="outline-style: none; outline-width: initial; outline-color: initial; "><blockquote class="blockquote3" style="outline-style: none; outline-width: initial; outline-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 5px; padding-right: 10px; padding-bottom: 5px; padding-left: 10px; quotes: none; clear: left; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: dashed; border-right-style: dashed; border-bottom-style: dashed; border-left-style: dashed; border-top-color: rgb(204, 204, 204); border-right-color: rgb(204, 204, 204); border-bottom-color: rgb(204, 204, 204); border-left-color: rgb(204, 204, 204); background-image: url(http://www.groad.net/bbs/images/blockquote3.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(247, 247, 247); background-position: 100% 0%; background-repeat: no-repeat no-repeat; "><div class="quote" style="outline-style: none; outline-width: initial; outline-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; word-break: break-all; word-wrap: break-word; color: rgb(153, 153, 153); font-size: 12px; ">引用</div><div class="text" style="outline-style: none; outline-width: initial; outline-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; word-break: break-all; word-wrap: break-word; ">losetup [ -e encryption ] [ -o offset ] loop_device file<br style="outline-style: none; outline-width: initial; outline-color: initial; ">losetup [ -d ] loop_device</div></blockquote><br style="outline-style: none; outline-width: initial; outline-color: initial; "><strong style="outline-style: none; outline-width: initial; outline-color: initial; font-weight: 700; ">说明</strong>：<br style="outline-style: none; outline-width: initial; outline-color: initial; ">此命令用来设置循环设备。循环设备可把文件虚拟成块设备，籍此来模拟整个文件系统，让用户得以将其视为硬盘驱动器，光驱或软驱等设备，并挂入当作目录来使用。<br style="outline-style: none; outline-width: initial; outline-color: initial; ">上面，命令格式中的选项与参数名：<br style="outline-style: none; outline-width: initial; outline-color: initial; "><span style="outline-style: none; outline-width: initial; outline-color: initial; color: rgb(255, 0, 204); ">-e</span>&nbsp;表示加密的方式<br style="outline-style: none; outline-width: initial; outline-color: initial; "><span style="outline-style: none; outline-width: initial; outline-color: initial; color: rgb(255, 0, 204); ">-o</span>&nbsp;设置数据偏移量<br style="outline-style: none; outline-width: initial; outline-color: initial; "><span style="outline-style: none; outline-width: initial; outline-color: initial; color: rgb(255, 0, 204); ">-d</span>&nbsp;卸载设备<br style="outline-style: none; outline-width: initial; outline-color: initial; "><span style="outline-style: none; outline-width: initial; outline-color: initial; color: rgb(255, 0, 204); ">loop_device</span>&nbsp;循环设备名，在 linux 下如 /dev/loop0 , /dev/loop1 等。<br style="outline-style: none; outline-width: initial; outline-color: initial; "><span style="outline-style: none; outline-width: initial; outline-color: initial; color: rgb(255, 0, 204); ">file</span>&nbsp;要与循环设备相关联的文件名，这个往往是一个磁盘镜象文件，如 *.img</div></div></span></div></div></span></span></font></div><img src ="http://www.cppblog.com/Viking/aggbug/129824.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Viking/" target="_blank">张贵川</a> 2010-10-14 10:32 <a href="http://www.cppblog.com/Viking/archive/2010/10/14/129824.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>dgb的使用</title><link>http://www.cppblog.com/Viking/archive/2010/10/12/129594.html</link><dc:creator>张贵川</dc:creator><author>张贵川</author><pubDate>Tue, 12 Oct 2010 03:56:00 GMT</pubDate><guid>http://www.cppblog.com/Viking/archive/2010/10/12/129594.html</guid><wfw:comment>http://www.cppblog.com/Viking/comments/129594.html</wfw:comment><comments>http://www.cppblog.com/Viking/archive/2010/10/12/129594.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Viking/comments/commentRss/129594.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Viking/services/trackbacks/129594.html</trackback:ping><description><![CDATA[<br>
<font id="zoom" class="f14">
<font color="#cccccc">
<!-- 正文begin -->
一：列文件清单 <br>1． List <br>(gdb) list line1,line2 <br><br>二：执行程序 <br>要想运行准备
调试的程序，可使用run命令，在它后面可以跟随发给该程序的任何参数，包括标准输入和标准输出说明符(&lt;和&gt;)和外壳通配符
（*、？、[、]）在内。 <br>如果你使用不带参数的run命令，gdb就再次使用你给予前一条run命令的参数，这是很有用的。 <br>利用
set args 命令就可以修改发送给程序的参数，而使用show args 命令就可以查看其缺省参数的列表。 <br>（gdb）set args
&#8211;b &#8211;x <br>(gdb) show args <br>backtrace命令为堆栈提供向后跟踪功能。 <br>Backtrace
命令产生一张列表，包含着从最近的过程开始的所以有效过程和调用这些过程的参数。 <br><br>三：显示数据 <br>利用print
命令可以检查各个变量的值。 <br>(gdb) print p (p为变量名) <br>whatis 命令可以显示某个变量的类型 <br>(gdb)
whatis p <br>type = int * <br><br>print
是gdb的一个功能很强的命令，利用它可以显示被调试的语言中任何有效的表达式。表达式除了包含你程序中的变量外，还可以包含以下内容： <br>l
对程序中函数的调用 <br>(gdb) print find_entry(1,0) <br>l 数据结构和其他复杂对象 <br>(gdb)
print *table_start <br>$8={e=reference=&#8217;\000&#8217;,location=0x0,next=0x0} <br>l
值的历史成分 <br>(gdb)print $1 ($1为历史记录变量,在以后可以直接引用 $1 的值) <br>l 人为数组 <br>人为数
组提供了一种去显示存储器块（数组节或动态分配的存储区）内容的方法。早期的调试程序没有很好的方法将任意的指针换成一个数组。就像对待参数一样，让我们
查看内存中在变量h后面的10个整数，一个动态数组的语法如下所示： <br>base@length <br>因此，要想显示在h后面的10个元素，可
以使用h@10： <br>(gdb)print h@10 <br>$13=(-1,345,23,-234,0,0,0,98,345,10) <br><br>四：
断点(breakpoint) <br>break命令（可以简写为b）可以用来在调试的程序中设置断点，该命令有如下四种形式： <br>l
break line-number 使程序恰好在执行给定行之前停止。 <br>l break function-name
使程序恰好在进入指定的函数之前停止。 <br>l break line-or-function if condition
如果condition（条件）是真，程序到达指定行或函数时停止。 <br>l break routine-name 在指定例程的入口处设置断点 <br><br>如
果该程序是由很多原文件构成的，你可以在各个原文件中设置断点，而不是在当前的原文件中设置断点，其方法如下： <br>(gdb) break
filename:line-number <br>(gdb) break filename:function-name <br><br>要想设置
一个条件断点，可以利用break if命令，如下所示： <br>(gdb) break line-or-function if expr <br>例：
<br>(gdb) break 46 if testsize==100 <br><br>从断点继续运行：countinue 命令 <br>五．
断点的管理 <br><br>1． 显示当前gdb的断点信息： <br>(gdb) info break <br>他会以如下的形式显示所有的断点信
息： <br>Num Type Disp Enb Address What <br>1 breakpoint keep y 0x000028bc
in init_random at qsort2.c:155 <br>2 breakpoint keep y 0x0000291c in
init_organ at qsort2.c:168 <br>(gdb) <br>2.删除指定的某个断点： <br>(gdb) delete
breakpoint 1 <br>该命令将会删除编号为1的断点，如果不带编号参数，将删除所有的断点 <br>(gdb) delete
breakpoint <br>3.禁止使用某个断点 <br>(gdb) disable breakpoint 1 <br>该命令将禁止断点
1,同时断点信息的 (Enb)域将变为 n <br>4．允许使用某个断点 <br>(gdb) enable breakpoint 1 <br>该
命令将允许断点 1,同时断点信息的 (Enb)域将变为 y <br>5．清除原文件中某一代码行上的所有断点 <br>(gdb)clean
number <br>注：number 为原文件的某个代码行的行号 <br>六．变量的检查和赋值 <br>l whatis:识别数组或变量的类型
<br>l ptype:比whatis的功能更强，他可以提供一个结构的定义 <br>l set variable:将值赋予变量 <br>l
print 除了显示一个变量的值外，还可以用来赋值 <br><br>七．单步执行 <br>l next <br>不进入的单步执行 <br>l
step <br>进入的单步执行 <br>如果已经进入了某函数，而想退出该函数返回到它的调用函数中，可使用命令finish <br>八．函数的调
用 <br>l call name 调用和执行一个函数 <br>(gdb) call gen_and_sork( 1234,1,0 ) <br>(gdb)
call printf(&#8220;abcd&#8221;) <br>$1=4 <br>l finish 结束执行当前函数，显示其返回值（如果有的话） <br><br>九．
机器语言工具 <br>有一组专用的gdb变量可以用来检查和修改计算机的通用寄存器，gdb提供了目前每一台计算机中实际使用的4个寄存器的标准名字：
<br>l $pc ： 程序计数器 <br>l $fp ： 帧指针（当前堆栈帧） <br>l $sp ： 栈指针 <br>l $ps ：
处理器状态 <br><br>十．信号 <br>gdb通常可以捕捉到发送给它的大多数信号，通过捕捉信号，它就可决定对于正在运行的进程要做些什么工
作。例如，按CTRL-C将中断信号发送给gdb，通常就会终止gdb。但是你或许不想中断gdb，真正的目的是要中断gdb正在运行的程序，因
此，gdb要抓住该信号并停止它正在运行的程序，这样就可以执行某些调试操作。 <br><br>Handle命令可控制信号的处理，他有两个参数，一个
是信号名，另一个是接受到信号时该作什么。几种可能的参数是： <br>l nostop 接收到信号时，不要将它发送给程序，也不要停止程序。 <br>l
stop 接受到信号时停止程序的执行，从而允许程序调试；显示一条表示已接受到信号的消息（禁止使用消息除外） <br>l print
接受到信号时显示一条消息 <br>l noprint 接受到信号时不要显示消息（而且隐含着不停止程序运行） <br>l pass
将信号发送给程序，从而允许你的程序去处理它、停止运行或采取别的动作。 <br>l nopass 停止程序运行，但不要将信号发送给程序。 <br>例
如，假定你截获SIGPIPE信号，以防止正在调试的程序接受到该信号，而且只要该信号一到达，就要求该程序停止，并通知你。要完成这一任务，可利用如下
命令： <br>(gdb) handle SIGPIPE stop print <br>请注意，UNIX的信号名总是采用大写字母！你可以用信号编
号替代信号名 <br>如果你的程序要执行任何信号处理操作，就需要能够测试其信号处理程序，为此，就需要一种能将信号发送给程序的简便方法，这就是
signal命令的任务。该
命令的参数是一个数字或者一个名字，如SIGINT。假定你的程序已将一个专用的SIGINT（键盘输入，或CTRL-C；信号2）信号处理程序设置成采
取某个清理动作，要想测试该信号处理程序，你可以设置一个断点并使用如下命令： <br>（gdb） signal 2 <br>continuing
with signal SIGINT(2) <br>该程序继续执行，但是立即传输该信号，而且处理程序开始运行. <br><br>十一.
原文件的搜索 <br>search text:该命令可显示在当前文件中包含text串的下一行。 <br>Reverse-search
text:该命令可以显示包含text 的前一行。 <br><br>十二.UNIX接口 <br>shell
命令可启动UNIX外壳，CTRL-D退出外壳，返回到 gdb. <br><br>十三.命令的历史 <br>为了允许使用历史命令，可使用 set
history expansion on 命令 <br>(gdb) set history expansion on <br><br>小结：常用
的gdb命令 <br>backtrace 显示程序中的当前位置和表示如何到达当前位置的栈跟踪（同义词：where） <br>breakpoint
在程序中设置一个断点 <br>cd 改变当前工作目录 <br>clear 删除刚才停止处的断点 <br>commands
命中断点时，列出将要执行的命令 <br>continue 从断点开始继续执行 <br>delete 删除一个断点或监测点；也可与其他命令一起使用
<br>display 程序停止时显示变量和表达时 <br>down 下移栈帧，使得另一个函数成为当前函数 <br>frame
选择下一条continue命令的帧 <br>info 显示与该程序有关的各种信息 <br>jump 在源程序中的另一点开始运行 <br>kill
异常终止在gdb 控制下运行的程序 <br>list 列出相应于正在执行的程序的原文件内容 <br>next
执行下一个源程序行，从而执行其整体中的一个函数 <br>print 显示变量或表达式的值 <br>pwd 显示当前工作目录 <br>pype
显示一个数据结构（如一个结构或C++类）的内容 <br>quit 退出gdb <br>reverse-search 在源文件中反向搜索正规表达式
<br>run 执行该程序 <br>search 在源文件中搜索正规表达式 <br>set variable 给变量赋值 <br>signal
将一个信号发送到正在运行的进程 <br>step 执行下一个源程序行，必要时进入下一个函数 <br>undisplay
display命令的反命令，不要显示表达式 <br>until 结束当前循环 <br>up 上移栈帧，使另一函数成为当前函数 <br>watch
在程序中设置一个监测点（即数据断点） <br>whatis 显示变量或函数类型 <br>****************************************************
<br>　GNU的调试器称为gdb，该程序是一个交互式工具，工作在字符模式。在 X Window
系统中，有一个gdb的前端图形工具，称为xxgdb。gdb 是功能强大的调试程序，可完成如下的调试任务： <br>　　* 设置断点； <br>
* 监视程序变量的值； <br>　　* 程序的单步执行； <br>　　* 修改变量的值。 <br>　　在可以使用 gdb
调试程序之前，必须使用 -g 选项编译源文件。可在 makefile 中如下定义 CFLAGS 变量： <br>　　 CFLAGS = -g <br>
运行 gdb 调试程序时通常使用如下的命令： <br>　　 gdb progname <br><br>　　在 gdb
提示符处键入help，将列出命令的分类，主要的分类有： <br>　　* aliases：命令别名 <br>　　*
breakpoints：断点定义； <br>　　* data：数据查看； <br>　　* files：指定并查看文件； <br>　　*
internals：维护命令； <br>　　* running：程序执行； <br>　　* stack：调用栈查看； <br>　　*
statu：状态查看； <br>　　* tracepoints：跟踪程序执行。 <br>　　键入 help
后跟命令的分类名，可获得该类命令的详细清单。 <br><br><br>gdb 的常用命令 <br>命令 解释 <br>　　break NUM
在指定的行上设置断点。 <br>　　bt 显示所有的调用栈帧。该命令可用来显示函数的调用顺序。 <br>　　clear
删除设置在特定源文件、特定行上的断点。其用法为clear FILENAME:NUM <br>　　continue
继续执行正在调试的程序。该命令用在程序由于处理信号或断点而 导致停止运行时。 <br>　　display EXPR
每次程序停止后显示表达式的值。表达式由程序定义的变量组成。 <br>　　file FILE 装载指定的可执行文件进行调试。 <br>　　help
NAME 显示指定命令的帮助信息。 <br>　　info break 显示当前断点清单，包括到达断点处的次数等。 <br>　　info
files 显示被调试文件的详细信息。 <br>　　info func 显示所有的函数名称。 <br>　　info local
显示当函数中的局部变量信息。 <br>　　info prog 显示被调试程序的执行状态。 <br>　　info var
显示所有的全局和静态变量名称。 <br>　　kill 终止正被调试的程序。 <br>　　list 显示源代码段。 <br>　　make 在不退出
gdb 的情况下运行 make 工具。 <br>　　next 在不单步执行进入其他函数的情况下，向前执行一行源代码。 <br>　　print
EXPR 显示表达式 EXPR 的值。 <br><br>******gdb 使用范例************************ <br>-----------------
<br>清单 一个有错误的 C 源程序 bugging.c <br>代码: <br><br>----------------- <br>1
＃i nclude <br>2 <br>3　static char buff [256]; <br>4　static char* string;
<br>5　int main () <br>6　{ <br>7　　　printf ("Please input a string: "); <br>8
gets (string);　　 <br>9　　 printf ("\nYour string is: %s\n", string); <br>10
} <br><br><br>----------------- <br>
上面这个程序非常简单，其目的是接受用户的输入，然后将用户的输入打印出来。该程序使用了一个未经过初始化的字符串地址
string，因此，编译并运行之后，将出现 Segment Fault 错误： <br>$ gcc -o bugging -g
bugging.c <br>$ ./bugging <br>Please input a string: asfd <br>Segmentation
fault (core dumped) <br>为了查找该程序中出现的问题，我们利用 gdb，并按如下的步骤进行： <br>1．运行 gdb
bugging 命令，装入 bugging 可执行文件； <br>2．执行装入的 bugging 命令 run； <br>3．使用 where
命令查看程序出错的地方； <br>4．利用 list 命令查看调用 gets 函数附近的代码； <br>5．唯一能够导致 gets
函数出错的因素就是变量 string。用print命令查看 string 的值； <br>6．在 gdb 中，我们可以直接修改变量的值，只要将
string 取一个合法的指针值就可以了，为此，我们在第8行处设置断点 break 8； <br>7．程序重新运行到第
8行处停止，这时，我们可以用 set variable 命令修改 string 的取值； <br>8．然后继续运行，将看到正确的程序运行结果。
<!-- 正文end -->
<br>
(http://www.fanqiang.com)<br>
</font>
</font>
<br><img src ="http://www.cppblog.com/Viking/aggbug/129594.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Viking/" target="_blank">张贵川</a> 2010-10-12 11:56 <a href="http://www.cppblog.com/Viking/archive/2010/10/12/129594.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>linux 文件系统命名的来由</title><link>http://www.cppblog.com/Viking/archive/2010/10/11/129516.html</link><dc:creator>张贵川</dc:creator><author>张贵川</author><pubDate>Mon, 11 Oct 2010 15:29:00 GMT</pubDate><guid>http://www.cppblog.com/Viking/archive/2010/10/11/129516.html</guid><wfw:comment>http://www.cppblog.com/Viking/comments/129516.html</wfw:comment><comments>http://www.cppblog.com/Viking/archive/2010/10/11/129516.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Viking/comments/commentRss/129516.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Viking/services/trackbacks/129516.html</trackback:ping><description><![CDATA[<br>
<div style="background-color: #eeeeee; font-size: 13px; border: 1px solid #cccccc; padding: 4px 5px 4px 4px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: #000000;">Unix已经有35年历史了。许多人认为它开始于中世纪，这个中世纪是相对于<br>计算机技术的产生和发展来说的。在过去的时间里，Unix和它的子分支Linux收集<br>有许多的历史和一些完全古老的语言。在这篇技巧文章中，我们将介绍一少部分古<br>老的语言和它们的目的和作用，以及它们真正的来源。&nbsp;<br><br>RC&nbsp;<br><br>在Linux中，最为常用的缩略语也许是&#8220;rc&#8221;，它是&#8220;runcomm&#8221;的缩写――即名词<br>&#8220;run&nbsp;&nbsp;&nbsp;command&#8221;(运行命令)的简写。今天，&#8220;rc&#8221;是任何脚本类文件的后缀，这些<br>脚本通常在程序的启动阶段被调用，通常是Linux系统启动时。如&nbsp;&nbsp;&nbsp;</span><span style="color: #000000;">/</span><span style="color: #000000;">etc</span><span style="color: #000000;">/</span><span style="color: #000000;">rs是<br>Linux启动的主脚本，而.bashrc是当Linux的bash&nbsp;&nbsp;&nbsp;shell启动后所运行的脚<br>本。.bashrc的前缀&#8220;.&#8221;是一个命名标准，它被设计用来在用户文件中隐藏那些用户<br>指定的特殊文件;&#8220;ls&#8221;命令默认情况下不会列出此类文件，&#8220;rm&#8221;默认情况下也不会<br>删除它们。许多程序在启动时，都需要&#8220;rc&#8221;后缀的初始文件或配置文件，这对于<br>Unix的文件系统视图来说，没有什么神秘的。&nbsp;<br><br>ETC&nbsp;<br><br>在&#8220;etc</span><span style="color: #000000;">/</span><span style="color: #000000;">bin&#8221;中的&#8220;etc&#8221;真正代表的是&#8220;etcetera&#8221;(附加物)。在早期的Unix系<br>统中，最为重要的目录是&#8220;bin&#8221;目录&nbsp;&nbsp;&nbsp;(&#8220;bin&#8221;是&#8220;binaries&#8221;二进制文件――编译后的<br>程序的缩写)，&#8220;etc&#8221;中则包含琐碎的程序，如启动、关机和管理。运行一个Linux<br>必须的东西的列表是:一个二进制程序，etcetera，etcetera――换句话说，是一个<br>底层的重要项目，通常添加一些次等重要的零碎事物。今天，&nbsp;&nbsp;&nbsp;&#8220;etc&#8221;包含了广泛<br>的系统配置文件，这些配置文件几乎包含了系统配置的方方面面，同样非常重要。&nbsp;<br><br>Bin&nbsp;<br><br>今天，许多在Linux上运行的大型子系统，如GNOME或Oracle，所编译成的程<br>序使用它们自己的&#8220;bin&#8221;目录(或者是&nbsp;&nbsp;&nbsp;</span><span style="color: #000000;">/</span><span style="color: #000000;">usr</span><span style="color: #000000;">/</span><span style="color: #000000;">bin，或者是</span><span style="color: #000000;">/</span><span style="color: #000000;">usr</span><span style="color: #000000;">/</span><span style="color: #000000;">local</span><span style="color: #000000;">/</span><span style="color: #000000;">bin)作为标<br>准的存放地。同样，现在也能够在这些目录看到脚本文件，因为&#8220;bin&#8221;目录通常添<br>加到用户的PATH路径中，这样他们才能够正常的使用程序。因此运行脚本通常在<br>bin中运行良好。&nbsp;<br><br>TTY&nbsp;<br><br>在Linux中，TTY也许是跟终端有关系的最为混乱的术语。TTY是TeleTYpe的<br>一个老缩写。Teletypes，或者&nbsp;&nbsp;&nbsp;teletypewriters，原来指的是电传打字机，是<br>通过串行线用打印机键盘通过阅读和发送信息的东西，和古老的电报机区别并不是<br>很大。之后，当计算机只能以批处理方式运行时(当时穿孔卡片阅读器是唯一一种<br>使程序载入运行的方式)，电传打字机成为唯一能够被使用的&#8220;实时&#8221;输入</span><span style="color: #000000;">/</span><span style="color: #000000;">输出设<br>备。最终，电传打字机被键盘和显示器终端所取代，但在终端或&nbsp;&nbsp;&nbsp;TTY接插的地<br>方，操作系统仍然需要一个程序来监视串行端口。一个getty&#8220;Get&nbsp;&nbsp;&nbsp;TTY&#8221;的处理过<br>程是:一个程序监视物理的TTY</span><span style="color: #000000;">/</span><span style="color: #000000;">终端接口。对一个虚拟网络沮丧服务器(VNC)来说，<br>一个伪装的TTY(Pseudo</span><span style="color: #000000;">-</span><span style="color: #000000;">TTY，即家猫的TTY，也叫做&#8220;PTY&#8221;)是等价的终端。当你运<br>行一个xterm(终端仿真程序)或GNOME终端程序时，PTY对虚拟的用户或者如xterm一<br>样的伪终端来说，就像是一个TTY在运行。&#8220;Pseudo&#8221;的意思是&#8220;duplicating&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">in</span><span style="color: #000000;">&nbsp;<br>a&nbsp;&nbsp;&nbsp;fake&nbsp;&nbsp;&nbsp;way&#8221;(用伪造的方法复制)，它相比&#8220;</span><span style="color: #0000ff;">virtual</span><span style="color: #000000;">&#8221;或&#8220;emulated&#8221;更能真实的<br>说明问题。而在现在的计算中，它却处于被放弃的阶段。&nbsp;<br><br>Dev&nbsp;<br><br>从TTY留下的命令有&#8220;stty&#8221;，是&#8220;</span><span style="color: #0000ff;">set</span><span style="color: #000000;">&nbsp;&nbsp;&nbsp;tty&#8221;(设置TTY)的缩写，它能够生成<br>一个配置文件</span><span style="color: #000000;">/</span><span style="color: #000000;">etc</span><span style="color: #000000;">/</span><span style="color: #000000;">initab(&#8220;initialization&nbsp;&nbsp;&nbsp;table&#8221;，初始表)，以配置gettys<br>使用哪一个串口。在现代，直接附加在Linux窗口上的唯一终端通常是控制台，由<br>于它是特殊的TTY，因此被命名为&#8220;console&#8221;。当然，一旦你启动<br>X11，&#8220;console&#8221;TTY就会消失，再也不能使用串口协议。所有的TTY都被储存在<br>&#8220;</span><span style="color: #000000;">/</span><span style="color: #000000;">dev&#8221;目录，它是&#8220;[physical]&nbsp;&nbsp;&nbsp;devices&#8221;([物理]设备)的缩写。以前，你必须在<br>电脑后面的串口中接入一个新的终端时，手工修改和配置每一个设备文件。现<br>在，Linux(和&nbsp;&nbsp;&nbsp;Unix)在安装过程中就在此目录中创建了它所能向导的每一个设备<br>的文件。这就是说，你很少需要自己创建它。&nbsp;<br><br>随着硬件在电脑中的移出移进，这些名字将变得更加模糊不清。幸运的是，<br>今天在Linux上的高等级软件块对历史和硬件使用容易理解的名字。举例来说，<br>嗯，Pango(http:</span><span style="color: #008000;">//</span><span style="color: #008000;">www.pango.org/)就是其中之一。&nbsp;</span><span style="color: #008000;"><br></span><span style="color: #000000;"><br>如果你对这些内容很感兴趣，那么我建议你阅读宏大的，但有些以美国英语<br>历史为中心的，由Eric&nbsp;&nbsp;&nbsp;S.&nbsp;&nbsp;&nbsp;Raymond撰写的Jargon&nbsp;&nbsp;&nbsp;File。它并没有解释所有<br>在Unix中使用的术语，但是它给出了这些形成的大致情况。&nbsp;&nbsp;</span></div>
<br><img src ="http://www.cppblog.com/Viking/aggbug/129516.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Viking/" target="_blank">张贵川</a> 2010-10-11 23:29 <a href="http://www.cppblog.com/Viking/archive/2010/10/11/129516.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>