﻿<?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++博客-sunrise-随笔分类-linux开发必备</title><link>http://www.cppblog.com/sunrise/category/18833.html</link><description>每天不断学习，才能不断提升自己。

欢迎交流 QQ：703979707

我的铺子：http://www.u148.net/u/lwx</description><language>zh-cn</language><lastBuildDate>Mon, 03 Dec 2012 08:21:04 GMT</lastBuildDate><pubDate>Mon, 03 Dec 2012 08:21:04 GMT</pubDate><ttl>60</ttl><item><title>linux的开发经验</title><link>http://www.cppblog.com/sunrise/archive/2012/12/03/195913.html</link><dc:creator>SunRise_at</dc:creator><author>SunRise_at</author><pubDate>Mon, 03 Dec 2012 03:04:00 GMT</pubDate><guid>http://www.cppblog.com/sunrise/archive/2012/12/03/195913.html</guid><wfw:comment>http://www.cppblog.com/sunrise/comments/195913.html</wfw:comment><comments>http://www.cppblog.com/sunrise/archive/2012/12/03/195913.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/sunrise/comments/commentRss/195913.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/sunrise/services/trackbacks/195913.html</trackback:ping><description><![CDATA[最近换工作了，把平时累积的一些东西发出来，方便带走，根据自己的工作经验增多会不断的更新。<br /><div>1.make: Nothing to be done for `all' 解决方法</div><div>1.这句提示是说明你已经编译好了，而且没有对代码进行任何改动。</div><div></div><div>若想重新编译，可以先删除以前编译产生的目标文件：</div><div>make clean</div><div>然后再</div><div>make</div><div>&nbsp;</div><div>2.出现这种情况解决方法：</div><div></div><div>a.make clean 清除安装时留下的文件</div><div></div><div>b.在运行一下ldconfig</div><div>c.再make 可运行出结果</div><div></div><div>3.&#8220;E: virtualbox-ose-source: 子进程 已安装的 post-installation 脚本 返回了错误号 1&#8220;</div><div></div><div>解决方法：apt-get purge virtualbox-3.0</div><div>或者用clean remove autoremove试试看</div><div></div><div>4.在eclipse中的设置方法&nbsp;</div><div></div><div>方法1：对应在Eclipse中的设置为:窗口-&gt;首选项-&gt;JAVA-&gt;已安装的JRE,在缺 省的VM自变量中增加:-Xmx256M （也可以添加其他参数如-Xms128M -XX:PermSize=64M -XX:MaxPermSize=128M）&nbsp;</div><div></div><div>方法2：修改eclipse.ini&nbsp;</div><div>-vmargs -Xms128M -Xmx512M -XX:PermSize=64M -XX:MaxPermSize=128M&nbsp;</div><div></div><div>5.在使用python的replace时，总爱line.replace....</div><div>忘了这样line = line.replace...</div><div></div><div>6.关于pushd与popd的命令，当pushd /home/lexxe，就能够进入到该目录之下，再进行popd的时候，它就会返回到原来的目录。</div><div></div><div>7.将大文件切割成小文件命令 split -b 100m 文件名</div><div></div><div>8.连接服务器ssh mii@192.168.1.xx</div><div></div><div>9.乱码，可能不是程序问题，也可能是电脑中支持的语言体系不支持，而显示出乱码。</div><img src ="http://www.cppblog.com/sunrise/aggbug/195913.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/sunrise/" target="_blank">SunRise_at</a> 2012-12-03 11:04 <a href="http://www.cppblog.com/sunrise/archive/2012/12/03/195913.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>linux下的常用命令</title><link>http://www.cppblog.com/sunrise/archive/2012/12/03/195912.html</link><dc:creator>SunRise_at</dc:creator><author>SunRise_at</author><pubDate>Mon, 03 Dec 2012 03:02:00 GMT</pubDate><guid>http://www.cppblog.com/sunrise/archive/2012/12/03/195912.html</guid><wfw:comment>http://www.cppblog.com/sunrise/comments/195912.html</wfw:comment><comments>http://www.cppblog.com/sunrise/archive/2012/12/03/195912.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/sunrise/comments/commentRss/195912.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/sunrise/services/trackbacks/195912.html</trackback:ping><description><![CDATA[<div>svn常用命令</div><div>svn co https://IP/svn/apps/ontology --username yu.chen --password yu.chen</div><div>svn mkdir https://IP/svn/apps/ontology -m "mkdir ontology"</div><div>svn ci -m &#8220;add test file for my test&#8220; test.php</div><div>svn delete https://IP/svn/apps/ontology -m &#8220;delete test file&#8221;</div><div></div><div>连接服务器</div><div>ssh mii@192.168.1.54</div><div>密码：yu&amp;new</div><div>ssh lexxe@222.44.14.7</div><div>密码：lexxe</div><div>7z x -ot temp.7z</div><div></div><div>scp</div><div>1、获取远程服务器上的文件</div><div>scp root@www.vpser.net:/root/lnmp0.4.tar.gz /home/lnmp0.4.tar.gz</div><div>2、获取远程服务器上的目录</div><div>scp -r root@www.vpser.net:/root/lnmp0.4/ /home/lnmp0.4/</div><div>3、将本地文件上传到服务器上</div><div>scp /home/lnmp0.4.tar.gz root@www.vpser.net:/root/lnmp0.4.tar.gz</div><div>4、将本地目录上传到服务器上</div><div>scp -r /home/lnmp0.4/ root@www.vpser.net:/root/lnmp0.4/</div><div></div><div>首先要安装scrot:</div><div>抓取桌面：scrot desktop.png，该命令将当前的整个桌面抓取下来，并保存为 desktop.png 文件。可以在当前的目录中找到此图像文件。</div><div>　　抓取窗口：scrot -bs window.png，选项 b 使 scrot 在抓取窗口时一同将外边框抓取下来，而 s 选项则让用户选择所要抓取的是何窗口。</div><div>　　抓取区域：scrot -s rectangle.png，在执行此命令后，使用鼠标拖曳的矩形区域将被 scrot 抓取下来。</div><div>　　高级使用对于普通的抓取使用 scrot 的基础便足以应付了。但在某些特殊情况之下，使用 scrot 抓取图像需要讲究一些技巧。</div><div>　　延时抓取：scrot -cd 10 menu.png，此命令中的 d 选项用于延时抓取图像，其后的 10 代表延时 10 秒;前面的选项 c 显示倒计时。在抓取菜单或是命令提示时，该技巧将充分展示其魔力。</div><div>　　生成缩图：scrot -t 50% thumb.png，这个命令在抓取图像的同时生成该图像的缩略图。选项 t 将打开此功能，其后的 50% 为原图的缩放百分比。</div><div>　　更改品质：scrot -q 70 quality.jpg，此命令中的 q 选项用于更改所抓图像的品质，其数值介于 1-100 之间，默认为 75。数值越大，意味着图像品质越高;同时，图像的压缩率也就越低，占用空间越大。</div><div>　　操作抓图：scrot action.png -e &#8216;mv $f ~/images/&#8217;，该命令将抓取的图像移动到 ~/images/ 目录。显然，操作图像的功能由 e 选项开启，其中的 $f 代表原图的路径/文件名。</div><div>　　以上示例皆指定了需要保存的抓图的文件名称。实际上，如果不指定名称，那么 scrot 在抓取图像后会自动使用当前的日期时间、宽度高度的组合来生成文件名称。</div><div><br />自己在工作中的一些常用命令，方便自己查阅。</div><div>linux下的命令使用</div><div>一.统计行数</div><div>- c 统计字节数。</div><div>- l 统计行数。</div><div>- w 统计字数。</div><div>1.统计demo目录下，js文件数量：</div><div>find demo/ -name "*.js" |wc -l</div><div>2.统计demo目录下所有js文件代码行数：</div><div>find demo/ -name "*.js" |xargs cat|wc -l 或 wc -l `find ./ -name "*.js"`|tail -n1</div><div>3.统计demo目录下所有js文件代码行数，过滤了空行：</div><div>find /demo -name "*.js" |xargs cat|grep -v ^$|wc -l</div><div>4.查看文件改变大小</div><div>ls -al</div><div></div><div>批量下载。</div><div>如果有多个文件需要下载，那么可以生成一个文件，把每个文件的URL写一行，例如生成文件download.txt，然后用命令：wget -i download.txt</div><img src ="http://www.cppblog.com/sunrise/aggbug/195912.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/sunrise/" target="_blank">SunRise_at</a> 2012-12-03 11:02 <a href="http://www.cppblog.com/sunrise/archive/2012/12/03/195912.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>linux如何查进程、杀进程，重启进程  </title><link>http://www.cppblog.com/sunrise/archive/2012/12/03/195910.html</link><dc:creator>SunRise_at</dc:creator><author>SunRise_at</author><pubDate>Mon, 03 Dec 2012 02:42:00 GMT</pubDate><guid>http://www.cppblog.com/sunrise/archive/2012/12/03/195910.html</guid><wfw:comment>http://www.cppblog.com/sunrise/comments/195910.html</wfw:comment><comments>http://www.cppblog.com/sunrise/archive/2012/12/03/195910.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/sunrise/comments/commentRss/195910.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/sunrise/services/trackbacks/195910.html</trackback:ping><description><![CDATA[<span style="color: #5f5f5f; font-family: Arial, Helvetica, simsun, u5b8bu4f53; line-height: 27px; ">1.查进程&nbsp;</span><br style="line-height: 27px; color: #5f5f5f; font-family: Arial, Helvetica, simsun, u5b8bu4f53; " /><span style="color: #5f5f5f; font-family: Arial, Helvetica, simsun, u5b8bu4f53; line-height: 27px; ">&nbsp;&nbsp;&nbsp; ps命令查找与进程相关的PID号：&nbsp;</span><br style="line-height: 27px; color: #5f5f5f; font-family: Arial, Helvetica, simsun, u5b8bu4f53; " /><span style="color: #5f5f5f; font-family: Arial, Helvetica, simsun, u5b8bu4f53; line-height: 27px; ">&nbsp;&nbsp;&nbsp; ps a 显示现行终端机下的所有程序，包括其他用户的程序。&nbsp;</span><br style="line-height: 27px; color: #5f5f5f; font-family: Arial, Helvetica, simsun, u5b8bu4f53; " /><span style="color: #5f5f5f; font-family: Arial, Helvetica, simsun, u5b8bu4f53; line-height: 27px; ">&nbsp;&nbsp;&nbsp; ps -A 显示所有程序。&nbsp;</span><br style="line-height: 27px; color: #5f5f5f; font-family: Arial, Helvetica, simsun, u5b8bu4f53; " /><span style="color: #5f5f5f; font-family: Arial, Helvetica, simsun, u5b8bu4f53; line-height: 27px; ">&nbsp;&nbsp;&nbsp; ps c 列出程序时，显示每个程序真正的指令名称，而不包含路径，参数或常驻服务的标示。&nbsp;</span><br style="line-height: 27px; color: #5f5f5f; font-family: Arial, Helvetica, simsun, u5b8bu4f53; " /><span style="color: #5f5f5f; font-family: Arial, Helvetica, simsun, u5b8bu4f53; line-height: 27px; ">&nbsp;&nbsp;&nbsp; ps -e 此参数的效果和指定"A"参数相同。&nbsp;</span><br style="line-height: 27px; color: #5f5f5f; font-family: Arial, Helvetica, simsun, u5b8bu4f53; " /><span style="color: #5f5f5f; font-family: Arial, Helvetica, simsun, u5b8bu4f53; line-height: 27px; ">&nbsp;&nbsp;&nbsp; ps e 列出程序时，显示每个程序所使用的环境变量。&nbsp;</span><br style="line-height: 27px; color: #5f5f5f; font-family: Arial, Helvetica, simsun, u5b8bu4f53; " /><span style="color: #5f5f5f; font-family: Arial, Helvetica, simsun, u5b8bu4f53; line-height: 27px; ">&nbsp;&nbsp;&nbsp; ps f 用ASCII字符显示树状结构，表达程序间的相互关系。&nbsp;</span><br style="line-height: 27px; color: #5f5f5f; font-family: Arial, Helvetica, simsun, u5b8bu4f53; " /><span style="color: #5f5f5f; font-family: Arial, Helvetica, simsun, u5b8bu4f53; line-height: 27px; ">&nbsp;&nbsp;&nbsp; ps -H 显示树状结构，表示程序间的相互关系。&nbsp;</span><br style="line-height: 27px; color: #5f5f5f; font-family: Arial, Helvetica, simsun, u5b8bu4f53; " /><span style="color: #5f5f5f; font-family: Arial, Helvetica, simsun, u5b8bu4f53; line-height: 27px; ">&nbsp;&nbsp;&nbsp; ps -N 显示所有的程序，除了执行ps指令终端机下的程序之外。&nbsp;</span><br style="line-height: 27px; color: #5f5f5f; font-family: Arial, Helvetica, simsun, u5b8bu4f53; " /><span style="color: #5f5f5f; font-family: Arial, Helvetica, simsun, u5b8bu4f53; line-height: 27px; ">&nbsp;&nbsp;&nbsp; ps s 采用程序信号的格式显示程序状况。&nbsp;</span><br style="line-height: 27px; color: #5f5f5f; font-family: Arial, Helvetica, simsun, u5b8bu4f53; " /><span style="color: #5f5f5f; font-family: Arial, Helvetica, simsun, u5b8bu4f53; line-height: 27px; ">&nbsp;&nbsp;&nbsp; ps S 列出程序时，包括已中断的子程序资料。&nbsp;</span><br style="line-height: 27px; color: #5f5f5f; font-family: Arial, Helvetica, simsun, u5b8bu4f53; " /><span style="color: #5f5f5f; font-family: Arial, Helvetica, simsun, u5b8bu4f53; line-height: 27px; ">&nbsp;&nbsp;&nbsp; ps -t&lt;终端机编号&gt; 指定终端机编号，并列出属于该终端机的程序的状况。&nbsp;</span><br style="line-height: 27px; color: #5f5f5f; font-family: Arial, Helvetica, simsun, u5b8bu4f53; " /><span style="color: #5f5f5f; font-family: Arial, Helvetica, simsun, u5b8bu4f53; line-height: 27px; ">&nbsp;&nbsp;&nbsp; ps u 以用户为主的格式来显示程序状况。&nbsp;</span><br style="line-height: 27px; color: #5f5f5f; font-family: Arial, Helvetica, simsun, u5b8bu4f53; " /><span style="color: #5f5f5f; font-family: Arial, Helvetica, simsun, u5b8bu4f53; line-height: 27px; ">&nbsp;&nbsp;&nbsp; ps x 显示所有程序，不以终端机来区分。&nbsp;</span><br style="line-height: 27px; color: #5f5f5f; font-family: Arial, Helvetica, simsun, u5b8bu4f53; " /><span style="color: #5f5f5f; font-family: Arial, Helvetica, simsun, u5b8bu4f53; line-height: 27px; ">&nbsp;&nbsp;&nbsp;</span><br style="line-height: 27px; color: #5f5f5f; font-family: Arial, Helvetica, simsun, u5b8bu4f53; " /><span style="color: #5f5f5f; font-family: Arial, Helvetica, simsun, u5b8bu4f53; line-height: 27px; ">&nbsp;&nbsp;&nbsp; 最常用的方法是ps aux,然后再通过管道使用grep命令过滤查找特定的进程,然后再对特定的进程进行操作。&nbsp;</span><br style="line-height: 27px; color: #5f5f5f; font-family: Arial, Helvetica, simsun, u5b8bu4f53; " /><span style="color: #5f5f5f; font-family: Arial, Helvetica, simsun, u5b8bu4f53; line-height: 27px; ">&nbsp;&nbsp;&nbsp; ps aux | grep program_filter_word,ps -ef |grep tomcat&nbsp;</span><br style="line-height: 27px; color: #5f5f5f; font-family: Arial, Helvetica, simsun, u5b8bu4f53; " /><br style="line-height: 27px; color: #5f5f5f; font-family: Arial, Helvetica, simsun, u5b8bu4f53; " /><span style="color: #5f5f5f; font-family: Arial, Helvetica, simsun, u5b8bu4f53; line-height: 27px; ">ps -ef|grep java|grep -v grep 显示出所有的java进程，去处掉当前的grep进程。&nbsp;</span><br style="line-height: 27px; color: #5f5f5f; font-family: Arial, Helvetica, simsun, u5b8bu4f53; " /><span style="color: #5f5f5f; font-family: Arial, Helvetica, simsun, u5b8bu4f53; line-height: 27px; ">&nbsp;&nbsp;&nbsp;</span><br style="line-height: 27px; color: #5f5f5f; font-family: Arial, Helvetica, simsun, u5b8bu4f53; " /><span style="color: #5f5f5f; font-family: Arial, Helvetica, simsun, u5b8bu4f53; line-height: 27px; ">2.杀进程&nbsp;</span><div style="line-height: 27px; color: #5f5f5f; font-family: Arial, Helvetica, simsun, u5b8bu4f53; ">&nbsp; &nbsp;显示CPU使用情况以及部分进程：top</div><div style="line-height: 27px; color: #5f5f5f; font-family: Arial, Helvetica, simsun, u5b8bu4f53; ">&nbsp; &nbsp;显示连接端口使用进程：netstat -noap/-an |grep NAME<br />&nbsp;&nbsp; 使用kill命令结束进程：kill xxx&nbsp;<br />&nbsp;&nbsp; 常用：kill －9 324&nbsp;<br />&nbsp;&nbsp; Linux下还提供了一个killall命令，可以直接使用进程的名字而不是进程标识号，例如：# killall -9 NAME&nbsp;<br /><br />3.进入到进程的执行文件所在的路径下，执行文件 ./文件名&nbsp;<br /><br />附：&nbsp;<br /><br />这是本人花了两天时间整理得来的，一些最常用的地球人都知道的命令就省去啦！最后提供pdf手册下载&nbsp;<br /><br />1. 更改档案拥有者&nbsp;<br />命令 : chown [-cfhvR] [--help] [--version] user[:group] file...&nbsp;<br />功能 : 更改文件或者文件夹的拥有者&nbsp;<br />参数格式 :&nbsp;<br />　　 &nbsp;&nbsp; user : 新的档案拥有者的使用者 IDgroup : 新的档案拥有者的使用者群体(group)&nbsp;<br />　　&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -c : 若该档案拥有者确实已经更改，才显示其更改动作&nbsp;<br />　　&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -f : 若该档案拥有者无法被更改也不要显示错误讯息&nbsp;<br />　　&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -h : 只对于连结(link)进行变更，而非该 link 真正指向的档案&nbsp;<br />　　&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -v : 显示拥有者变更的详细资料&nbsp;<br />　&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 　-R : 对目前目录下的所有档案与子目录进行相同的拥有者变更(即以递回的方式逐个变更)&nbsp;<br /><br />例如：chown -R oracle:oinstall /oracle/u01/app/oracle&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 更改目录拥有者为oracle&nbsp;<br /><br />2. 修改权限&nbsp;<br />&nbsp;&nbsp;&nbsp; 命令：chmod (change mode)&nbsp;<br />&nbsp;&nbsp;&nbsp; 功能：改变文件的读写和执行权限。有符号法和八进制数字法。&nbsp;<br />&nbsp;&nbsp;&nbsp; 选项：(1)符号法：&nbsp;<br />&nbsp; 命令格式：chmod {u|g|o|a}{+|-|=}{r|w|x} filename&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; u (user)&nbsp;&nbsp; 表示用户本人。&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; g (group)&nbsp; 表示同组用户。&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; o (oher)&nbsp;&nbsp; 表示其他用户。&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a (all)&nbsp;&nbsp;&nbsp; 表示所有用户。&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 用于给予指定用户的许可权限。&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 用于取消指定用户的许可权限。&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 将所许可的权限赋给文件。&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; r (read)&nbsp;&nbsp; 读许可，表示可以拷贝该文件或目录的内容。&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; w (write)&nbsp; 写许可，表示可以修改该文件或目录的内容。&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; x (execute)执行许可，表示可以执行该文件或进入目录。&nbsp;<br />&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (2)八进制数字法： &nbsp;&nbsp;<br />&nbsp; 命令格式：chmod abc file&nbsp;<br />&nbsp; 其中a,b,c各为一个八进制数字，分别表示User、Group、及Other的权限。&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 4 (100)&nbsp;&nbsp;&nbsp; 表示可读。&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2 (010)&nbsp;&nbsp;&nbsp; 表示可写。&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1 (001)&nbsp;&nbsp;&nbsp; 表示可执行。&nbsp;<br />&nbsp; 若要rwx属性则4+2+1=7；&nbsp;<br />&nbsp; 若要rw-属性则4+2=6；&nbsp;<br />&nbsp; 若要r-x属性则4+1=5。&nbsp;<br /><br />&nbsp;&nbsp;&nbsp; 例如：# chmod a+rx filename&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 让所有用户可以读和执行文件filename。&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # chmod go-rx filename&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 取消同组和其他用户的读和执行文件filename的权限。&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # chmod 741 filename&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 让本人可读写执行、同组用户可读、其他用户可执行文件filename。&nbsp;<br />&nbsp; # chmod -R 755 /home/oracle&nbsp;<br />&nbsp;&nbsp;&nbsp; 递归更改目录权限，本人可读写执行、同组用户可读可执行、其他用户可读可执行&nbsp;<br /><br />3. 修改文件日期&nbsp;<br />&nbsp;&nbsp;&nbsp; 命令：touch&nbsp;<br />&nbsp;&nbsp;&nbsp; 格式：touch filenae&nbsp;<br />&nbsp;&nbsp;&nbsp; 功能：改变文件的日期，不对文件的内容做改动，若文件不存在则建立新文件。&nbsp;<br />&nbsp;&nbsp;&nbsp; 例如：% touch file&nbsp;<br /><br />4. 链接文件&nbsp;<br />&nbsp;&nbsp;&nbsp; 命令：ln (link)&nbsp;<br />&nbsp;&nbsp;&nbsp; 格式：ln [option] filename linkname&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ln [option] directory pathname&nbsp;<br />&nbsp;&nbsp;&nbsp; 功能：为文件或目录建立一个链。其中，filename和directory是源文件名和&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 源目录名；linkname和pathname分别表示与源文件或源目录名相链接的&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 文件或目录。&nbsp;<br />&nbsp;&nbsp;&nbsp; 选项：-s&nbsp; 为文件或目录建立符号链接。不加-s表示为文件或目录建立硬链接&nbsp;<br />&nbsp;&nbsp;&nbsp; 注释：链接的目地在于，对一个文件或目录赋予两个以上的名字，使其可以出&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 现在不同的目录中，既可以使文件或目录共享，又可以节省磁盘空间。&nbsp;<br />&nbsp;&nbsp;&nbsp; 例如：% ln -s filename linkname&nbsp;<br /><br />5. 显示日期&nbsp;<br />&nbsp;&nbsp;&nbsp; 命令：date&nbsp;<br />&nbsp;&nbsp;&nbsp; 例如：% date&nbsp;<br /><br />6. 显示日历&nbsp;<br />&nbsp;&nbsp;&nbsp; 命令：cal (calendar)&nbsp;<br />&nbsp;&nbsp;&nbsp; 格式：cal [month] year&nbsp;<br />&nbsp;&nbsp;&nbsp; 功能：显示某年内指定的日历&nbsp;<br />&nbsp;&nbsp;&nbsp; 例如：% cal 1998&nbsp;&nbsp;<br /><br />7. 显示文件头部&nbsp;<br />&nbsp;&nbsp;&nbsp; 命令：head&nbsp;<br />&nbsp;&nbsp;&nbsp; 格式：head [option] filename&nbsp;<br />&nbsp;&nbsp;&nbsp; 功能：显示文件的头部&nbsp;<br />&nbsp;&nbsp;&nbsp; 选项：缺省&nbsp; 显示文件的头10行。&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -i&nbsp;&nbsp;&nbsp; 显示文件的开始 i行。&nbsp;<br />&nbsp;&nbsp;&nbsp; 例如：% head filename&nbsp;<br /><br />8. 显示文件尾部&nbsp;<br />&nbsp;&nbsp;&nbsp; 命令：tail&nbsp;<br />&nbsp;&nbsp;&nbsp; 格式：tail [option] filename&nbsp;<br />&nbsp;&nbsp;&nbsp; 功能：显示文件的尾部&nbsp;<br />&nbsp;&nbsp;&nbsp; 选项：缺省&nbsp; 显示文件的末10行。&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -i&nbsp;&nbsp;&nbsp; 显示文件最后 i行。&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; +i&nbsp;&nbsp;&nbsp; 从文件的第i行开始显示。&nbsp;<br />&nbsp;&nbsp;&nbsp; 例如：% tail filename&nbsp;<br /><br />9. 显示用户标识&nbsp;<br />&nbsp;&nbsp;&nbsp; 命令：id&nbsp;<br />&nbsp;&nbsp;&nbsp; 格式：id [option] [user]&nbsp;<br />&nbsp;&nbsp;&nbsp; 功能：显示用户标识及用户所属的所有组。&nbsp;<br />&nbsp;&nbsp;&nbsp; 选项：-a 显示用户名、用户标识及用户所属的所有组&nbsp;<br />&nbsp;&nbsp;&nbsp; 注释：&nbsp;<br />&nbsp;&nbsp;&nbsp; 例如：% id username&nbsp;<br /><br />10. 查看当前登录的用户&nbsp;<br />&nbsp;&nbsp;&nbsp; 命令：users&nbsp;<br /><br />11. 显示都谁登录到机器上&nbsp;<br />&nbsp;&nbsp;&nbsp; 命令：who&nbsp;<br />&nbsp;&nbsp;&nbsp; 格式：who&nbsp;<br />&nbsp;&nbsp;&nbsp; 功能：显示当前正在系统中的所有用户名字，使用终端设备号，注册时间。&nbsp;<br />&nbsp;&nbsp;&nbsp; 例如：% who&nbsp;<br /><br />12. 显示当前终端上的用户名&nbsp;<br />&nbsp;&nbsp;&nbsp; 命令：whoami&nbsp;<br />&nbsp;&nbsp;&nbsp; 格式：whoami&nbsp;<br />&nbsp;&nbsp;&nbsp; 功能：显示出当前终端上使用的用户。&nbsp;<br />&nbsp;&nbsp;&nbsp; 例如：% whoami&nbsp;<br /><br />13. 寻找文件&nbsp;<br />&nbsp;&nbsp;&nbsp; 命令：find&nbsp;<br />&nbsp;&nbsp;&nbsp; 格式：find pathname [option] expression&nbsp;<br />&nbsp;&nbsp;&nbsp; 功能：在所给的路经名下寻找符合表达式相匹配的文件。&nbsp;<br />&nbsp;&nbsp;&nbsp; 选项：-name&nbsp;&nbsp;&nbsp;&nbsp; 表示文件名&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -user&nbsp;&nbsp;&nbsp;&nbsp; 用户名，选取该用户所属的文件&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -size&nbsp;&nbsp;&nbsp;&nbsp; 按大小查找，以block为单位，一个block是512B&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -mtime n&nbsp; 按最后一次修改时间查找，选取n天内被修改的文件&nbsp;<br />&nbsp; -perm&nbsp;&nbsp;&nbsp;&nbsp; 按权限查找&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -type&nbsp;&nbsp;&nbsp;&nbsp; 按文件类型查找&nbsp;<br />&nbsp; -atime&nbsp;&nbsp;&nbsp; 按最后一次访问时间查找&nbsp;<br /><br />&nbsp;&nbsp;&nbsp; 例如：% find ./ -name '*abc*' -print&nbsp;<br /><br />14. 搜索文件中匹配符&nbsp;<br />&nbsp;&nbsp;&nbsp; 命令：grep&nbsp;<br />&nbsp;&nbsp;&nbsp; 格式：grep [option] pattern filenames&nbsp;<br />&nbsp;&nbsp;&nbsp; 功能：逐行搜索所指定的文件或标准输入，并显示匹配模式的每一行。&nbsp;<br />&nbsp;&nbsp;&nbsp; 选项：-i&nbsp;&nbsp;&nbsp; 匹配时忽略大小写&nbsp;<br />&nbsp; -v 找出模式失配的行&nbsp;<br /><br />&nbsp;&nbsp;&nbsp; 例如：% grep -i 'java*' ./test/run.sh&nbsp;<br /><br />15. 统计文件字数&nbsp;<br />&nbsp;&nbsp;&nbsp; 命令：wc [option] filename&nbsp;<br />&nbsp;&nbsp;&nbsp; 功能：统计文件中的文件行数、字数和字符数。&nbsp;<br />&nbsp;&nbsp;&nbsp; 选项：-l 统计文件的行数&nbsp;<br />-w 统计文件的单词数&nbsp;<br />-c 统计文件的字符数&nbsp;<br />&nbsp;&nbsp;&nbsp; 注释：若缺省文件名则指标准输入&nbsp;<br />&nbsp;&nbsp;&nbsp; 例如：% wc -c ./test/run.sh&nbsp;<br /><br />16. 显示磁盘空间&nbsp;<br />&nbsp;&nbsp;&nbsp; 命令：df (disk free)&nbsp;<br />&nbsp;&nbsp;&nbsp; 格式：df [option]&nbsp;<br />&nbsp;&nbsp;&nbsp; 功能：显示磁盘空间的使用情况，包括文件系统安装的目录名、块设备名、总&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 字节数、已用字节数、剩余字节数占用百分比。&nbsp;<br />&nbsp;&nbsp;&nbsp; 选项：&nbsp;<br />-a：显示全部的档案系统和各分割区的磁盘使用情形&nbsp;<br />-i：显示i -nodes的使用量&nbsp;<br />-k：大小用k来表示 (默认值)&nbsp;<br />-t：显示某一个档案系统的所有分割区磁盘使用量&nbsp;<br />-x：显示不是某一个档案系统的所有分割区磁盘使用量&nbsp;<br />-T：显示每个分割区所属的档案系统名称&nbsp;<br />-h: 表示使用「Human-readable」的输出，也就是在档案系统大小使用 GB、MB 等易读的格式。&nbsp;<br />&nbsp;&nbsp;&nbsp; 注释：&nbsp;<br />&nbsp;&nbsp;&nbsp; 例如：% df -hi&nbsp;<br /><br />17. 查询档案或目录的磁盘使用空间&nbsp;<br />&nbsp;&nbsp;&nbsp; 命令：du (disk usage)&nbsp;<br />&nbsp;&nbsp;&nbsp; 格式：du [option] [filename]&nbsp;<br />&nbsp;&nbsp;&nbsp; 功能：以指定的目录下的子目录为单位，显示每个目录内所有档案所占用的磁盘空间大小&nbsp;<br />&nbsp;&nbsp;&nbsp; 选项：&nbsp;<br />-a：显示全部目录和其次目录下的每个档案所占的磁盘空间&nbsp;<br />-b：大小用bytes来表示 (默认值为k bytes)&nbsp;<br />-c：最后再加上总计 (默认值)&nbsp;<br />-s：只显示各档案大小的总合&nbsp;<br />-x：只计算同属同一个档案系统的档案&nbsp;<br />-L：计算所有的档案大小&nbsp;<br />-h: 表示档案系统大小使用 GB、MB 等易读的格式。&nbsp;<br />&nbsp;&nbsp;&nbsp; 例如：% du -a&nbsp;<br />% du -sh /etc 只显示该目录的总合&nbsp;<br />% du /etc | sort -nr | more 统计结果用sort 指令进行排序，&nbsp;<br />sort 的参数 -nr 表示要以数字排序法进行反向排序。&nbsp;<br /><br />18. 显示进程&nbsp;<br />&nbsp;&nbsp;&nbsp; 命令：ps&nbsp;<br />&nbsp;&nbsp;&nbsp; 格式：ps [option]&nbsp;<br />&nbsp;&nbsp;&nbsp; 功能：显示系统中进程的信息。包括进程ID、控制进程终端、执行时间和命令。&nbsp;<br />&nbsp;&nbsp;&nbsp; 选项：&nbsp;<br />&nbsp; -a 显示所有进程信息&nbsp;<br />&nbsp; -U uidlist 列出这个用户的所有进程&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -e 显示当前运行的每一个进程信息&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -f 显示一个完整的列表&nbsp;<br />&nbsp; -x 显示包括没有终端控制的进程状况 。&nbsp;<br />&nbsp;&nbsp;&nbsp; 注释：&nbsp;<br />&nbsp;&nbsp;&nbsp; 例如：% ps -ef&nbsp;<br />&nbsp; % ps -aux 然后再利用一个管道符号导向到grep去查找特定的进程,然后再对特定的进程进行操作。&nbsp;<br /><br />19. 终止进程&nbsp;<br />&nbsp;&nbsp;&nbsp; 命令：kill&nbsp;<br />&nbsp;&nbsp;&nbsp; 格式：kill [option] pid&nbsp;<br />&nbsp;&nbsp;&nbsp; 功能：向指定的进程送信号或终止进程。kill指令的用途是送一个signal给某一个process，&nbsp;<br />&nbsp;&nbsp;&nbsp; 因为大部份送的都是用来杀掉 process 的 SIGKILL 或 SIGHUP ，因此称为 kill&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp; 选项：-9&nbsp; 强行终止进程&nbsp;<br />&nbsp;&nbsp;&nbsp; 注释：pid标示进程号，可由ps命令得到。&nbsp;<br />&nbsp;&nbsp;&nbsp; 例如：% kill -9 pid&nbsp;<br />&nbsp;&nbsp;&nbsp; 你也可以用 kill -l 来察看可代替 signal 号码的数目字。kill 的详细情形请参阅 man kill。&nbsp;<br /><br />20. 查看自己的IP地址&nbsp;<br />&nbsp;&nbsp;&nbsp; 命令：ifconfig&nbsp;<br />&nbsp;&nbsp;&nbsp; 格式：ifconfig -a&nbsp;<br />&nbsp;&nbsp;&nbsp;<br />21. 查看路由表&nbsp;<br />&nbsp;&nbsp;&nbsp; 命令：netstat&nbsp;<br />&nbsp;&nbsp;&nbsp; 格式：netstat -rn&nbsp;<br /><br />22. 远程登录&nbsp;<br />&nbsp;&nbsp;&nbsp; 命令：telnet&nbsp;<br />&nbsp;&nbsp;&nbsp; 格式：telnet hostname&nbsp;<br /><br />23. 文件传输&nbsp;<br />&nbsp;&nbsp;&nbsp; 命令：ftp (file transfer program)&nbsp;<br />&nbsp;&nbsp;&nbsp; 格式：ftp hostname&nbsp;<br />&nbsp;&nbsp;&nbsp; 功能：网络文件传输及远程操作。&nbsp;<br />&nbsp;&nbsp;&nbsp; 选项：ftp命令：&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cd [dirname]&nbsp; 进入远程机的目录&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lcd [dirname] 设置本地机的目录&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dir/ls&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 显示远程的目录文件&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bin&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 以二进制方式进行传输&nbsp;<br />&nbsp;&nbsp; asc&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 以文本文件方式进行传输&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; get/mget&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 从远程机取一个或多个文件&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; put/mput&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 向远程机送一个或多个文件&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; prompt&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 打开或关闭多个文件传送时的交互提示&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; close&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 关闭与远程机的连接&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; quit&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 退出ftp&nbsp;<br />&nbsp;&nbsp; !/exit ftp登陆状态下，!表示暂时退出ftp状态回到本地目录，exit表示返回ftp状态&nbsp;<br />&nbsp;&nbsp;&nbsp; 注释：&nbsp;<br />&nbsp;&nbsp;&nbsp; 例如：% ftp hostname&nbsp;<br /><br />24. 查看自己的电子邮件&nbsp;<br />&nbsp;&nbsp;&nbsp; 命令：mailx&nbsp;<br />&nbsp;&nbsp;&nbsp; 格式：mailx&nbsp;<br />&nbsp;&nbsp;&nbsp; 选项：&nbsp;<br />delete&nbsp; 删除&nbsp;<br />next&nbsp;&nbsp;&nbsp; 下一个&nbsp;<br />quit&nbsp;&nbsp;&nbsp; 退出&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; reply&nbsp;&nbsp; 回复&nbsp;&nbsp;&nbsp;&nbsp;<br /><br />25. 回忆命令&nbsp;<br />&nbsp;&nbsp;&nbsp; 命令：history&nbsp;<br />&nbsp;&nbsp;&nbsp; 格式：history&nbsp;<br />&nbsp;&nbsp;&nbsp; 功能：帮助用户回忆执行过的命令。&nbsp;<br />&nbsp;&nbsp;&nbsp; 选项：&nbsp;<br />&nbsp;&nbsp;&nbsp; 注释：&nbsp;<br />&nbsp;&nbsp;&nbsp; 例如：% history&nbsp;<br /><br />26. 网上对话&nbsp;<br />&nbsp;&nbsp;&nbsp; 命令：talk&nbsp;<br />&nbsp;&nbsp;&nbsp; 格式：talk username&nbsp;<br />&nbsp;&nbsp;&nbsp; 功能：在网上与另一用户进行对话。&nbsp;<br />&nbsp;&nbsp;&nbsp; 选项：&nbsp;<br />&nbsp;&nbsp;&nbsp; 注释：对话时系统把终端分为上下两部分，上半部显示自己键入信息，下半部&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 显示对方用户键入的信息。键入delete或Ctrl+C则结束对话。&nbsp;<br />&nbsp;&nbsp;&nbsp; 例如：% talk username&nbsp;<br /><br />27. 允许或拒绝接受信息&nbsp;<br />&nbsp;&nbsp;&nbsp; 命令：mesg (message)&nbsp;<br />&nbsp;&nbsp;&nbsp; 格式：mesg [n/y]&nbsp;<br />&nbsp;&nbsp;&nbsp; 功能：允许或拒绝其它用户向自己所用的终端发送信息。&nbsp;<br />&nbsp;&nbsp;&nbsp; 选项：n 拒绝其它用户向自己所用的终端写信息&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; y 允许其它用户向自己所用的终端写信息（缺省值）&nbsp;<br />&nbsp;&nbsp;&nbsp; 注释：&nbsp;<br />&nbsp;&nbsp;&nbsp; 例如：% mesg n&nbsp;<br /><br />28. 给其他用户写信息&nbsp;<br />&nbsp;&nbsp;&nbsp; 命令：write&nbsp;<br />&nbsp;&nbsp;&nbsp; 格式：write username [ttyname]&nbsp;<br />&nbsp;&nbsp;&nbsp; 功能：给其他用户的终端写信息。&nbsp;<br />&nbsp;&nbsp;&nbsp; 选项：&nbsp;<br />&nbsp;&nbsp;&nbsp; 注释：若对方没有拒绝，两用户可进行交谈，键入EOF或Ctrl+C则结束对话。&nbsp;<br />&nbsp;&nbsp;&nbsp; 例如：write username&nbsp;<br /><br />29. 创建、修改、删除用户和群组&nbsp;<br />&nbsp;&nbsp;&nbsp; a. 创建群组：&nbsp;<br />例如： groupadd oinstall&nbsp;&nbsp;&nbsp; 创建群组名为oinstall的组&nbsp;<br />groupadd -g 344 dba&nbsp;&nbsp;<br />创建组号是344的组，此时在/etc/passwd文件中产生一个组ID（GID）是344的项目。&nbsp;<br />&nbsp;&nbsp;&nbsp; b. 修改群组：&nbsp;<br />groupmod:该命令用于改变用户组帐号的属性&nbsp;<br />groupmod &#8211;g 新的GID 用户组帐号名&nbsp;<br />groupmod &#8211;n 新组名 原组名：此命令由于改变用户组的名称&nbsp;<br /><br />&nbsp;&nbsp;&nbsp; c. 删除群组：&nbsp;<br />groupdel 组名：该命令用于删除指定的组帐号&nbsp;<br /><br />&nbsp;&nbsp;&nbsp; d. 新建用户：&nbsp;<br />命令： useradd [－d home] [－s shell] [－c comment] [－m [－k template]]&nbsp;<br />[－f inactive] [－e expire ] [－p passwd] [－r] name&nbsp;<br />主要参数&nbsp;<br />-c：加上备注文字，备注文字保存在passwd的备注栏中。　&nbsp;<br />-d：指定用户登入时的启始目录。&nbsp;<br />-D：变更预设值。&nbsp;<br />-e：指定账号的有效期限，缺省表示永久有效。&nbsp;<br />-f：指定在密码过期后多少天即关闭该账号。&nbsp;<br />-g：指定用户所属的群组。&nbsp;<br />-G：指定用户所属的附加群组。&nbsp;<br />-m：自动建立用户的登入目录。&nbsp;<br />-M：不要自动建立用户的登入目录。&nbsp;<br />-n：取消建立以用户名称为名的群组。&nbsp;<br />-r：建立系统账号。&nbsp;<br />-s：指定用户登入后所使用的shell。&nbsp;<br />-u：指定用户ID号。&nbsp;<br /><br />举例： # useradd -g oinstall -G dba oracle&nbsp; 创建Oracle用户&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp; e. 删除用户&nbsp;<br />命令： userdel 用户名&nbsp;<br />删除指定的用户帐号&nbsp;<br />userdel &#8211;r 用户名(userdel 用户名;rm 用户名)：删除指定的用户帐号及宿主目录&nbsp;<br />例：#useradd -g root kkk //把kkk用户加入root组里&nbsp;<br /><br />&nbsp;&nbsp;&nbsp; f. 修改用户&nbsp;<br />命令： usermod&nbsp;<br />修改已有用户的信息&nbsp;<br />usermod &#8211;l 旧用户名 新用户名： 修改用户名&nbsp;<br />usermod &#8211;L 用户名： 用于锁定指定用户账号，使其不能登陆系统&nbsp;<br />usermod &#8211;U 用户名： 对锁定的用户帐号进行解锁&nbsp;<br />passwd &#8211;d 用户名： 使帐号无口令，即用户不需要口令就能登录系统&nbsp;<br />例：#usermod -l user2 user1 //把用户user2改名为user1&nbsp;<br /><br />30. 启动、关闭防火墙&nbsp;<br />永久打开或则关闭&nbsp;<br />chkconfig iptables on&nbsp;<br />chkconfig iptables off&nbsp;<br />即时生效：重启后还原&nbsp;<br />service iptables start&nbsp;<br />service iptables stop&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp; 或者：&nbsp;<br />/etc/init.d/iptables start&nbsp;<br />/etc/init.d/iptables stop&nbsp;<br /><br />31. 启动VSFTP服务&nbsp;<br />即时启动： /etc/init.d/vsftpd start&nbsp;<br />即时停止： /etc/init.d/vsftpd stop&nbsp;<br /><br />开机默认VSFTP服务自动启动:&nbsp;<br />方法一:(常用\方便)&nbsp;<br />[root@localhost etc]# chkconfig --list|grep vsftpd ( 查看情况)&nbsp;<br />vsftpd&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0:off&nbsp;&nbsp; 1:off&nbsp;&nbsp; 2:off&nbsp;&nbsp; 3:off&nbsp;&nbsp; 4:off&nbsp;&nbsp; 5:off&nbsp;&nbsp; 6:off&nbsp;<br />[root@localhost etc]# chkconfig vsftpd on&nbsp; (执行ON设置)&nbsp;<br />或者:方法二:&nbsp;<br />修改文件 /etc/rc.local , 把行/usr/local/sbin/vsftpd &amp; 插入文件中，以实现开机自动启动。&nbsp;<br /><br />32. vi技巧&nbsp;<br />a. 进入输入模式&nbsp;<br />新增 (append)&nbsp;<br />a ：从光标所在位置後面开始新增资料，光标後的资料随新增资料向後移动。&nbsp;<br />A：从光标所在列最後面的地方开始新增资料。&nbsp;<br /><br />插入 (insert)&nbsp;<br />i：从光标所在位置前面开始插入资料，光标後的资料随新增资料向後移动。&nbsp;<br />I ：从光标所在列的第一个非空白字元前面开始插入资料。&nbsp;<br /><br />开始 (open)&nbsp;<br />o ：在光标所在列下新增一列并进入输入模式。&nbsp;<br />O: 在光标所在列上方新增一列并进入输入模式。&nbsp;<br />b. 退出vi&nbsp;<br />在指令模式下键入:q,:q!,:wq或:x(注意:号），就会退出vi。其中:wq和:x是存盘退出，而:q是直接退出，如果文件已有新的变化，vi会提示你保存文件而:q命令也会失效，这时你可以用:w命令保存文件后再用:q 退出，或用:wq或:x命令退出，如果你不想保存改变后的文件，你就需要用:q!命令，这个命令将不保存文件而直接退出vi。&nbsp;<br /><br />c. 删除与修改文件的命令：&nbsp;<br />x：删除光标所在字符。&nbsp;<br />dd ：删除光标所在的列。&nbsp;<br />r ：修改光标所在字元，r 後接著要修正的字符。&nbsp;<br />R：进入取替换状态，新增文字会覆盖原先文字，直到按 [ESC] 回到指令模式下为止。&nbsp;<br />s：删除光标所在字元，并进入输入模式。&nbsp;<br />S：删除光标所在的列，并进入输入模式。&nbsp;<br /><br />d. 屏幕翻滚类命令&nbsp;<br />Ctrl+u: 向文件首翻半屏&nbsp;<br />Ctrl+d: 向文件尾翻半屏&nbsp;<br />Ctrl+f: 向文件尾翻一屏&nbsp;<br />Ctrl＋b: 向文件首翻一屏&nbsp;<br />nz: 将第n行滚至屏幕顶部，不指定n时将当前行滚至屏幕顶部。&nbsp;<br /><br />e. 删除命令&nbsp;<br />ndw或ndW: 删除光标处开始及其后的n-1个字&nbsp;<br />do: 删至行首&nbsp;<br />d$: 删至行尾&nbsp;<br />ndd: 删除当前行及其后n-1行&nbsp;<br />x或X: 删除一个字符，x删除光标后的，而X删除光标前的&nbsp;<br />Ctrl+u: 删除输入方式下所输入的文本&nbsp;<br /><br />f. 搜索及替换命令&nbsp;<br />/pattern: 从光标开始处向文件尾搜索pattern&nbsp;<br />?pattern: 从光标开始处向文件首搜索pattern&nbsp;<br />n: 在同一方向重复上一次搜索命令&nbsp;<br />N: 在反方向上重复上一次搜索命令&nbsp;<br />:s/p1/p2/g: 将当前行中所有p1均用p2替代&nbsp;<br />:n1,n2s/p1/p2/g: 将第n1至n2行中所有p1均用p2替代&nbsp;<br />:g/p1/s//p2/g: 将文件中所有p1均用p2替换&nbsp;<br /><br />g. 复制，黏贴&nbsp;<br />(1) 选定文本块，使用v进入可视模式；移动光标键选定内容&nbsp;<br />(2) 复制选定块到缓冲区，用y；复制整行，用yy&nbsp;<br />(3) 剪切选定块到缓冲区，用d；剪切整行用dd&nbsp;<br />(4) 粘贴缓冲区中的内容，用p&nbsp;<br /><br />h. 其他&nbsp;<br />在同一编辑窗打开第二个文件，用:sp [filename]&nbsp;<br />在多个编辑文件之间切换，用Ctrl+w</div><img src ="http://www.cppblog.com/sunrise/aggbug/195910.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/sunrise/" target="_blank">SunRise_at</a> 2012-12-03 10:42 <a href="http://www.cppblog.com/sunrise/archive/2012/12/03/195910.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title> （转）Fedora 16上源码建立pydev + eclipse的OpenStack开发环境笔记草稿 ( by quqi99 )</title><link>http://www.cppblog.com/sunrise/archive/2012/10/26/193886.html</link><dc:creator>SunRise_at</dc:creator><author>SunRise_at</author><pubDate>Fri, 26 Oct 2012 02:20:00 GMT</pubDate><guid>http://www.cppblog.com/sunrise/archive/2012/10/26/193886.html</guid><wfw:comment>http://www.cppblog.com/sunrise/comments/193886.html</wfw:comment><comments>http://www.cppblog.com/sunrise/archive/2012/10/26/193886.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cppblog.com/sunrise/comments/commentRss/193886.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/sunrise/services/trackbacks/193886.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 作者：张华&nbsp; 发表于：2012-3-30版权声明：可以任意转载，转载时请务必以超链接形式标明文章原始出处和作者信息及本版权声明( http://blog.csdn.net/quqi99 )&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1网络桥接配置首先，fedora16对网卡使用了新的命名方式，第一块网卡不叫eth0，我的T4...&nbsp;&nbsp;<a href='http://www.cppblog.com/sunrise/archive/2012/10/26/193886.html'>阅读全文</a><img src ="http://www.cppblog.com/sunrise/aggbug/193886.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/sunrise/" target="_blank">SunRise_at</a> 2012-10-26 10:20 <a href="http://www.cppblog.com/sunrise/archive/2012/10/26/193886.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>wget命令详解</title><link>http://www.cppblog.com/sunrise/archive/2012/09/17/190937.html</link><dc:creator>SunRise_at</dc:creator><author>SunRise_at</author><pubDate>Mon, 17 Sep 2012 01:06:00 GMT</pubDate><guid>http://www.cppblog.com/sunrise/archive/2012/09/17/190937.html</guid><wfw:comment>http://www.cppblog.com/sunrise/comments/190937.html</wfw:comment><comments>http://www.cppblog.com/sunrise/archive/2012/09/17/190937.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/sunrise/comments/commentRss/190937.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/sunrise/services/trackbacks/190937.html</trackback:ping><description><![CDATA[<p style="margin-top: 0px; margin-right: 0px; margin-left: 0px; margin-bottom: 0.75em; color: #333333; font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; line-height: 24px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">wget是在Linux下开发的开放源代码的软件，作者是Hrvoje Niksic，后来被移植到包括Windows在内的各个平台上。它有以下功能和特点：<br />（1）支持断点下传功能；这一点，也是网络蚂蚁和FlashGet当年最大的卖点，现在，Wget也可以使用此功能，那些网络不是太好的用户可以放心了；<br />（2）同时支持FTP和HTTP下载方式；尽管现在大部分软件可以使用HTTP方式下载，但是，有些时候，仍然需要使用FTP方式下载软件；<br />（3）支持代理服务器；对安全强度很高的系统而言，一般不会将自己的系统直接暴露在互联网上，所以，支持代理是下载软件必须有的功能；<br />（4）设置方便简单；可能，习惯图形界面的用户已经不是太习惯命令行了，但是，命令行在设置上其实有更多的优点，最少，鼠标可以少点很多次，也不要担心是否错点鼠标；<br />（5）程序小，完全免费；程序小可以考虑不计，因为现在的硬盘实在太大了；完全免费就不得不考虑了，即使网络上有很多所谓的免费软件，但是，这些软件的广告却不是我们喜欢的；<br /><br />wget虽然功能强大，但是使用起来还是比较简单的，基本的语法是：wget [参数列表] URL。下面就结合具体的例子来说明一下wget的用法。<br />1、下载整个http或者ftp站点。<br />wget http://place.your.url/here<br />这个命令可以将http://place.your.url/here 首页下载下来。使用-x会强制建立服务器上一模一样的目录，如果使用-nd参数，那么服务器上下载的所有内容都会加到本地当前目录。</p><p style="margin-top: 0px; margin-right: 0px; margin-left: 0px; margin-bottom: 0.75em; color: #333333; font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; line-height: 24px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">wget -r http://place.your.url/here<br />这 个命令会按照递归的方法，下载服务器上所有的目录和文件，实质就是下载整个网站。这个命令一定要小心使用，因为在下载的时候，被下载网站指向的所有地址同 样会被下载，因此，如果这个网站引用了其他网站，那么被引用的网站也会被下载下来！基于这个原因，这个参数不常用。可以用-l number参数来指定下载的层次。例如只下载两层，那么使用-l 2。</p><p style="margin-top: 0px; margin-right: 0px; margin-left: 0px; margin-bottom: 0.75em; color: #333333; font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; line-height: 24px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">要是您想制作镜像站点，那么可以使用－m参数，例如：wget -m http://place.your.url/here<br />这时wget会自动判断合适的参数来制作镜像站点。此时，wget会登录到服务器上，读入robots.txt并按robots.txt的规定来执行。</p><p style="margin-top: 0px; margin-right: 0px; margin-left: 0px; margin-bottom: 0.75em; color: #333333; font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; line-height: 24px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">2、断点续传。<br />当文件特别大或者网络特别慢的时候，往往一个文件还没有下载完，连接就已经被切断，此时就需要断点续传。wget的断点续传是自动的，只需要使用-c参数，例如：<br />wget -c http://the.url.of/incomplete/file<br />使用断点续传要求服务器支持断点续传。-t参数表示重试次数，例如需要重试100次，那么就写-t 100，如果设成-t 0，那么表示无穷次重试，直到连接成功。-T参数表示超时等待时间，例如-T 120，表示等待120秒连接不上就算超时。</p><p style="margin-top: 0px; margin-right: 0px; margin-left: 0px; margin-bottom: 0.75em; color: #333333; font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; line-height: 24px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">3、批量下载。<br />如果有多个文件需要下载，那么可以生成一个文件，把每个文件的URL写一行，例如生成文件download.txt，然后用命令：wget -i download.txt<br />这样就会把download.txt里面列出的每个URL都下载下来。（如果列的是文件就下载文件，如果列的是网站，那么下载首页）</p><p style="margin-top: 0px; margin-right: 0px; margin-left: 0px; margin-bottom: 0.75em; color: #333333; font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; line-height: 24px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">4、选择性的下载。<br />可以指定让wget只下载一类文件，或者不下载什么文件。例如：<br />wget -m &#8211;reject=gif http://target.web.site/subdirectory<br />表示下载http://target.web.site/subdirectory，但是忽略gif文件。&#8211;accept=LIST 可以接受的文件类型，&#8211;reject=LIST拒绝接受的文件类型。</p><p style="margin-top: 0px; margin-right: 0px; margin-left: 0px; margin-bottom: 0.75em; color: #333333; font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; line-height: 24px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">5、密码和认证。<br />wget只能处理利用用户名/密码方式限制访问的网站，可以利用两个参数：<br />&#8211;http-user=USER设置HTTP用户<br />&#8211;http-passwd=PASS设置HTTP密码<br />对于需要证书做认证的网站，就只能利用其他下载工具了，例如curl。</p><p style="margin-top: 0px; margin-right: 0px; margin-left: 0px; margin-bottom: 0.75em; color: #333333; font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; line-height: 24px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">6、利用代理服务器进行下载。<br />如果用户的网络需要经过代理服务器，那么可以让wget通过代理服务器进行文件的下载。此时需要在当前用户的目录下创建一个.wgetrc文件。文件中可以设置代理服务器：<br />http-proxy = 111.111.111.111:8080<br />ftp-proxy = 111.111.111.111:8080<br />分别表示http的代理服务器和ftp的代理服务器。如果代理服务器需要密码则使用：<br />&#8211;proxy-user=USER设置代理用户<br />&#8211;proxy-passwd=PASS设置代理密码<br />这两个参数。<br />使用参数&#8211;proxy=on/off 使用或者关闭代理。<br />wget还有很多有用的功能，需要用户去挖掘。</p><p style="margin-top: 0px; margin-right: 0px; margin-left: 0px; margin-bottom: 0.75em; color: #333333; font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; line-height: 24px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">附录：</p><p style="margin-top: 0px; margin-right: 0px; margin-left: 0px; margin-bottom: 0.75em; color: #333333; font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; line-height: 24px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">命令格式：<br />wget [参数列表] [目标软件、网页的网址]</p><p style="margin-top: 0px; margin-right: 0px; margin-left: 0px; margin-bottom: 0.75em; color: #333333; font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; line-height: 24px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">-V,&#8211;version 显示软件版本号然后退出；<br />-h,&#8211;help显示软件帮助信息；<br />-e,&#8211;execute=COMMAND 执行一个 &#8220;.wgetrc&#8221;命令</p><p style="margin-top: 0px; margin-right: 0px; margin-left: 0px; margin-bottom: 0.75em; color: #333333; font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; line-height: 24px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">-o,&#8211;output-file=FILE 将软件输出信息保存到文件；<br />-a,&#8211;append-output=FILE将软件输出信息追加到文件；<br />-d,&#8211;debug显示输出信息；<br />-q,&#8211;quiet 不显示输出信息；<br />-i,&#8211;input-file=FILE 从文件中取得URL；</p><p style="margin-top: 0px; margin-right: 0px; margin-left: 0px; margin-bottom: 0.75em; color: #333333; font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; line-height: 24px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">-t,&#8211;tries=NUMBER 是否下载次数（0表示无穷次）<br />-O &#8211;output-document=FILE下载文件保存为别的文件名<br />-nc, &#8211;no-clobber 不要覆盖已经存在的文件<br />-N,&#8211;timestamping只下载比本地新的文件<br />-T,&#8211;timeout=SECONDS 设置超时时间<br />-Y,&#8211;proxy=on/off 关闭代理</p><p style="margin-top: 0px; margin-right: 0px; margin-left: 0px; margin-bottom: 0.75em; color: #333333; font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; line-height: 24px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">-nd,&#8211;no-directories 不建立目录<br />-x,&#8211;force-directories 强制建立目录</p><p style="margin-top: 0px; margin-right: 0px; margin-left: 0px; margin-bottom: 0.75em; color: #333333; font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; line-height: 24px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">&#8211;http-user=USER设置HTTP用户<br />&#8211;http-passwd=PASS设置HTTP密码<br />&#8211;proxy-user=USER设置代理用户<br />&#8211;proxy-passwd=PASS设置代理密码</p><p style="margin-top: 0px; margin-right: 0px; margin-left: 0px; margin-bottom: 0.75em; color: #333333; font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; line-height: 24px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">-r,&#8211;recursive 下载整个网站、目录（小心使用）<br />-l,&#8211;level=NUMBER 下载层次</p><p style="margin-top: 0px; margin-right: 0px; margin-left: 0px; margin-bottom: 0.75em; color: #333333; font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; line-height: 24px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">-A,&#8211;accept=LIST 可以接受的文件类型<br />-R,&#8211;reject=LIST拒绝接受的文件类型<br />-D,&#8211;domains=LIST可以接受的域名<br />&#8211;exclude-domains=LIST拒绝的域名<br />-L,&#8211;relative 下载关联链接<br />&#8211;follow-ftp 只下载FTP链接<br />-H,&#8211;span-hosts 可以下载外面的主机<br />-I,&#8211;include-directories=LIST允许的目录<br />-X,&#8211;exclude-directories=LIST 拒绝的目录</p><p style="margin-top: 0px; margin-right: 0px; margin-left: 0px; margin-bottom: 0.75em; color: #333333; font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; line-height: 24px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">中文文档名在平常的情况下会被编码， 但是在 &#8211;cut-dirs 时又是正常的，<br />wget -r -np -nH &#8211;cut-dirs=3 ftp://host/test/<br />测试.txt<br />wget -r -np -nH -nd ftp://host/test/<br />%B4%FA%B8%D5.txt<br />wget &#8220;ftp://host/test/*&#8221;<br />%B4%FA%B8%D5.txt</p><p style="margin-top: 0px; margin-right: 0px; margin-left: 0px; margin-bottom: 0.75em; color: #333333; font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; line-height: 24px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">由 於不知名的原因，可能是为了避开特殊档名， wget 会自动将抓取档名的部分用 encode_string 处理过， 所以该 patch 就把被 encode_string 处理成 &#8220;%3A&#8221; 这种东西， 用 decode_string 还原成 &#8220;:&#8221;，并套用在目录与档案名称的部分，decode_string 是 wget 内建的函式。</p><p style="margin-top: 0px; margin-right: 0px; margin-left: 0px; margin-bottom: 0.75em; color: #333333; font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; line-height: 24px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">wget -t0 -c -nH -x -np -b -m -P /home/sunny/NOD32view/&nbsp; http://downloads1.kaspersky-labs.com/bases/ -o wget.log</p><div></div><img src ="http://www.cppblog.com/sunrise/aggbug/190937.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/sunrise/" target="_blank">SunRise_at</a> 2012-09-17 09:06 <a href="http://www.cppblog.com/sunrise/archive/2012/09/17/190937.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>linux下各种解压方法</title><link>http://www.cppblog.com/sunrise/archive/2012/08/16/187392.html</link><dc:creator>SunRise_at</dc:creator><author>SunRise_at</author><pubDate>Thu, 16 Aug 2012 09:49:00 GMT</pubDate><guid>http://www.cppblog.com/sunrise/archive/2012/08/16/187392.html</guid><wfw:comment>http://www.cppblog.com/sunrise/comments/187392.html</wfw:comment><comments>http://www.cppblog.com/sunrise/archive/2012/08/16/187392.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/sunrise/comments/commentRss/187392.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/sunrise/services/trackbacks/187392.html</trackback:ping><description><![CDATA[<div style="margin-top: 0px; margin-right: auto; margin-bottom: 0px; margin-left: auto; padding-top: 17px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; width: 672px; overflow-x: hidden; overflow-y: hidden; line-height: 1.3em; font-family: 宋体, Arial; background-color: #e8e8e8; "><div id="detail" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.3; "><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 5px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.5; font-size: 14px; "><span style="line-height: 18px; font-family: Arial, sans-serif, Helvetica, Tahoma; ">大致总结了一下linux下各种格式的压缩包的压缩、解压方法。但是部分方法我没有用到，也就不全，希望大家帮我补充，我将随时修改完善，谢谢！&nbsp;<br />　　&nbsp;<br />　　.tar&nbsp;<br />　　解包：tar xvf FileName.tar&nbsp;<br />　　打包：tar cvf FileName.tar DirName&nbsp;<br />　　（注：tar是打包，不是压缩！）&nbsp;<br />　　&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&nbsp;<br />　　.gz&nbsp;<br />　　解压 1：gunzip FileName.gz&nbsp;<br />　　解压2：gzip -d FileName.gz&nbsp;<br />　　压缩：gzip FileName&nbsp;<br />　　.tar.gz 和 .tgz&nbsp;<br />　　解压：tar zxvf FileName.tar.gz&nbsp;<br />　　压缩：tar zcvf FileName.tar.gz DirName&nbsp;<br />　　&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&nbsp;<br />　　.bz2&nbsp;<br />　　解压1：bzip2 -d FileName.bz2&nbsp;<br />　　解压2：bunzip2 FileName.bz2&nbsp;<br />　　压缩： bzip2 -z FileName&nbsp;<br />　　.tar.bz2&nbsp;<br />　　解压：tar jxvf FileName.tar.bz2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 或tar --bzip xvf FileName.tar.bz2&nbsp;<br />　　压缩：tar jcvf FileName.tar.bz2 DirName&nbsp;<br />　　 &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&nbsp;<br />　　.bz&nbsp;<br />　　解压1：bzip2 -d FileName.bz&nbsp;<br />　　解压2：bunzip2 FileName.bz&nbsp;<br />　　压缩：未知&nbsp;<br />　　.tar.bz&nbsp;<br />　　解压：tar jxvf FileName.tar.bz&nbsp;<br />　　压缩：未知&nbsp;<br />　　&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&nbsp;<br />　　.Z&nbsp;<br />　　解压：uncompress FileName.Z&nbsp;<br />　　压缩：compress FileName&nbsp;<br />　　.tar.Z&nbsp;<br />　　解压：tar Zxvf FileName.tar.Z&nbsp;<br />　　压缩：tar Zcvf FileName.tar.Z DirName&nbsp;<br />　　&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&nbsp;<br />　　.zip&nbsp;<br />　　解压：unzip FileName.zip&nbsp;<br />　　压缩：zip FileName.zip DirName&nbsp;<br />　　压缩一个目录使用 -r 参数，-r 递归。例： $ zip -r FileName.zip DirName&nbsp;<br />　　&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&nbsp;<br />　　.rar&nbsp;<br />　　解压：rar x FileName.rar&nbsp;<br />　　压缩：rar a FileName.rar DirName&nbsp;<br />　　&nbsp;<br />　　rar 请到：http://www.rarsoft.com/download.htm 下载！&nbsp;<br />　　解压后请将rar_static拷贝到/usr /bin目录（其他由$PATH环境变量指定的目录也可以）：&nbsp;<br />　　[root@www2 tmp]# cp rar_static /usr/bin/rar&nbsp;<br />　　&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&nbsp;<br />　　.lha&nbsp;<br />　　解压：lha -e FileName.lha&nbsp;<br />　　压缩：lha -a FileName.lha FileName&nbsp;<br />　　&nbsp;<br />　　lha请到：http://www.infor.kanazawa-it.ac.jp/~ishii/lhaunix/下载！&nbsp;<br />　　&gt;解压后请将 lha拷贝到/usr/bin目录（其他由$PATH环境变量指定的目录也可以）：&nbsp;<br />　　[root@www2 tmp]# cp lha /usr/bin/&nbsp;<br />　　&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&nbsp;<br />　　.rpm&nbsp;<br />　　解包：rpm2cpio FileName.rpm | cpio -div&nbsp;<br />　　&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&nbsp;<br />　　.deb&nbsp;<br />　　解包：ar p FileName.deb data.tar.gz | tar zxf -&nbsp;<br />　　&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&nbsp;<br />　　.tar .tgz .tar.gz .tar.Z .tar.bz .tar.bz2 .zip .cpio .rpm .deb .slp .arj .rar .ace .lha .lzh .lzx .lzs .arc .sda .sfx .lnx .zoo .cab .kar .cpt .pit .sit .sea&nbsp;<br />　　解压：sEx x FileName.*&nbsp;<br />　　压缩：sEx a FileName.* FileName&nbsp;<br />　　&nbsp;<br />　　sEx只是调用相关程序，本身并无压缩、解压功能，请注意！&nbsp;<br />　　sEx请到： http://sourceforge.net/projects/sex下载！&nbsp;<br />　　解压后请将sEx拷贝到/usr/bin目录（其他由$PATH环境变量指定的目录也可以）：&nbsp;<br />　　[root@www2 tmp]# cp sEx /usr/bin/　　Linux下常见文件解压方法及命令&nbsp;<br />　　系统&#183;System&nbsp;<br />　　&nbsp;<br />　　1.以.a为扩展名的文件:&nbsp;<br />　　#tar xv file.a&nbsp;<br />　　2.以.z为扩展名的文件:&nbsp;<br />　　#uncompress file.Z&nbsp;<br />　　3.以.gz为扩展名的文件:&nbsp;<br />　　#gunzip file.gz&nbsp;<br />　　4.以.bz2为扩展名的文件:&nbsp;<br />　　#bunzip2 file.bz2&nbsp;<br />　　5.以.tar.Z为扩展名的文件:&nbsp;<br />　　#tar xvZf file.tar.Z&nbsp;<br />　　或 #compress -dc file.tar.Z | tar xvf&nbsp;<br />　　6.以.tar.gz/.tgz为扩展名的文件:&nbsp;<br />　　#tar xvzf file.tar.gz&nbsp;<br />　　或 gzip -dc file.tar.gz | tar xvf -&nbsp;<br />　　7.以.tar.bz2为扩展名的文件:&nbsp;<br />　　#tar xvIf file.tar.bz2&nbsp;<br />　　或 bzip2 -dc file.tar.bz2 | xvf -&nbsp;<br />　　8.以.cpio.gz/.cgz为扩展名的文件:&nbsp;<br />　　#gzip -dc file.cgz | cpio -div&nbsp;<br />　　9. 以.cpio/cpio为扩展名的文件:&nbsp;<br />　　#cpio -div file.cpio&nbsp;<br />　　或cpio -divc file.cpio&nbsp;<br />　　10.以.rpm为扩展名的文件安装:&nbsp;<br />　　#rpm -i file.rpm&nbsp;<br />　　11.以.rpm为扩展名的文件解压缩：&nbsp;<br />　　 #rpm2cpio file.rpm | cpio -div&nbsp;<br />　　12.以.deb为扩展名的文件安装：&nbsp;<br />　　#dpkg -i file.deb&nbsp;<br />　　13.以.deb为扩展名的文件解压缩:&nbsp;<br />　　#dpkg-deb -fsys-tarfile file.deb | tar xvf - ar p&nbsp;<br />　　file.deb data.tar.gz | tar xvzf -&nbsp;<br />　　14.以.zip为扩展名的文件:&nbsp;<br />　　#unzip file.zip&nbsp;<br />　　在linux下解压Winzip格式的文件&nbsp;<br />　　要是装了jdk的话，可以用 jar命令；还可以使用unzip命令。&nbsp;<br />　　直接解压.tar.gz文件&nbsp;<br />　　xxxx.tar.gz文件使用tar带zxvf参数，可以一次解压开。XXXX为文件名。 例如：&nbsp;<br />　　$tar zxvf xxxx.tar.gz 各种压缩文件的解压（安装方法）&nbsp;<br />　　&nbsp;<br />　　文件扩展名 解压（安装方法）&nbsp;<br />　　　&nbsp;<br />　　.a ar xv file.a&nbsp;<br />　　.Z uncompress file.Z&nbsp;<br />　　.gz gunzip file.gz&nbsp;<br />　　.bz2 bunzip2 file.bz2&nbsp;<br />　　.tar.Z tar xvZf file.tar.Z&nbsp;<br />　　compress -dc file.tar.Z | tar xvf -&nbsp;<br />　　.tar.gz/.tgz tar xvzf file.tar.gz&nbsp;<br />　　gzip -dc file.tar.gz | tar xvf -&nbsp;<br />　　.tar.bz2 tar xvIf file.tar.bz2&nbsp;<br />　　bzip2 -dc file.tar.bz2 | xvf -&nbsp;<br />　　.cpio.gz/.cgz gzip -dc file.cgz | cpio -div&nbsp;<br />　　.cpio/cpio cpio -div file.cpio&nbsp;<br />　　cpio -divc file.cpio&nbsp;<br />　　.rpm/install rpm -i file.rpm&nbsp;<br />　　.rpm/extract rpm2cpio file.rpm | cpio -div&nbsp;<br />　　.deb/install dpkg -i file.deb&nbsp;<br />　　.deb/exrtact dpkg-deb -fsys-tarfile file.deb | tar xvf -&nbsp;<br />　　ar p file.deb data.tar.gz | tar xvzf -&nbsp;<br />　　.zip unzip file.zip&nbsp;<br />　　&nbsp;<br />　　&nbsp;<br />　　bzip2 -d myfile.tar.bz2 | tar xvf&nbsp;<br />　　&nbsp;<br />　　&nbsp;<br />　　tar xvfz myfile.tar.bz2&nbsp;<br />　　&nbsp;<br />　　&nbsp;<br />　　x 是解压&nbsp;<br />　　v 是复杂输出&nbsp;<br />　　f 是指定文件&nbsp;<br />　　z gz格式&nbsp;<br />　　&nbsp;<br />　　&nbsp;<br />　　gzip&nbsp;<br />　　gzip[选项]要压缩（或解压缩）的文件名&nbsp;<br />　　-c将输出写到标准输出上，并保留原有文件。&nbsp;<br />　　-d将压缩文件压缩。&nbsp;<br />　　-l对每个压缩文件，显示下列字段：压缩文件的大小，未压缩文件的大小、压缩比、未压缩文件的名字&nbsp;<br />　　-r递归式地查找指定目录并压缩或压缩其中的所有文件。&nbsp;<br />　　-t测试压缩文件是正完整。&nbsp;<br />　　-v对每一个压缩和解压缩的文件，显示其文件名和压缩比。&nbsp;<br />　　-num-用指定的数字调整压缩的速度。&nbsp;<br />　　举例：&nbsp;<br />　　把/usr目录并包括它的子目录在内的全部文件做一备份，备份文件名为usr.tar&nbsp;<br />　　tar cvf usr.tar /home&nbsp;<br />　　把/usr 目录并包括它的子目录在内的全部文件做一备份并进行压缩，备份文件名是usr.tar.gz&nbsp;<br />　　tar czvf usr.tar.gz /usr&nbsp;<br />　　压缩一组文件，文件的后缀为tar.gz&nbsp;<br />　　#tar cvf back.tar /back/&nbsp;<br />　　#gzip -q back.tar&nbsp;<br />　　or&nbsp;<br />　　#tar cvfz back.tar.gz /back/&nbsp;<br />　　释放一个后缀为tar.gz 的文件。&nbsp;<br />　　#tar zxvf back.tar.gz&nbsp;<br />　　#gzip back.tar.gz&nbsp;<br />　　#tar xvf back.tar</span></p></div></div><div style="margin-top: 30px; margin-right: auto; margin-bottom: 0px; margin-left: auto; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; width: 615px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: #d6d6d6; border-right-color: #d6d6d6; border-bottom-color: #d6d6d6; border-left-color: #d6d6d6; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-image: initial; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #e8e8e8; font-family: 宋体, Arial; line-height: normal; ">自：<a href="http://blog.chinaunix.net/space.php?uid=22535114&amp;do=blog&amp;id=1773583">http://blog.chinaunix.net/space.php?uid=22535114&amp;do=blog&amp;id=1773583</a></div><img src ="http://www.cppblog.com/sunrise/aggbug/187392.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/sunrise/" target="_blank">SunRise_at</a> 2012-08-16 17:49 <a href="http://www.cppblog.com/sunrise/archive/2012/08/16/187392.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Configure，Makefile.am, Makefile.in, Makefile文件之间关系</title><link>http://www.cppblog.com/sunrise/archive/2012/06/27/180444.html</link><dc:creator>SunRise_at</dc:creator><author>SunRise_at</author><pubDate>Wed, 27 Jun 2012 02:31:00 GMT</pubDate><guid>http://www.cppblog.com/sunrise/archive/2012/06/27/180444.html</guid><wfw:comment>http://www.cppblog.com/sunrise/comments/180444.html</wfw:comment><comments>http://www.cppblog.com/sunrise/archive/2012/06/27/180444.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cppblog.com/sunrise/comments/commentRss/180444.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/sunrise/services/trackbacks/180444.html</trackback:ping><description><![CDATA[<span style="line-height: 18px; font-family: Arial; background-color: #f5feec; "><div style="word-wrap: break-word; word-break: break-all; visibility: visible !important; zoom: 1 !important; filter: none; font-size: 14px; line-height: 20px; color: #333333; overflow-x: hidden; overflow-y: hidden; position: static; border-image: initial; "><p style="line-height: normal; "><img border="0" src="http://hiphotos.baidu.com/litaosmile/pic/item/55a6d229122935d798250aa4.jpg" small="0" alt="" /></p><p style="line-height: normal; ">1.autoscan (autoconf): 扫描源代码以搜寻普通的可移植性问题，比如检查编译器，库，头文件等，生成文件configure.scan,它是configure.ac的一个雏形。</p><p style="line-height: normal; ">&nbsp;&nbsp;&nbsp; your source files --&gt; [autoscan*] --&gt; [configure.scan] --&gt; configure.ac</p>2.aclocal (automake):根据已经安装的宏，用户定义宏和acinclude.m4文件中的宏将configure.ac文件所需要的宏集中定义到文件 aclocal.m4中。aclocal是一个perl 脚本程序，它的定义是：&#8220;aclocal - create aclocal.m4 by scanning configure.ac&#8221;<pre style="line-height: normal; ">user input files   optional input     process          output files<br />================   ==============     =======          ============<br /><br />                    acinclude.m4 - - - - -.<br />                                          V<br />                                      .-------,<br />configure.ac ------------------------&gt;|aclocal|<br />                 {user macro files} -&gt;|       |------&gt; aclocal.m4<br />                                      `-------'<br />3.autoheader(autoconf): 根据configure.ac中的某些宏，比如cpp宏定义，运行m4，声称config.h.in<br /><br />user input files    optional input     process          output files<br />================    ==============     =======          ============<br /><br />                    aclocal.m4 - - - - - - - .<br />                                             |<br />                                             V<br />                                     .----------,<br />configure.ac -----------------------&gt;|autoheader|----&gt; autoconfig.h.in<br />                                     `----------'</pre><p style="line-height: normal; ">4.automake: automake将Makefile.am中定义的结构建立Makefile.in，然后configure脚本将生成的Makefile.in文件转换 为Makefile。如果在configure.ac中定义了一些特殊的宏，比如AC_PROG_LIBTOOL，它会调用libtoolize，否则它 会自己产生config.guess和config.sub</p><pre style="line-height: normal; ">user input files   optional input   processes          output files<br />================   ==============   =========          ============<br /><br />                                     .--------,<br />                                     |        | - - -&gt; COPYING<br />                                     |        | - - -&gt; INSTALL<br />                                     |        |------&gt; install-sh<br />                                     |        |------&gt; missing<br />                                     |automake|------&gt; mkinstalldirs<br />configure.ac -----------------------&gt;|        |<br />Makefile.am  -----------------------&gt;|        |------&gt; Makefile.in<br />                                     |        |------&gt; stamp-h.in<br />                                 .---+        | - - -&gt; config.guess<br />                                 |   |        | - - -&gt; config.sub<br />                                 |   `------+-'<br />                                 |          | - - - -&gt; config.guess<br />                                 |libtoolize| - - - -&gt; config.sub<br />                                 |          |--------&gt; ltmain.sh<br />                                 |          |--------&gt; ltconfig<br />                                 `----------'</pre><p style="line-height: normal; ">5.autoconf:将configure.ac中的宏展开，生成configure脚本。这个过程可能要用到aclocal.m4中定义的宏。</p><pre style="line-height: normal; ">user input files   optional input   processes          output files<br />================   ==============   =========          ============<br /><br />aclocal.m4 ,autoconfig.h.in - - - - - - -.<br />                                         V<br />                                     .--------,<br />configure.ac -----------------------&gt;|autoconf|------&gt; configure</pre><pre style="line-height: normal; "> </pre><pre style="line-height: normal; ">6. ./configure的过程</pre><pre style="line-height: normal; "><br />                                           .-------------&gt; [config.cache]<br />     configure* --------------------------+-------------&gt; config.log<br />                                          |<br />              [config.h.in] -.            v            .--&gt; [autoconfig.h]<br />                             +-------&gt; config.status* -+                   <br />              Makefile.in ---'                         `--&gt;   Makefile</pre><pre style="line-height: normal; "> </pre><pre style="line-height: normal; ">7. make过程</pre><pre style="line-height: normal; "> </pre><pre style="line-height: normal; ">[autoconfig.h] -.<br />                     +--&gt; make* ---&gt;  程序<br />        Makefile   ---'</pre><pre style="line-height: normal; "> </pre><pre style="line-height: normal; ">.---------,<br />                   config.site - - -&gt;|         |<br />                  config.cache - - -&gt;|<strong><u>configure</u></strong>| - - -&gt; config.cache<br />                                     |         +-,<br />                                     `-+-------' |<br />                                       |         |----&gt; config.status<br />                   config.h.in -------&gt;|config-  |----&gt; config.h<br />                   Makefile.in -------&gt;|  .status|----&gt; Makefile<br />                                       |         |----&gt; stamp-h<br />                                       |         +--,<br />                                     .-+         |  |<br />                                     | `------+--'  |<br />                   ltmain.sh -------&gt;|ltconfig|-------&gt; libtool<br />                                     |        |     |<br />                                     `-+------'     |<br />                                       |config.guess|<br />                                       | config.sub |<br />                                       `------------'<p> </p><pre>.--------,<br />                   Makefile ------&gt;|        |<br />                   config.h ------&gt;|  <strong><u>make</u></strong>  |<br />{project sources} ----------------&gt;|        |--------&gt; {project targets}<br />                                 .-+        +--,<br />                                 | `--------'  |<br />                                 |   libtool   |<br />                                 |   missing   |<br />                                 |  install-sh |<br />                                 |mkinstalldirs|<br />                                 `-------------'</pre> </pre></div></span>实例<span style="font-family: Arial; line-height: 20px; background-color: #f5feec; ">：</span><br style="font-family: Arial; background-color: #f5feec; " /><span style="font-family: Arial; line-height: 20px; background-color: #f5feec; ">在/hello/目录下创建一个hello.c文件，并编译运行它：</span><p style="font-family: Arial; background-color: #f5feec; ">#cd /hello/</p><p style="font-family: Arial; background-color: #f5feec; ">(1) 编写源文件hello.c：</p><p style="font-family: Arial; background-color: #f5feec; ">#include&lt;stdio.h&gt;&nbsp;<br />int main(int argc, char** argv)<br />{<br />printf("Hello, GNU!n");<br />return 0;<br />}</p><p style="font-family: Arial; background-color: #f5feec; ">[litao@vm0000131 hello]$ ll<br />total 4<br />-rw-rw-r-- 1 litao litao 68 Aug 12 12:02 hello.c</p><p style="font-family: Arial; background-color: #f5feec; ">一、autoscan</p><p style="font-family: Arial; background-color: #f5feec; ">[litao@vm0000131 hello]$ autoscan<br />autom4te: configure.ac: no such file or directory<br />autoscan: /usr/bin/autom4te failed with exit status: 1<br />[litao@vm0000131 hello]$ ll<br />total 8<br />-rw-rw-r-- 1 litao litao&nbsp;&nbsp; 0 Aug 12 12:03 autoscan.log<br />-rw-rw-r-- 1 litao litao 457 Aug 12 12:03 configure.scan<br />-rw-rw-r-- 1 litao litao&nbsp; 68 Aug 12 12:02 hello.c</p><p style="font-family: Arial; background-color: #f5feec; ">已经生成了configure.scan，autoscan.log文件</p><p style="font-family: Arial; background-color: #f5feec; ">将configure.scan 修改为&nbsp;configure.in，最后修改的内容如下：</p><p style="font-family: Arial; background-color: #f5feec; ">[litao@vm0000131 hello]$ mv configure.scan configure.in&nbsp;&nbsp;&nbsp;&nbsp;<br />[litao@vm0000131 hello]$ vim configure.in&nbsp;<br /></p><p style="font-family: Arial; background-color: #f5feec; ">#&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; -*- Autoconf -*-<br /># Process this file with autoconf to produce a configure script.<br /><br />AC_PREREQ(2.59)<br />AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS)<br />AC_CONFIG_SRCDIR([hello.c])<br />#AC_CONFIG_HEADER([config.h])<br />AM_INIT_AUTOMAKE(hello, 1.0)<br /># Checks for programs.<br />AC_PROG_CC<br /><br /># Checks for libraries.<br /><br /># Checks for header files.<br /><br /># Checks for typedefs, structures, and compiler characteristics.<br /><br /># Checks for library functions.<br />AC_OUTPUT(Makefile)</p><p style="font-family: Arial; background-color: #f5feec; ">二、acloacl<br /></p><p style="font-family: Arial; background-color: #f5feec; ">[litao@vm0000131 hello]$ aclocal&nbsp;<br /></p><p style="font-family: Arial; background-color: #f5feec; ">生成 aclocal.m4 和 autom4te.cache (生成aclocal.m4的过程中涉及到configure.in)</p><p style="font-family: Arial; background-color: #f5feec; ">[litao@vm0000131 hello]$ ll<br />total 44<br />-rw-rw-r-- 1 litao litao 31120 Aug 12 12:08 aclocal.m4<br />drwxr-xr-x 2 litao litao&nbsp; 4096 Aug 12 12:08 autom4te.cache<br />-rw-rw-r-- 1 litao litao&nbsp;&nbsp;&nbsp;&nbsp; 0 Aug 12 12:03 autoscan.log<br />-rw-rw-r-- 1 litao litao&nbsp;&nbsp; 496 Aug 12 12:08 configure.in<br />-rw-rw-r-- 1 litao litao&nbsp;&nbsp;&nbsp; 68 Aug 12 12:02 hello.c</p><p style="font-family: Arial; background-color: #f5feec; ">三、antoconf<br /></p>[litao@vm0000131 hello]$ autoconf<br />生成&nbsp;configure&nbsp;(根据&nbsp;configure.in, 和 aclocal.m4)<br style="font-family: Arial; background-color: #f5feec; " /><span style="font-family: Arial; line-height: 20px; background-color: #f5feec; ">[litao@vm0000131 hello]$ ll</span><br style="font-family: Arial; background-color: #f5feec; " /><span style="font-family: Arial; line-height: 20px; background-color: #f5feec; ">total 168</span><br style="font-family: Arial; background-color: #f5feec; " /><span style="font-family: Arial; line-height: 20px; background-color: #f5feec; ">-rw-rw-r-- 1 litao litao&nbsp; 31120 Aug 12 12:08 aclocal.m4</span><br style="font-family: Arial; background-color: #f5feec; " /><span style="font-family: Arial; line-height: 20px; background-color: #f5feec; ">drwxr-xr-x 2 litao litao&nbsp;&nbsp; 4096 Aug 12 12:11 autom4te.cache</span><br style="font-family: Arial; background-color: #f5feec; " /><span style="font-family: Arial; line-height: 20px; background-color: #f5feec; ">-rw-rw-r-- 1 litao litao&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0 Aug 12 12:03 autoscan.log</span><br style="font-family: Arial; background-color: #f5feec; " /><span style="font-family: Arial; line-height: 20px; background-color: #f5feec; ">-rwxrwxr-x 1 litao litao 122297 Aug 12 12:11 configure</span><br style="font-family: Arial; background-color: #f5feec; " /><span style="font-family: Arial; line-height: 20px; background-color: #f5feec; ">-rw-rw-r-- 1 litao litao&nbsp;&nbsp;&nbsp; 496 Aug 12 12:08 configure.in</span><br style="font-family: Arial; background-color: #f5feec; " /><span style="font-family: Arial; line-height: 20px; background-color: #f5feec; ">-rw-rw-r-- 1 litao litao&nbsp;&nbsp;&nbsp;&nbsp; 68 Aug 12 12:02 hello.c</span><br style="font-family: Arial; background-color: #f5feec; " /><br style="font-family: Arial; background-color: #f5feec; " /><span style="font-family: Arial; line-height: 20px; background-color: #f5feec; ">四、编写Makefile.am：</span><p style="font-family: Arial; background-color: #f5feec; ">AUTOMAKE_OPTIONS= foreign<br />bin_PROGRAMS= hello<br />hello_SOURCES= hello.c</p><span style="font-family: Arial; line-height: 20px; background-color: #f5feec; ">五、automake</span><p style="font-family: Arial; background-color: #f5feec; ">生成 Makefile.in， depcomp， install-sh， 和 missing (根据 Makefile.am, 和 aclocal.m4)</p><p style="font-family: Arial; background-color: #f5feec; ">[litao@vm0000131 hello]$ automake<br />configure.in: required file `./install-sh' not found<br />configure.in: required file `./missing' not found<br />Makefile.am: required file `./depcomp' not found<br />[litao@vm0000131 hello]$ automake --add-missing<br />configure.in: installing `./install-sh'<br />configure.in: installing `./missing'<br />Makefile.am: installing `./depcomp'<br />[litao@vm0000131 hello]$ ll<br />total 192<br />-rw-rw-r-- 1 litao litao&nbsp; 31120 Aug 12 12:08 aclocal.m4<br />drwxr-xr-x 2 litao litao&nbsp;&nbsp; 4096 Aug 12 12:14 autom4te.cache<br />-rw-rw-r-- 1 litao litao&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0 Aug 12 12:03 autoscan.log<br />-rwxrwxr-x 1 litao litao 122297 Aug 12 12:11 configure<br />-rw-rw-r-- 1 litao litao&nbsp;&nbsp;&nbsp; 496 Aug 12 12:08 configure.in<br />lrwxrwxrwx 1 litao litao&nbsp;&nbsp;&nbsp;&nbsp; 31 Aug 12 12:16 depcomp -&gt; /usr/share/automake-1.9/depcomp<br />-rw-rw-r-- 1 litao litao&nbsp;&nbsp;&nbsp;&nbsp; 68 Aug 12 12:02 hello.c<br />lrwxrwxrwx 1 litao litao&nbsp;&nbsp;&nbsp;&nbsp; 34 Aug 12 12:16 install-sh -&gt; /usr/share/automake-1.9/install-sh<br />-rw-rw-r-- 1 litao litao&nbsp;&nbsp;&nbsp;&nbsp; 69 Aug 12 12:15 Makefile.am<br />-rw-rw-r-- 1 litao litao&nbsp; 16561 Aug 12 12:16 Makefile.in<br />lrwxrwxrwx 1 litao litao&nbsp;&nbsp;&nbsp;&nbsp; 31 Aug 12 12:16 missing -&gt; /usr/share/automake-1.9/missing</p><p style="font-family: Arial; background-color: #f5feec; ">六、configure<br />生成 Makefile， config.log， 和 config.status<br />转自：<a href="http://hi.baidu.com/litaosmile/blog/item/0c5562139fe5ced9f6039ee3.html">http://hi.baidu.com/litaosmile/blog/item/0c5562139fe5ced9f6039ee3.html</a><br /><br /><br /><br /><br /></p><img src ="http://www.cppblog.com/sunrise/aggbug/180444.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/sunrise/" target="_blank">SunRise_at</a> 2012-06-27 10:31 <a href="http://www.cppblog.com/sunrise/archive/2012/06/27/180444.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Makefile自动生成</title><link>http://www.cppblog.com/sunrise/archive/2012/06/27/180440.html</link><dc:creator>SunRise_at</dc:creator><author>SunRise_at</author><pubDate>Wed, 27 Jun 2012 02:13:00 GMT</pubDate><guid>http://www.cppblog.com/sunrise/archive/2012/06/27/180440.html</guid><wfw:comment>http://www.cppblog.com/sunrise/comments/180440.html</wfw:comment><comments>http://www.cppblog.com/sunrise/archive/2012/06/27/180440.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cppblog.com/sunrise/comments/commentRss/180440.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/sunrise/services/trackbacks/180440.html</trackback:ping><description><![CDATA[虽然很简单还是弄了一个小时才搞定，成就感啊。。<br />转自：<a href="http://blog.csdn.net/dybinx/article/details/6764874">http://blog.csdn.net/dybinx/article/details/6764874</a><br /><p clearfix="" nbw-act=""  fc06"="" style="color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; zoom: 1; margin-top: 0px; margin-bottom: 20px; padding-top: 0px; padding-bottom: 0px; "><span style="font-family: Arial, Helvetica, simsun, u5b8bu4f53; line-height: 22px; ">编写 make 规则:&nbsp;<br />使用 gcc 的时候，用 -M 开关，它会为每一个你给它的Ｃ文件输出一个规则，把目标文件 做为目的，而这个Ｃ文件和所有应该被 #include 的 header 文 件将做为依靠文件。注意这个规则会加入所有 header 文件，包 括被角括号(`&lt;', `&gt;')和双引号(`"')所包围的文件。其实系统 header 档（比如 stdio.h, stdlib.h 等等一般不会被我们更改，如果用 -MM 来代替 -M 传递给 gcc，那些用角括号包围的 header 档将不会被包括。<br />$@ 扩展成当前规则的目的文件名， $&lt; 扩展成依靠列表中的第 一个依靠文件，而 $^ 扩展成整个依靠的列表。<br /><br />自动生成Makefile文件的操作：<br /></span></p><p align="center" style="color: #333333; font-family: Arial; background-color: #ffffff; line-height: 22px; margin-top: 0px; margin-bottom: 10px; padding-top: 0px; padding-bottom: 0px; "><span style="line-height: 19px; font-size: 9pt; font-family: 'Times New Roman'; color: #666666; "><img src="http://www.ccw.com.cn/htm/app/linux/develop/01_7_214.gif" width="466" height="315" alt="" style="border-width: initial; border-color: initial; border-image: initial; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; max-width: 100%; " /></span></p><br style="color: #333333; font-family: Arial; text-align: left; background-color: #ffffff; line-height: 22px; " /><span style="color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; ">1、首先，新建一个测试项目的目录&#8212;&#8212;hello：mkdir hello<br style="line-height: 22px; " />然后，cd hello；编辑一个hello.c的代码文件：<br style="line-height: 22px; " />#include &lt;stdio.h&gt;<br style="line-height: 22px; " />int main()<br style="line-height: 22px; " />{<br style="line-height: 22px; " />&nbsp;&nbsp;&nbsp;&nbsp; printf("hello automake!\n");<br style="line-height: 22px; " />}<br style="line-height: 22px; " />保存退出；<br style="line-height: 22px; " /><br style="line-height: 22px; " />2、执行<span style="line-height: 22px; color: #ff0000; ">autoscan</span>命令，在当前路径中生成了autoscan.log&nbsp; configure.scan两个新文件。其中configure.scan文件的内容如下：<br style="line-height: 22px; " />AC_PREREQ(2.57)<br style="line-height: 22px; " />AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS)<br style="line-height: 22px; " />AC_CONFIG_SRCDIR([test.c])<br style="line-height: 22px; " />AC_CONFIG_HEADER([config.h])<br style="line-height: 22px; " />AC_PROG_CC<br style="line-height: 22px; " />AC_OUTPUT<br style="line-height: 22px; " /><br style="line-height: 22px; " />3、重命名configure.scan&nbsp; 为configure.in，编辑它的内容，修改后的内容为：<br style="line-height: 22px; " />AC_PREREQ(2.57)<br style="line-height: 22px; " /><span style="line-height: 22px; color: #ff0000; ">AC_INIT(hello)</span><br style="line-height: 22px; color: #ff0000; " /><span style="line-height: 22px; color: #ff0000; ">AC_CONFIG_SRCDIR([hello.c])</span><br style="line-height: 22px; color: #ff0000; " /><span style="line-height: 22px; color: #ff0000; ">#AC_CONFIG_HEADER([config.h])</span><br style="line-height: 22px; color: #ff0000; " /><span style="line-height: 22px; color: #ff0000; ">AM_INIT_AUTOMAKE(hello, 1.0)</span><br style="line-height: 22px; color: #ff0000; " /><span style="line-height: 22px; color: #ff0000; ">AC_PROG_CC</span><br style="line-height: 22px; color: #ff0000; " /><span style="line-height: 22px; color: #ff0000; ">AC_OUTPUT([Makefile])</span><br style="line-height: 22px; " /><br style="line-height: 22px; " />说明：Autoconf 是用来产生 'configure'文件的工具。'configure' 是一个 shell script，它可以自动设定符合各种不同平台上Unix 系统的特性，并且根据系统参数及环境产生合适的Makefile文件或C 的头文件(header file)，让原始程式可以很方便地在不同的平台上进行编译。Autoconf会读取 configure.in 文件然后产生'configure' 这个 shell script。configure.in 文件内容是一系列GNU m4 的宏，这些宏经autoconf处理后会变成检查系统特性的shell scripts。 configure.in 内宏的顺序并没有特别的规定，但是每一个configure.in 文件必須在所有宏前加入 AC_INIT 宏，然后在所有宏的最后加上 AC_OUTPUT宏。可先用 autoscan 扫描原始文件以产生一个 configure.scan 文件，再对 configure.scan 做些修改成 configure.in 文件。<br style="line-height: 22px; " />AC_INIT(FILE)&nbsp;<br style="line-height: 22px; " />该宏用来检查源代码所在路径，autoscan 会自动产生，一般无须修改它。<br style="line-height: 22px; " />AM_INIT_AUTOMAKE(PACKAGE,VERSION)&nbsp;<br style="line-height: 22px; " />这个是使用 Automake 所必备的宏，PACKAGE 是所要产生软件套件的名称，VERSION 是版本编号。&nbsp;<br style="line-height: 22px; " />AC_PROG_CC&nbsp;<br style="line-height: 22px; " />检查系统可用的C编译器，若源代码是用C写的就需要这个宏。<br style="line-height: 22px; " />AC_OUTPUT(FILE)&nbsp;<br style="line-height: 22px; " />设置 configure 所要产生的文件，若是Makefile ，configure 便会把它检查出来的结果带入 Makefile.in 文件后产生合适的 Makefile。&nbsp;<br style="line-height: 22px; " /><br style="line-height: 22px; " />4、执行<span style="line-height: 22px; color: #ff0000; ">aclocal</span>命令，生成了aclocal.m4文件，一般无需修改这个文件。<br style="line-height: 22px; " />5、新建<span style="line-height: 22px; color: #ff0000; ">Makefile.am</span>文件，编辑内容如下：<br style="line-height: 22px; " />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: 22px; color: #ff0000; ">bin_PROGRAMS=test &nbsp;&nbsp;</span><br style="line-height: 22px; color: #ff0000; " /><span style="line-height: 22px; color: #ff0000; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; test_SOURCES=test.c</span><br style="line-height: 22px; " />说明：<br style="line-height: 22px; " />Automake 会根据 configure.in 中的宏把Makefile.am 转成 Makefile.in 文件。 Makefile.am 文件定义所要产生的目标：&nbsp;<br style="line-height: 22px; " />AUTOMAKE_OPTIONS<br style="line-height: 22px; " />设置 automake 的选项。Automake 主要是帮助开发 GNU 软件的人员来维护软件，所以在执行 automake 时，会检查目录下是否存在标准 GNU 软件中应具备的文件，例如 'NEWS'、'AUTHOR'、'ChangeLog' 等文件。设置 foreign 时，automake 会改用一般软件的标准来检查。&nbsp;<br style="line-height: 22px; " />bin_PROGRAMS&nbsp;<br style="line-height: 22px; " />定义要产生的执行文件名。如果要产生多个执行文件，每个文件名用空白符隔开<br style="line-height: 22px; " />hello_SOURCES&nbsp;<br style="line-height: 22px; " />定义 'hello' 这个执行程序所需要的原始文件。如果 'hello'这个程序是由多个原始文件所产生，必須把它所用到的所有原始文件都列出来，以空白符隔开。假设 'hello' 还需要 'hello.c'、'main.c'、'hello.h' 三个文件的话，则定义&nbsp;<br style="line-height: 22px; " />hello_SOURCES= hello.c main.c hello.h&nbsp;<br style="line-height: 22px; " />如果定义多个执行文件，则对每个执行程序都要定义相对的filename_SOURCES<br style="line-height: 22px; " /><br style="line-height: 22px; " />6、 执行<span style="line-height: 22px; color: #ff0000; ">autoconf</span>命令，生成autom4te.cache和configure文件；<br style="line-height: 22px; " />7、执行<span style="line-height: 22px; color: #ff0000; ">automake -a</span>命令，生成depcomp&nbsp; ，install-sh，mkinstalldirs，COPYING，INSTALL， missing文件；<br style="line-height: 22px; " />说明：<br style="line-height: 22px; " />编辑好 Makefile.am 文件，就可以用 automake --add-missing来产生 Makefile.in。加上 --add-missing 选项来告诉 automake顺便假如包装一个软件所必须的文件。Automake产生生出來的 Makefile.in 文件是完全符合 GNU Makefile 的惯例，只要执行 configure这个shell script 便可以产生合适的 Makefile 文件了。&nbsp;<br style="line-height: 22px; " />在执行automake -a命令时可能会出现以下信息：<br style="line-height: 22px; " />Makefile.am: required file `./NEWS' not found<br style="line-height: 22px; " />Makefile.am: required file `./README' not found<br style="line-height: 22px; " />Makefile.am: required file `./AUTHORS' not found<br style="line-height: 22px; " />Makefile.am: required file `./ChangeLog' not found<br style="line-height: 22px; " />这些对结果影响不大，如果不想产生这些让人误解的信息，可以手动建立这些文件：<br style="line-height: 22px; " />&gt;NEWS &nbsp;&nbsp;<br style="line-height: 22px; " />&gt;README &nbsp;&nbsp;<br style="line-height: 22px; " />&gt;AUTHORS &nbsp;&nbsp;<br style="line-height: 22px; " />&gt;ChangeLog &nbsp;&nbsp;<br style="line-height: 22px; " /><br style="line-height: 22px; " />8、执行<span style="line-height: 22px; color: #ff0000; ">./configure</span>，生成了Makefile文件<br style="line-height: 22px; " />9、执行make，生成目标文件。<br style="line-height: 22px; " /><br style="line-height: 22px; " /></span><p style="color: #333333; font-family: Arial; text-align: left; background-color: #ffffff; line-height: 22px; margin-top: 0px; margin-bottom: 10px; padding-top: 0px; padding-bottom: 0px; "><a style="color: #8a703e; ">实战Makefile.am</a></p><p style="color: #333333; font-family: Arial; text-align: left; background-color: #ffffff; line-height: 22px; margin-top: 0px; margin-bottom: 10px; padding-top: 0px; padding-bottom: 0px; ">Makefile.am是一种比Makefile更高层次的规则。只需指定要生成什么目标，它由什么源文件生成，要安装到什么目录等构成。</p><p style="color: #333333; font-family: Arial; text-align: left; background-color: #ffffff; line-height: 22px; margin-top: 0px; margin-bottom: 10px; padding-top: 0px; padding-bottom: 0px; ">表一列出了可执行文件、静态库、头文件和数据文件，四种书写Makefile.am文件个一般格式。</p><span style="color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; "><br style="line-height: 22px; " /><a style="color: #8a703e; line-height: 22px; ">表 1Makefile.am一般格式</a><br style="line-height: 22px; " /><img alt="表 1Makefile.am一般格式" src="http://www.ibm.com/developerworks/cn/linux/l-makefile/images/table2.gif" width="522" border="0" height="351" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; line-height: 22px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; max-width: 100%; " />&nbsp;<br style="line-height: 22px; " /></span><p style="color: #333333; font-family: Arial; text-align: left; background-color: #ffffff; line-height: 22px; margin-top: 0px; margin-bottom: 10px; padding-top: 0px; padding-bottom: 0px; ">对于可执行文件和静态库类型，如果只想编译，不想安装到系统中，可以用noinst_PROGRAMS代替bin_PROGRAMS，noinst_LIBRARIES代替lib_LIBRARIES。</p><p style="color: #333333; font-family: Arial; text-align: left; background-color: #ffffff; line-height: 22px; margin-top: 0px; margin-bottom: 10px; padding-top: 0px; padding-bottom: 0px; ">Makefile.am还提供了一些全局变量供所有的目标体使用：</p><span style="color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; "><br style="line-height: 22px; " /><a style="color: #8a703e; line-height: 22px; ">表 2 Makefile.am中可用的全局变量</a><br style="line-height: 22px; " /><img alt="表 2 Makefile.am中可用的全局变量" src="http://www.ibm.com/developerworks/cn/linux/l-makefile/images/table3.gif" width="523" border="0" height="221" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; line-height: 22px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; max-width: 100%; " />&nbsp;<br style="line-height: 22px; " /></span><p style="color: #333333; font-family: Arial; text-align: left; background-color: #ffffff; line-height: 22px; margin-top: 0px; margin-bottom: 10px; padding-top: 0px; padding-bottom: 0px; ">在Makefile.am中尽量使用相对路径，系统预定义了两个基本路径：</p><span style="color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; "><br style="line-height: 22px; " /><a style="color: #8a703e; line-height: 22px; ">表 3Makefile.am中可用的路径变量</a><br style="line-height: 22px; " /><img alt="表 3Makefile.am中可用的路径变量" src="http://www.ibm.com/developerworks/cn/linux/l-makefile/images/table4.gif" width="522" border="0" height="112" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; line-height: 22px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; max-width: 100%; " />&nbsp;<br style="line-height: 22px; " /></span><p style="color: #333333; font-family: Arial; text-align: left; background-color: #ffffff; line-height: 22px; margin-top: 0px; margin-bottom: 10px; padding-top: 0px; padding-bottom: 0px; ">在上文中我们提到过安装路径，automake设置了默认的安装路径：</p><p style="color: #333333; font-family: Arial; text-align: left; background-color: #ffffff; line-height: 22px; margin-top: 0px; margin-bottom: 10px; padding-top: 0px; padding-bottom: 0px; ">1) 标准安装路径</p><p style="color: #333333; font-family: Arial; text-align: left; background-color: #ffffff; line-height: 22px; margin-top: 0px; margin-bottom: 10px; padding-top: 0px; padding-bottom: 0px; ">默认安装路径为：$(prefix) = /usr/local，可以通过./configure --prefix=&lt;new_path&gt;的方法来覆盖。</p><p style="color: #333333; font-family: Arial; text-align: left; background-color: #ffffff; line-height: 22px; margin-top: 0px; margin-bottom: 10px; padding-top: 0px; padding-bottom: 0px; ">其它的预定义目录还包括：bindir = $(prefix)/bin, libdir = $(prefix)/lib, datadir = $(prefix)/share, sysconfdir = $(prefix)/etc等等。</p><p style="color: #333333; font-family: Arial; text-align: left; background-color: #ffffff; line-height: 22px; margin-top: 0px; margin-bottom: 10px; padding-top: 0px; padding-bottom: 0px; ">2) 定义一个新的安装路径</p><p style="color: #333333; font-family: Arial; text-align: left; background-color: #ffffff; line-height: 22px; margin-top: 0px; margin-bottom: 10px; padding-top: 0px; padding-bottom: 0px; ">比如test, 可定义testdir = $(prefix)/test, 然后test_DATA =test1 test2，则test1，test2会作为数据文件安装到$(prefix)/ /test目录下。</p><p style="color: #333333; font-family: Arial; text-align: left; background-color: #ffffff; line-height: 22px; margin-top: 0px; margin-bottom: 10px; padding-top: 0px; padding-bottom: 0px; ">我们首先需要在工程顶层目录下（即project/）创建一个Makefile.am来指明包含的子目录：</p><span style="color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; "><br style="line-height: 22px; " /></span><table width="100%" border="0" cellpadding="0" cellspacing="0" style="color: #333333; font-family: Arial; font-size: 18px; text-align: left; background-color: #ffffff; line-height: 22px; "><tbody><tr><td><pre style="white-space: pre-wrap; word-wrap: break-word; "><span style="font-size: 18px; ">SUBDIRS=src/lib src/ModuleA/apple/shell src/ModuleA/apple/core <br />CURRENTPATH=$(shell /bin/pwd)<br />INCLUDES=-I$(CURRENTPATH)/src/include -I$(CURRENTPATH)/src/ModuleA/apple/include <br />export INCLUDES<br /></span></pre></td></tr></tbody></table><span style="color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; "><br style="line-height: 22px; " /></span><p style="color: #333333; font-family: Arial; text-align: left; background-color: #ffffff; line-height: 22px; margin-top: 0px; margin-bottom: 10px; padding-top: 0px; padding-bottom: 0px; ">由于每个源文件都会用到相同的头文件，所以我们在最顶层的Makefile.am中包含了编译源文件时所用到的头文件，并导出，见蓝色部分代码。</p><p style="color: #333333; font-family: Arial; text-align: left; background-color: #ffffff; line-height: 22px; margin-top: 0px; margin-bottom: 10px; padding-top: 0px; padding-bottom: 0px; ">我们将lib目录下的swap.c文件编译成libswap.a文件，被apple/shell/apple.c文件调用，那么lib目录下的Makefile.am如下所示：</p><span style="color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; "><br style="line-height: 22px; " /></span><table width="100%" border="0" cellpadding="0" cellspacing="0" style="color: #333333; font-family: Arial; font-size: 18px; text-align: left; background-color: #ffffff; line-height: 22px; "><tbody><tr><td><pre style="white-space: pre-wrap; word-wrap: break-word; "><span style="font-size: 18px; ">noinst_LIBRARIES=libswap.a<br />libswap_a_SOURCES=swap.c<br />INCLUDES=-I$(top_srcdir)/src/includ<br /></span></pre></td></tr></tbody></table><span style="color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; "><br style="line-height: 22px; " /></span><p style="color: #333333; font-family: Arial; text-align: left; background-color: #ffffff; line-height: 22px; margin-top: 0px; margin-bottom: 10px; padding-top: 0px; padding-bottom: 0px; ">细心的读者可能就会问：怎么表1中给出的是bin_LIBRARIES，而这里是noinst_LIBRARIES？这是因为如果只想编译，而不想 安装到系统中，就用noinst_LIBRARIES代替bin_LIBRARIES，对于可执行文件就用noinst_PROGRAMS代替 bin_PROGRAMS。对于安装的情况，库将会安装到$(prefix)/lib目录下，可执行文件将会安装到${prefix}/bin。如果想安 装该库，则Makefile.am示例如下：</p><span style="color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; "><br style="line-height: 22px; " /></span><table width="100%" border="0" cellpadding="0" cellspacing="0" style="color: #333333; font-family: Arial; font-size: 18px; text-align: left; background-color: #ffffff; line-height: 22px; "><tbody><tr><td><pre style="white-space: pre-wrap; word-wrap: break-word; "><span style="font-size: 18px; ">bin_LIBRARIES=libswap.a<br />libswap_a_SOURCES=swap.c<br />INCLUDES=-I$(top_srcdir)/src/include<br />swapincludedir=$(includedir)/swap<br />swapinclude_HEADERS=$(top_srcdir)/src/include/swap.h<br /></span></pre></td></tr></tbody></table><span style="color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; "><br style="line-height: 22px; " /></span><p style="color: #333333; font-family: Arial; text-align: left; background-color: #ffffff; line-height: 22px; margin-top: 0px; margin-bottom: 10px; padding-top: 0px; padding-bottom: 0px; ">最后两行的意思是将swap.h安装到${prefix}/include /swap目录下。</p><p style="color: #333333; font-family: Arial; text-align: left; background-color: #ffffff; line-height: 22px; margin-top: 0px; margin-bottom: 10px; padding-top: 0px; padding-bottom: 0px; ">接下来，对于可执行文件类型的情况，我们将讨论如何写Makefile.am？对于编译apple/core目录下的文件，我们写成的Makefile.am如下所示：</p><span style="color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; "><br style="line-height: 22px; " /></span><table width="100%" border="0" cellpadding="0" cellspacing="0" style="color: #333333; font-family: Arial; font-size: 18px; text-align: left; background-color: #ffffff; line-height: 22px; "><tbody><tr><td><pre style="white-space: pre-wrap; word-wrap: break-word; "><span style="font-size: 18px; ">noinst_PROGRAMS=test<br />test_SOURCES=test.c <br />test_LDADD=$(top_srcdir)/src/ModuleA/apple/shell/apple.o $(top_srcdir)/src/lib/libswap.a <br />test_LDFLAGS=-D_GNU_SOURCE<br />DEFS+=-D_GNU_SOURCE<br />#LIBS=-lpthread<br /></span></pre></td></tr></tbody></table><span style="color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; "><br style="line-height: 22px; " /></span><p style="color: #333333; font-family: Arial; text-align: left; background-color: #ffffff; line-height: 22px; margin-top: 0px; margin-bottom: 10px; padding-top: 0px; padding-bottom: 0px; ">由于我们的test.c文件在链接时，需要apple.o和 libswap.a文件，所以我们需要在test_LDADD中包含这两个文件。对于Linux下的信号量/读写锁文件进行编译，需要在编译选项中指明 -D_GNU_SOURCE。所以在test_LDFLAGS中指明。而test_LDFLAGS只是链接时的选项，编译时同样需要指明该选项，所以需要 DEFS来指明编译选项，由于DEFS已经有初始值，所以这里用+=的形式指明。从这里可以看出，Makefile.am中的语法与Makefile的语 法一致，也可以采用条件表达式。如果你的程序还包含其他的库，除了用AC_CHECK_LIB宏来指明外，还可以用LIBS来指明。</p><p style="color: #333333; font-family: Arial; text-align: left; background-color: #ffffff; line-height: 22px; margin-top: 0px; margin-bottom: 10px; padding-top: 0px; padding-bottom: 0px; ">如果你只想编译某一个文件，那么Makefile.am如何写呢？这个文件也很简单，写法跟可执行文件的差不多，如下例所示：</p><table width="100%" border="0" cellpadding="0" cellspacing="0" style="color: #333333; font-family: Arial; font-size: 18px; text-align: left; background-color: #ffffff; line-height: 22px; "><tbody><tr><td><pre style="white-space: pre-wrap; word-wrap: break-word; "><span style="font-size: 18px; ">noinst_PROGRAMS=apple<br />apple_SOURCES=apple.c<br />DEFS+=-D_GNU_SOURCE</span></pre></td></tr></tbody></table><img src ="http://www.cppblog.com/sunrise/aggbug/180440.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/sunrise/" target="_blank">SunRise_at</a> 2012-06-27 10:13 <a href="http://www.cppblog.com/sunrise/archive/2012/06/27/180440.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Linux下源码安装的经验总结</title><link>http://www.cppblog.com/sunrise/archive/2012/06/05/177614.html</link><dc:creator>SunRise_at</dc:creator><author>SunRise_at</author><pubDate>Tue, 05 Jun 2012 01:36:00 GMT</pubDate><guid>http://www.cppblog.com/sunrise/archive/2012/06/05/177614.html</guid><wfw:comment>http://www.cppblog.com/sunrise/comments/177614.html</wfw:comment><comments>http://www.cppblog.com/sunrise/archive/2012/06/05/177614.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/sunrise/comments/commentRss/177614.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/sunrise/services/trackbacks/177614.html</trackback:ping><description><![CDATA[转自：<a href="http://www.linuxidc.com/Linux/2011-07/39217.htm">http://www.linuxidc.com/Linux/2011-07/39217.htm<br /><br /></a><span style="background-color: #efefef; color: #333333; ">&nbsp; &nbsp; &nbsp;</span><span style="background-color: #efefef; color: #333333; font-family: 宋体, Arial; line-height: 24px; ">在linux下安装软件，难免会碰到需要源码安装的，而就是这简简单单的./configure、make、sudo make install三步，却让不少人头疼不已，这里以安装X11为例具体介绍下我在安装时的一点小经验，以便共同学习，共同进步！</span><p style="color: #333333; font-family: 宋体, Arial; line-height: 24px; background-color: #efefef; ">首先，我们要做些准备工作，源码安装少不了这几个工具pkg-config、libtool、autoconf和automake(当然，还有更基础的，像zlib、m4等，这里就略过啦)，其中，pkg-config是相对比较重要的，它就是向configure程序提供系统信息的程序，如软件的版本、库的版本以及库的路径等信息，这些只是在编译期间使用。你可以打开/usr/lib/pkgconfig下任意一个.pc文件，就会发现类似下面的信息(X11的pc文件)：</p><table border="0" width="97%" align="center" style="table-layout: fixed; position: relative; color: #333333; font-family: 宋体, Arial; font-size: 18px; line-height: 24px; background-color: #efefef; "><tbody><tr><td colspan="3" style="font-size: 12px; "><div align="center" style="font-size: 12px; "></div></td></tr></tbody></table><p style="color: #333333; font-family: 宋体, Arial; line-height: 24px; background-color: #efefef; "></p><p style="color: #333333; font-family: 宋体, Arial; line-height: 24px; background-color: #efefef; ">prefix=/usr<br />exec_prefix=${prefix}<br />libdir=${exec_prefix}/lib<br />includedir=${prefix}/include<br />xthreadlib=-lpthread<br />Name: X11<br />Description: X Library<br />Version: 1.3.3<br />Requires: xproto kbproto<br />Requires.private: xcb &gt;= 1.1.92<br />Cflags: -I${includedir}<br />Libs: -L${libdir} -lX11<br />Libs.private: -lpthread</p><p style="color: #333333; font-family: 宋体, Arial; line-height: 24px; background-color: #efefef; ">configure就是靠着这些信息来判断软件版本是否符合要求的。接着来看看pkg-config是怎样工作的，缺省情况下，pkg-config首先在usr/lib/pkgconfig/中查找相关包(譬如x11)对应的相应的文件(x11.pc)，若没有找到，它也会到PKG_CONFIG_PATH这个环境变量所指定的路径下去找，若是还没有找到，它就会报错。所以这里就可以得到一些解决configure时提示**库未找到的办法了，先用命令"ldconfig -p | grep 库名"来分析该库是否安装及其路径，若返回空，则说明该库确实未安装，否则，可以根据该命令的返回结果找到库的安装地点，然后设置其环境变量，命令如下：</p><p style="color: #333333; font-family: 宋体, Arial; line-height: 24px; background-color: #efefef; ">"export PKG_CONFIG_PATH=软件位置/lib/pkgconfig:$PKG_CONFIG_PATH"，这里有个常识，软件安装后，.pc文件都是在安装目录下的lib/pkgconf中的。这样只会在当前命令窗口有效，当然，你也可以修改home文件夹下的.bashrc文件(带.的文件为隐藏文件，可以用命令vi .bashrc编辑)，在文件末尾加上上面那句命令，重新登录即可。其他的几个在linux下也是不可或缺的，libtool为管理library时使用，没装的话错误提示如下：possibly undefined macro:AC_PROG_LIBTOOL。而autoconf和automake可以用于在某些没有configure的文件的源码包安装时使用(pixman就是个典型的例子，安装了二者后直接./autogen.sh就可以安装了)。</p><p style="color: #333333; font-family: 宋体, Arial; line-height: 24px; background-color: #efefef; ">准备工作做好后，就可以安装了，具体全部命令如下：</p><p style="color: #333333; font-family: 宋体, Arial; line-height: 24px; background-color: #efefef; ">tar vxf libX11-6.2.1.tar.gz</p><p style="color: #333333; font-family: 宋体, Arial; line-height: 24px; background-color: #efefef; ">cd libX11-6.2.1</p><p style="color: #333333; font-family: 宋体, Arial; line-height: 24px; background-color: #efefef; ">mkdir X11-build</p><p style="color: #333333; font-family: 宋体, Arial; line-height: 24px; background-color: #efefef; ">cd X11-build</p><p style="color: #333333; font-family: 宋体, Arial; line-height: 24px; background-color: #efefef; ">../configure &#8211;prefix=/usr/local/X11R6</p><p style="color: #333333; font-family: 宋体, Arial; line-height: 24px; background-color: #efefef; ">make</p><p style="color: #333333; font-family: 宋体, Arial; line-height: 24px; background-color: #efefef; ">echo $?</p><p style="color: #333333; font-family: 宋体, Arial; line-height: 24px; background-color: #efefef; ">sudo make install</p><p style="color: #333333; font-family: 宋体, Arial; line-height: 24px; background-color: #efefef; ">这里有一些好的安装习惯可以积累一下：1、建立一个临时编译目录，本例中为X11-build，这样可以再安装完成后删除该目录，进而可以节省空间，而且保持了源码目录的整洁；2、安装到指定目录，本例中为/usr/local/X11R6，最好把几个相关的安装在同一文件夹下，如这里的X11R6文件夹，这样便于管理，否则全部默认安装在/usr/local下，很杂乱；3、编译完成后做检查，本例为echo $?，表示检查上一条命令的退出状态，程序正常退出返回0，错误退出返回非0，也可以使用make check，主要为了防止make失败后直接install，进而出现了一些莫名其妙的错误。这里还介绍一种更方便快捷的安装方法，用&amp;&amp;将安装命令连接起来，如../configure &#8211;prefix=**&amp;&amp;make&amp;&amp;sudo make install，这样，只有在前面的命令执行正确的情况下，后面的任务才会执行，多方便！</p><p style="color: #333333; font-family: 宋体, Arial; line-height: 24px; background-color: #efefef; ">除此之外，安装之前可以阅读下源码包中的readme和install等文档，往往有所需软件及其下载地址，还包括一些安装技巧和配置选项。另外，在configure前，先输入configure &#8211;help，可以查看有哪些选项可以添加。还有几个关系安装成功的东西就是ldconfig了，在安装时如果提示找不到某个库或者在编译时提示找不到**.so文件，就要用到它了，最简单的解决办法就是sudo gedit /etc/ld.so.conf，在文件中加入**.so文件所在路径，再运行一下ldconfig就可以了，但是我对这个东西有阴影，不知道是因为用了虚拟机还是其他的原因，有7、8次我在运行完ldconfig后，<a href="http://www.linuxidc.com/topicnews.aspx?tid=2" title="Ubuntu" style="color: blue; ">Ubuntu</a>就没办法打开任何窗口了，直接关机重启就更是进不去系统了，崩溃之，不知道有没有高手有解决办法。在这里提供一种代替ldconfig的办法，就是export LD_LIBRARY_PATH=*.so文件地址:$LD_LIBRARY_PATH，用它我就舒心多了，也就是麻烦点，哥忍了，总比系统崩溃强多了吧，呵呵！其实，在configure时碰到问题，你应该庆幸，因为你可以根据它很明显的提示找到缺失的东西装上，在配置下pkgconfig和ldconfig基本上就可以搞定了，但是make的时候就没那么简单了。</p><p style="color: #333333; font-family: 宋体, Arial; line-height: 24px; background-color: #efefef; ">编译时提示最多的就是**东西未找到了，要么是库文件，要么是头文件，库文件用上面的ldconfig基本上就可以搞定，头文件的话需要配置包含的路径，和库的类似，命令如下：</p><p style="color: #333333; font-family: 宋体, Arial; line-height: 24px; background-color: #efefef; ">export LD_INCLUDE_PATH=/usr/local/include:$LD_INCLUDE_PATH</p><p style="color: #333333; font-family: 宋体, Arial; line-height: 24px; background-color: #efefef; ">在这个时候最重要的就是淡定了，循着丫的error往上找，像"No such file or directory"这样的错误提示肯定就在附近，找到了，include之就可以咯！</p><img src ="http://www.cppblog.com/sunrise/aggbug/177614.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/sunrise/" target="_blank">SunRise_at</a> 2012-06-05 09:36 <a href="http://www.cppblog.com/sunrise/archive/2012/06/05/177614.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Linux学习篇-SVN命令详解 </title><link>http://www.cppblog.com/sunrise/archive/2012/05/29/176616.html</link><dc:creator>SunRise_at</dc:creator><author>SunRise_at</author><pubDate>Tue, 29 May 2012 06:23:00 GMT</pubDate><guid>http://www.cppblog.com/sunrise/archive/2012/05/29/176616.html</guid><wfw:comment>http://www.cppblog.com/sunrise/comments/176616.html</wfw:comment><comments>http://www.cppblog.com/sunrise/archive/2012/05/29/176616.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/sunrise/comments/commentRss/176616.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/sunrise/services/trackbacks/176616.html</trackback:ping><description><![CDATA[<span style="text-align: left; widows: 2; text-transform: none; background-color: #f5f9f8; text-indent: 0px; letter-spacing: normal; font: 14px/21px simsun; white-space: normal; orphans: 2; color: #494949; word-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class="Apple-style-span">转自：<font color="#000000" face="Verdana">http://blog.sina.com.cn/s/blog_76cd6de80100wml3.html<br /></font>文章中讲的不是很详细，做了部分修改<br />在开发中，除了在本机文件夹上进行svn更新外，在命令行中进行svn操作也非常关键，下面列举下网站摘抄的一些文档：<br /><strong style="font-weight: bold">1、</strong>将文件checkout到本地目录<br />
<div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 676px; padding-right: 5px; font-size: 13px; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px"><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal"><strong style="font-weight: bold">svn checkout</strong><span class="Apple-converted-space">&nbsp;</span>path（path是服务器上的目录）<br />例如：svn checkout svn:</span><span style="line-height: 19px; word-wrap: normal; color: #808080; word-break: normal">//</span><span style="line-height: 19px; word-wrap: normal; color: #800000; word-break: normal; font-weight: bold">192.168</span><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal">.</span><span style="line-height: 19px; word-wrap: normal; color: #800000; word-break: normal; font-weight: bold">1.1</span><span style="line-height: 19px; word-wrap: normal; color: #808080; word-break: normal">/</span><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal">pro</span><span style="line-height: 19px; word-wrap: normal; color: #808080; word-break: normal">/</span><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal">domain --usrname yu --password yu<br />简写：svn co</span></div><strong style="font-weight: bold"><br />2、</strong>往版本库中添加新的文件<br />
<div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 676px; padding-right: 5px; font-size: 13px; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px"><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal"><strong style="font-weight: bold">svn</strong></span><span class="Apple-converted-space">&nbsp;</span><span style="line-height: 19px; word-wrap: normal; color: #0000ff; word-break: normal"><strong style="font-weight: bold">add</strong></span><span class="Apple-converted-space">&nbsp;</span><span style="line-height: 19px; word-wrap: normal; color: #0000ff; word-break: normal">file</span><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal"><br />例如：svn</span><span class="Apple-converted-space">&nbsp;</span><span style="line-height: 19px; word-wrap: normal; color: #0000ff; word-break: normal">add</span><span class="Apple-converted-space">&nbsp;</span><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal">test.php(添加test.php)<br />svn</span><span class="Apple-converted-space">&nbsp;</span><span style="line-height: 19px; word-wrap: normal; color: #0000ff; word-break: normal">add</span><span class="Apple-converted-space">&nbsp;</span><span style="line-height: 19px; word-wrap: normal; color: #808080; word-break: normal">*</span><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal">.php(添加当前目录下所有的php文件)</span></div><br /><strong style="font-weight: bold">3、</strong>将改动的文件提交到版本库<br />
<div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 676px; padding-right: 5px; font-size: 13px; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px">
<p style="padding-bottom: 0px; line-height: 19px; border-right-width: 0px; list-style-type: none; margin: 0px 0px 5px; padding-left: 0px; padding-right: 0px; word-wrap: normal; border-top-width: 0px; border-bottom-width: 0px; word-break: normal; border-left-width: 0px; padding-top: 0px"><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal"><strong style="font-weight: bold">svn commit</strong><span class="Apple-converted-space">&nbsp;</span>-m</span><span class="Apple-converted-space">&nbsp;</span><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal">&#8220;</span><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal">LogMessage</span><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal">&#8220;</span><span class="Apple-converted-space">&nbsp;</span><span style="line-height: 19px; word-wrap: normal; color: #800000; word-break: normal; font-weight: bold">[</span><span style="line-height: 19px; word-wrap: normal; color: #800000; word-break: normal">-N</span><span style="line-height: 19px; word-wrap: normal; color: #800000; word-break: normal; font-weight: bold">]</span><span class="Apple-converted-space">&nbsp;</span><span style="line-height: 19px; word-wrap: normal; color: #800000; word-break: normal; font-weight: bold">[</span><span style="line-height: 19px; word-wrap: normal; color: #800000; word-break: normal">--no-unlock</span><span style="line-height: 19px; word-wrap: normal; color: #800000; word-break: normal; font-weight: bold">]</span><span class="Apple-converted-space">&nbsp;</span><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal">PATH<img style="padding-bottom: 0px; border-right-width: 0px; list-style-type: none; margin: 0px; padding-left: 0px; padding-right: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Linux学习篇-SVN命令详解" alt="" src="http://www.blogjava.net/Images/dot.gif" real_src="http://www.blogjava.net/Images/dot.gif" />(如果选择了保持锁，就使用&#8211;no-unlock开关)<br />例如：svn commit -m</span><span class="Apple-converted-space">&nbsp;</span><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal">&#8220;</span><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal">add test file for my test</span><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal">&#8220;</span><span class="Apple-converted-space">&nbsp;</span><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal">test.php<br />简写：svn ci</span></p></div><br /><strong style="font-weight: bold">4、</strong>加锁/解锁<br />
<div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 676px; padding-right: 5px; font-size: 13px; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px"><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal"><strong style="font-weight: bold">svn lock</strong><span class="Apple-converted-space">&nbsp;</span>-m</span><span class="Apple-converted-space">&nbsp;</span><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal">&#8220;</span><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal">LockMessage</span><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal">&#8220;</span><span class="Apple-converted-space">&nbsp;</span><span style="line-height: 19px; word-wrap: normal; color: #800000; word-break: normal; font-weight: bold">[</span><span style="line-height: 19px; word-wrap: normal; color: #800000; word-break: normal">--force</span><span style="line-height: 19px; word-wrap: normal; color: #800000; word-break: normal; font-weight: bold">]</span><span class="Apple-converted-space">&nbsp;</span><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal">PATH<img style="padding-bottom: 0px; border-right-width: 0px; list-style-type: none; margin: 0px; padding-left: 0px; padding-right: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Linux学习篇-SVN命令详解" alt="" src="http://www.blogjava.net/Images/dot.gif" real_src="http://www.blogjava.net/Images/dot.gif" /><br />例如：svn lock -m</span><span class="Apple-converted-space">&nbsp;</span><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal">&#8220;</span><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal">lock test file</span><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal">&#8220;</span><span class="Apple-converted-space">&nbsp;</span><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal">test.php<br /><strong style="font-weight: bold">svn unlock</strong><span class="Apple-converted-space">&nbsp;</span>PATH</span></div><br /><strong style="font-weight: bold">5、</strong>更新到某个版本<br />
<div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 676px; padding-right: 5px; font-size: 13px; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px"><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal"><strong style="font-weight: bold">svn update -r</strong><span class="Apple-converted-space">&nbsp;</span>m path<br />例如：<br />svn update如果后面没有目录，默认将当前目录以及子目录下的所有文件都更新到最新版本。<br />svn update -r</span><span class="Apple-converted-space">&nbsp;</span><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal">200</span><span class="Apple-converted-space">&nbsp;</span><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal">test.php(将版本库中的文件test.php还原到版本200)<br />svn update test.php(更新，于版本库同步。如果在提交的时候提示过期的话，是因为<strong style="font-weight: bold">冲突，需要先update，修改文件</strong>，然后清除<strong style="font-weight: bold">svn resolved</strong>，最后再提交commit)<br />简写：svn up</span></div><br /><strong style="font-weight: bold">6、</strong>查看文件或者目录状态<br />
<div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 676px; padding-right: 5px; font-size: 13px; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px"><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal"><strong style="font-weight: bold">svn status</strong><span class="Apple-converted-space">&nbsp;</span>path...（目录下的文件和子目录的状态，正常状态不显示）<br />【?：不在svn的控制中；M：内容被修改；C：发生冲突；A：预定加入到版本库；K：被锁定】<br /></span><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal">2</span><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal">）<strong style="font-weight: bold">svn status -v</strong><span class="Apple-converted-space">&nbsp;</span>path<img style="padding-bottom: 0px; border-right-width: 0px; list-style-type: none; margin: 0px; padding-left: 0px; padding-right: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Linux学习篇-SVN命令详解" alt="" src="http://www.blogjava.net/Images/dot.gif" real_src="http://www.blogjava.net/Images/dot.gif" />(显示文件和子目录状态)<br />第一列保持相同，第二列显示工作版本号，第三和第四列显示最后一次修改的版本号和修改人。<br />注：svn status、svn diff和 svn revert这三条命令在没有网络的情况下也可以执行的，原因是svn在本地的.svn中保留了本地版本的原始拷贝。<br />简写：svn st</span></div><br /><strong style="font-weight: bold">7、</strong>删除文件<br />
<div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 676px; padding-right: 5px; font-size: 13px; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px"><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal"><strong style="font-weight: bold">svn delete</strong><span class="Apple-converted-space">&nbsp;</span>path -m</span><span class="Apple-converted-space">&nbsp;</span><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal">&#8220;</span><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal">delete test fle</span><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal">&#8220;</span><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal"><br />例如：svn delete svn://</span><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal">192.168.1.1</span><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal">/pro/domain/test.php -m</span><span class="Apple-converted-space">&nbsp;</span><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal">&#8220;</span><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal">delete test file</span><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal">&#8221;<br />或者直接svn delete test.php 然后再svn ci -m &#8216;delete test file&#8216;，推荐使用这种<br />简写：svn (del, remove, rm)</span></div><br /><strong style="font-weight: bold">8、</strong>移动文件或者目录或文件更名<br />
<div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 676px; padding-right: 5px; font-size: 13px; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px"><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal"><strong style="font-weight: bold">svn move</strong><span class="Apple-converted-space">&nbsp;</span>-m</span><span class="Apple-converted-space">&nbsp;</span><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal">&#8220;move</span><span class="Apple-converted-space">&nbsp;</span><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal">test fle</span><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal">&#8220;</span><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal"><br />例如：svn move</span><span class="Apple-converted-space">&nbsp;</span><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal">-m</span><span class="Apple-converted-space">&nbsp;</span><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal">&#8220;move</span><span class="Apple-converted-space">&nbsp;</span><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal">test file</span><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal">&#8221; a.php&nbsp;<wbr><span class="Apple-converted-space">&nbsp;</span>b.php 把当前目录下的a.php改名为b.php<br /></span><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal">svn move</span><span class="Apple-converted-space">&nbsp;</span><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal">-m</span><span class="Apple-converted-space">&nbsp;</span><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal">&#8220;move</span><span class="Apple-converted-space">&nbsp;</span><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal">test file</span><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal">&#8221; address admin/address 把当前目录下得address目录移动到当前目录下的admin/address</span>下<br /><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal">或者直接svn delete test.php 然后再svn ci -m &#8216;delete test file&#8216;，推荐使用这种<br />简写：svn (del, remove, rm)</span></div><br /><br /><strong style="font-weight: bold">9、</strong>查看日志<br />
<div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 676px; padding-right: 5px; font-size: 13px; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px"><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal"><strong style="font-weight: bold">svn log</strong><span class="Apple-converted-space">&nbsp;</span>path<br />例如：svn log test.php 显示这个文件的所有修改记录，及其版本号的变化</span></div><br /><strong style="font-weight: bold">10、</strong>查看文件详细信息<br />
<div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 676px; padding-right: 5px; font-size: 13px; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px"><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal"><strong style="font-weight: bold">svn info</strong><span class="Apple-converted-space">&nbsp;</span>path<br />例如：svn info test.php</span></div><br /><strong style="font-weight: bold">11、</strong>比较差异<br />
<div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 676px; padding-right: 5px; font-size: 13px; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px"><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal"><strong style="font-weight: bold">svn diff</strong><span class="Apple-converted-space">&nbsp;</span>path(将修改的文件与基础版本比较)<br />例如：svn diff test.php<br /><strong style="font-weight: bold">svn diff</strong><span class="Apple-converted-space">&nbsp;</span>-r m:n path(对版本m和版本n比较差异)<br />例如：svn diff -r 200:201 test.php<br />简写：svn di</span></div><br /><br /><strong style="font-weight: bold">12、</strong>将两个版本之间的差异合并到当前文件<br />
<div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 676px; padding-right: 5px; font-size: 13px; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px"><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal"><strong style="font-weight: bold">svn merge -r</strong><span class="Apple-converted-space">&nbsp;</span>m:n path<br />例如：svn merge -r</span><span class="Apple-converted-space">&nbsp;</span><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal">200</span><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal">:</span><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal">205</span><span class="Apple-converted-space">&nbsp;</span><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal">test.php（将版本200与205之间的差异合并到当前文件，但是一般都会产生冲突，需要处理一下）</span></div><br /><strong style="font-weight: bold">13、</strong>SVN 帮助<br />
<div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 676px; padding-right: 5px; font-size: 13px; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px"><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal"><strong style="font-weight: bold">svn help<br />svn help ci</strong></span></div><br /><br />
<p style="padding-bottom: 0px; line-height: 21px; border-right-width: 0px; list-style-type: none; margin: 0px 0px 5px; padding-left: 0px; padding-right: 0px; word-wrap: normal; border-top-width: 0px; border-bottom-width: 0px; word-break: normal; border-left-width: 0px; padding-top: 0px">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p style="padding-bottom: 0px; line-height: 21px; border-right-width: 0px; list-style-type: none; margin: 0px 0px 5px; padding-left: 0px; padding-right: 0px; word-wrap: normal; border-top-width: 0px; border-bottom-width: 0px; word-break: normal; border-left-width: 0px; padding-top: 0px">以上是常用命令，下面写几个不经常用的</p>
<p style="padding-bottom: 0px; line-height: 21px; border-right-width: 0px; list-style-type: none; margin: 0px 0px 5px; padding-left: 0px; padding-right: 0px; word-wrap: normal; border-top-width: 0px; border-bottom-width: 0px; word-break: normal; border-left-width: 0px; padding-top: 0px">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p style="padding-bottom: 0px; line-height: 21px; border-right-width: 0px; list-style-type: none; margin: 0px 0px 5px; padding-left: 0px; padding-right: 0px; word-wrap: normal; border-top-width: 0px; border-bottom-width: 0px; word-break: normal; border-left-width: 0px; padding-top: 0px"><strong style="font-weight: bold">14、</strong>版本库下的文件和目录列表</p>
<div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 676px; padding-right: 5px; font-size: 13px; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px"><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal"><strong style="font-weight: bold">svn list</strong><span class="Apple-converted-space">&nbsp;</span>path<br />显示path目录下的所有属于版本库的文件和目录<br />简写：svn ls</span></div>
<p style="padding-bottom: 0px; line-height: 21px; border-right-width: 0px; list-style-type: none; margin: 0px 0px 5px; padding-left: 0px; padding-right: 0px; word-wrap: normal; border-top-width: 0px; border-bottom-width: 0px; word-break: normal; border-left-width: 0px; padding-top: 0px"><strong style="font-weight: bold">15、</strong>创建纳入版本控制下的新目录</p>
<div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 676px; padding-right: 5px; font-size: 13px; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px"><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal"><strong style="font-weight: bold">svn mkdir</strong>: 创建纳入版本控制下的新目录。<br />用法: 1、mkdir PATH&#8230;<br />2、mkdir URL&#8230;<br />创建版本控制的目录。<br />1、每一个以工作副本 PATH 指定的目录，都会创建在本地端，并且加入新增<br />调度，以待下一次的提交。<br />2、每个以URL指定的目录，都会透过立即提交于仓库中创建。<br />在这两个情况下，所有的中间目录都必须事先存在。<br />如：svn mkdir https://192.168.1.13/svn/apps/ontology -m "mkdir ontology"</span></div>
<p style="padding-bottom: 0px; line-height: 21px; border-right-width: 0px; list-style-type: none; margin: 0px 0px 5px; padding-left: 0px; padding-right: 0px; word-wrap: normal; border-top-width: 0px; border-bottom-width: 0px; word-break: normal; border-left-width: 0px; padding-top: 0px"><strong style="font-weight: bold">16、</strong>恢复本地修改</p>
<div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 676px; padding-right: 5px; font-size: 13px; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px"><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal"><strong style="font-weight: bold">svn revert</strong>: 恢复原始未改变的工作副本文件 (恢复大部份的本地修改)。revert:<br />用法: revert PATH&#8230;<br />注意: 本子命令不会存取网络，并且会解除冲突的状况。但是它不会恢复<br />被删除的目录</span></div>
<p style="padding-bottom: 0px; line-height: 21px; border-right-width: 0px; list-style-type: none; margin: 0px 0px 5px; padding-left: 0px; padding-right: 0px; word-wrap: normal; border-top-width: 0px; border-bottom-width: 0px; word-break: normal; border-left-width: 0px; padding-top: 0px"><strong style="font-weight: bold">17、</strong>代码库URL变更</p>
<div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 676px; padding-right: 5px; font-size: 13px; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px"><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal"><strong style="font-weight: bold">svn switch (sw):</strong><span class="Apple-converted-space">&nbsp;</span>更新工作副本至不同的URL。<br />用法: 1、switch URL [PATH]<br />2、switch &#8211;relocate FROM TO [PATH...]</span> 
<p style="padding-bottom: 0px; line-height: 19px; border-right-width: 0px; list-style-type: none; margin: 0px 0px 5px; padding-left: 0px; padding-right: 0px; word-wrap: normal; border-top-width: 0px; border-bottom-width: 0px; word-break: normal; border-left-width: 0px; padding-top: 0px"><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal">1、更新你的工作副本，映射到一个新的URL，其行为跟&#8220;svn update&#8221;很像，也会将<br />服务器上文件与本地文件合并。这是将工作副本对应到同一仓库中某个分支或者标记的<br />方法。<br />2、改写工作副本的URL元数据，以反映单纯的URL上的改变。当仓库的根URL变动<br />(比如方案名或是主机名称变动)，但是工作副本仍旧对映到同一仓库的同一目录时使用<br />这个命令更新工作副本与仓库的对应关系。</span></p></div>
<p style="padding-bottom: 0px; line-height: 21px; border-right-width: 0px; list-style-type: none; margin: 0px 0px 5px; padding-left: 0px; padding-right: 0px; word-wrap: normal; border-top-width: 0px; border-bottom-width: 0px; word-break: normal; border-left-width: 0px; padding-top: 0px"><strong style="font-weight: bold">18、</strong>解决冲突</p>
<div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 676px; padding-right: 5px; font-size: 13px; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px"><span style="line-height: 19px; word-wrap: normal; color: #000000; word-break: normal"><strong style="font-weight: bold">svn resolved:</strong><span class="Apple-converted-space">&nbsp;</span>移除工作副本的目录或文件的&#8220;冲突&#8221;状态。<br />用法: resolved PATH&#8230;<br />注意: 本子命令不会依语法来解决冲突或是移除冲突标记；它只是移除冲突的<br />相关文件，然后让 PATH 可以再次提交。</span></div>
<p style="padding-bottom: 0px; line-height: 21px; border-right-width: 0px; list-style-type: none; margin: 0px 0px 5px; padding-left: 0px; padding-right: 0px; word-wrap: normal; border-top-width: 0px; border-bottom-width: 0px; word-break: normal; border-left-width: 0px; padding-top: 0px"><strong style="font-weight: bold">19、</strong>输出指定文件或URL的内容。</p><span style="line-height: 21px; word-wrap: normal; color: #000000; word-break: normal"><strong style="font-weight: bold">svn</strong><span class="Apple-converted-space">&nbsp;</span><strong style="font-weight: bold">cat</strong><span class="Apple-converted-space">&nbsp;</span>目标[@版本]&#8230;如果指定了版本，将从指定的版本开始查找。<br />svn cat -r PREV filename &gt; filename (PREV 是上一版本,也可以写具体版本号,这样输出结果是可以提交的)</span><br /></span><img src ="http://www.cppblog.com/sunrise/aggbug/176616.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/sunrise/" target="_blank">SunRise_at</a> 2012-05-29 14:23 <a href="http://www.cppblog.com/sunrise/archive/2012/05/29/176616.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>linux下.run文件的安装与卸载</title><link>http://www.cppblog.com/sunrise/archive/2012/05/04/173646.html</link><dc:creator>SunRise_at</dc:creator><author>SunRise_at</author><pubDate>Fri, 04 May 2012 03:07:00 GMT</pubDate><guid>http://www.cppblog.com/sunrise/archive/2012/05/04/173646.html</guid><wfw:comment>http://www.cppblog.com/sunrise/comments/173646.html</wfw:comment><comments>http://www.cppblog.com/sunrise/archive/2012/05/04/173646.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/sunrise/comments/commentRss/173646.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/sunrise/services/trackbacks/173646.html</trackback:ping><description><![CDATA[<span style="color: #323e32; font-family: simsun; text-align: left; background-color: #9caec1; ">.run文件的安装很简单，只需要为该文件增加可执行属性，即可执行安装</span><br style="color: #323e32; font-family: simsun; text-align: left; background-color: #9caec1; " /><span style="color: #323e32; font-family: simsun; text-align: left; background-color: #9caec1; ">以 virtualbox 的安装文件 virtualbox-3.1.6-59338-Linux_x86.run为例，只需要输入命令：</span><br style="color: #323e32; font-family: simsun; text-align: left; background-color: #9caec1; " /><span style="color: #323e32; font-family: simsun; text-align: left; background-color: #9caec1; ">chmod +x&nbsp;</span><wbr style="color: #323e32; font-family: simsun; text-align: left; background-color: #9caec1; "><span style="color: #323e32; font-family: simsun; text-align: left; background-color: #9caec1; ">&nbsp;virtualBox-3.1.6-59338-Linux_x86.run</span><br style="color: #323e32; font-family: simsun; text-align: left; background-color: #9caec1; " /><span style="color: #323e32; font-family: simsun; text-align: left; background-color: #9caec1; ">./virtualbox-3.1.6-59338-Linux_x86.run</span><br style="color: #323e32; font-family: simsun; text-align: left; background-color: #9caec1; " /><span style="color: #323e32; font-family: simsun; text-align: left; background-color: #9caec1; ">即可安装。</span><br style="color: #323e32; font-family: simsun; text-align: left; background-color: #9caec1; " /><br style="color: #323e32; font-family: simsun; text-align: left; background-color: #9caec1; " /><span style="color: #323e32; font-family: simsun; text-align: left; background-color: #9caec1; ">卸载的方法网上说法大至分两种：</span><br style="color: #323e32; font-family: simsun; text-align: left; background-color: #9caec1; " /><span style="color: #323e32; font-family: simsun; text-align: left; background-color: #9caec1; ">一种是说用 sh&nbsp;</span><wbr style="color: #323e32; font-family: simsun; text-align: left; background-color: #9caec1; "><span style="color: #323e32; font-family: simsun; text-align: left; background-color: #9caec1; ">&nbsp;virtualbox-3.1.6-59338-Linux_x86.run --uninstall，但是对于我这个virtualbox安装文件行不通</span><br style="color: #323e32; font-family: simsun; text-align: left; background-color: #9caec1; " /><span style="color: #323e32; font-family: simsun; text-align: left; background-color: #9caec1; ">另一种是说进入到安装目录下，有个 uninstall 文件，输入./uninstall即可卸载，但不知道安装到哪了</span><br style="color: #323e32; font-family: simsun; text-align: left; background-color: #9caec1; " /><span style="color: #323e32; font-family: simsun; text-align: left; background-color: #9caec1; ">于是我就用locate virtualbox | grep uninstall 找到这个文件，执行./uninstall就ok了</span><br style="color: #323e32; font-family: simsun; text-align: left; background-color: #9caec1; " /><img src ="http://www.cppblog.com/sunrise/aggbug/173646.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/sunrise/" target="_blank">SunRise_at</a> 2012-05-04 11:07 <a href="http://www.cppblog.com/sunrise/archive/2012/05/04/173646.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>