﻿<?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>BlogJava-道常无名-随笔分类-UNIX/Linux</title><link>http://www.blogjava.net/linuxmouse/category/52985.html</link><description>玄之又玄，众眇之门</description><language>zh-cn</language><lastBuildDate>Tue, 18 Mar 2014 21:04:20 GMT</lastBuildDate><pubDate>Tue, 18 Mar 2014 21:04:20 GMT</pubDate><ttl>60</ttl><item><title>原有python2.4的LINUX上安装python2.7</title><link>http://www.blogjava.net/linuxmouse/archive/2014/03/18/411175.html</link><dc:creator>Linuxmouse</dc:creator><author>Linuxmouse</author><pubDate>Tue, 18 Mar 2014 08:29:00 GMT</pubDate><guid>http://www.blogjava.net/linuxmouse/archive/2014/03/18/411175.html</guid><wfw:comment>http://www.blogjava.net/linuxmouse/comments/411175.html</wfw:comment><comments>http://www.blogjava.net/linuxmouse/archive/2014/03/18/411175.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/linuxmouse/comments/commentRss/411175.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/linuxmouse/services/trackbacks/411175.html</trackback:ping><description><![CDATA[<div><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />-->wget&nbsp;http://python.org/ftp/python/2.7.6/Python-2.7.6.tar.xz<br /><br />xz&nbsp;-d&nbsp;Python-2.7.6.tar<br /><br />tar&nbsp;zxvf&nbsp;Python-2.7.6.tar<br /><br />cd&nbsp;Python-2.7.6<br /><br />./configure&nbsp;--with-threads&nbsp;--enable-shared<br /><br />make<br /><br />make&nbsp;install<br /><br />mv&nbsp;/usr/bin/python&nbsp;/usr/bin/python_bak<br /><br />ln&nbsp;-s&nbsp;/usr/local/bin/python&nbsp;/usr/bin/python<br /><br />echo&nbsp;<span style="color: #800000; ">"</span><span style="color: #800000; ">/usr/local/lib</span><span style="color: #800000; ">"</span>&nbsp;&gt;&gt;/etc/ld.so.conf<br />&nbsp;<br />ldconfig<br /><br />python</div></div><img src ="http://www.blogjava.net/linuxmouse/aggbug/411175.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/linuxmouse/" target="_blank">Linuxmouse</a> 2014-03-18 16:29 <a href="http://www.blogjava.net/linuxmouse/archive/2014/03/18/411175.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>crontab命令详解 --LINUX自动执行任务</title><link>http://www.blogjava.net/linuxmouse/archive/2012/11/07/390990.html</link><dc:creator>Linuxmouse</dc:creator><author>Linuxmouse</author><pubDate>Wed, 07 Nov 2012 14:00:00 GMT</pubDate><guid>http://www.blogjava.net/linuxmouse/archive/2012/11/07/390990.html</guid><wfw:comment>http://www.blogjava.net/linuxmouse/comments/390990.html</wfw:comment><comments>http://www.blogjava.net/linuxmouse/archive/2012/11/07/390990.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/linuxmouse/comments/commentRss/390990.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/linuxmouse/services/trackbacks/390990.html</trackback:ping><description><![CDATA[在linux平台上如果需要实现任务调度功能可以编写cron脚本来实现。  <div><strong>以某一频率执行任务</strong></div> <div>linux缺省会启动crond进程，crond进程不需要用户启动、关闭。 <br />crond进程负责读取调度任务并执行，用户只需要将相应的调度脚本写入cron的调度配置文件中。 <br />cron的调度文件有以下几个： </div> <ol><li>crontab  </li><li>cron.d  </li><li>cron.daily  </li><li>cron.hourly  </li><li>cron.monthly  </li><li>cron.weekly </li></ol>  <div>如果用的任务不是以hourly monthly weekly方式执行，则可以将相应的crontab写入到crontab 或cron.d目录中。 </div> <div>示例： <br />每隔一分钟执行一次脚本 /opt/bin/test-cron.sh <br />可以在cron.d新建脚本 echo-date.sh <br />内容为 </div> <div>*/1 * * * * root&nbsp; /opt/bin/test-cron.sh </div> <div><strong>在指定的时间运行任务</strong></div> <div>也可以通过at命令来控制在指定的时间运行任务 </div> <div>如： </div> <div>at -f test-cron.sh -v 10:25 <br />其中-f 指定脚本文件， -v 指定运行时间</div>quote:ea946d690b="lophyxp"]首先用<br />contab -l &amp;gt;contabs.tmp<br />导出contab的配置。<br />然后编辑contabs.tmp文件。以一下格式添加一行：<br />分钟 小时 天 月 星期 命令<br />比如<br />10 3 * * 0,6 hello<br />就是每周六、周日的3点10分执行hello程序。<br />15 4 * * 4-6 hello<br />就是从周四到周六的4点15点执行hello程序。<br />然后用<br />contab contabs.tmp<br />命令导入新的配置。<br />一般不建议直接修改/etc/下的相关配置文件。  <div>启动cron进程的方法<strong>：/etc/init.d/crond start</strong> <br /><strong>开机就启动cron进程的设置命令：chkconfig --add crond</strong></div> <div><strong>方法二：</strong></div> <div><strong>把cron加入到启动脚本中：</strong></div> <div><strong># rc-update add vixie-cron default</strong></div> <div><strong>crontab -l #查看你的任务</strong></div> <div><strong>crontab-e#编辑你的任务</strong></div> <div><strong>crontab-r#删除用户的crontab的内容</strong></div> <div><strong>实例讲解二：</strong></div> <div><strong>系统cron设定：/etc/crontab</strong> <br />&nbsp;&nbsp;&nbsp; 通过 /etc/crontab 文件，可以设定系统定期执行的任务，当然，要想编辑这个文件，得有root权限 </div> <div>0 7&nbsp;&nbsp; *&nbsp;&nbsp;&nbsp; *&nbsp;&nbsp; *&nbsp;&nbsp;&nbsp; root&nbsp;&nbsp;&nbsp; mpg123 ~/wakeup.mp3 <br />分 时 日 月 周 </div> <div>示例： </div> <div>0 4&nbsp; * * 0&nbsp;&nbsp;&nbsp;&nbsp; <strong>root</strong> <strong>emerge </strong>--sync &amp;&amp; emerge -uD world&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #每周日凌晨4点，更新系统 <br />0 2 1 * *&nbsp;&nbsp;&nbsp;&nbsp; root&nbsp;&nbsp; <strong>rm</strong> -f /tmp/*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #每月1号凌晨2点，清理/tmp下的文件 <br />0 8 6 5 *&nbsp;&nbsp; root&nbsp;&nbsp;&nbsp;&nbsp; <strong>mail</strong>&nbsp; robin &lt; /home/galeki/happy.txt&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #每年5月6日给robin发信祝他生日快乐 </div> <div>假如，我想每隔2分钟就要执行某个命令，或者我想在每天的6点、12点、18点执行命令，诸如此类的周期，可以通过 &#8220; / &#8221; 和 &#8220; , &#8221; 来设置： </div> <div>*/2&nbsp;&nbsp; *&nbsp;&nbsp; *&nbsp;&nbsp; *&nbsp;&nbsp; *&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; root&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...............&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #每两分钟就执行........ <br />0 6,12,18&nbsp;&nbsp; *&nbsp;&nbsp; *&nbsp;&nbsp; *&nbsp;&nbsp;&nbsp; root&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...............&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #每天6点、12点、18点执行........ </div> <div>每两个小时 </div> <div>0 */2 * * * <strong>echo</strong> "have a break now." &gt;&amp;gt; /tmp/test.txt </div> <div>晚上11点到早上8点之间每两个小时，早上八点 </div> <div>0 23-7/2，8 * * * echo "have a good dream：）" &amp;gt;&amp;gt; /tmp/test.txt </div> <div>每个月的4号与每个礼拜的礼拜一到礼拜三的早上11点 </div> <div>0 11 4 * 1-3 command line </div> <div>1月1日早上4点 </div> <div>0 4 1 1 * command line </div> <div><strong>收获</strong>：可以把经常要做的一些事放到其中，简化工作量，如每周一检查服务器的运行状态，查看报告，杀掉一些进程等等&#8230;&#8230;<br /><br /><br />================================================<br />===================================================<br /><br /> crontab命令的功能是在一定的时间间隔调度一些命令的执行。在/etc目录下有一个crontab文件，这里存放有系统运行的一些调度程序。每个用户可以建立自己的调度crontab。 <br /> <br />crontab命令有三种形式的命令行结构： <br /> <br />crontab&nbsp;[-u&nbsp;user]&nbsp;[file] <br /> <br />crontab&nbsp;[-u&nbsp;user]&nbsp;[-e|-l|-r] <br /> <br />crontab&nbsp;-l&nbsp;-u&nbsp;[-e|-l|-r]&nbsp;第一个命令行中，file是命令文件的名字。如果在命令行中指定了这个文件，那么执行 crontab命令，则将这个文件拷贝到crontabs目录下；如果在命令行中没有制定这个文件，crontab命令将接受标准输入（键盘）上键入的命 令，并将他们也存放在crontab目录下。 <br /> <br />命令行中-r选项的作用是从/usr/spool/cron/crontabs目录下删除用户定义的文件crontab； <br /> <br />命令行中-l选项的作用是显示用户crontab文件的内容。 <br /> <br />使用命令crontab&nbsp;-u&nbsp;user&nbsp;-e命令编辑用户user的cron(c)作业。用户通过编辑文件来增加或修改任何作业请求。 <br /> <br />执行命令crontab&nbsp;-u&nbsp;user&nbsp;-r即可删除当前用户的所有的cron作业。 <br /> <br />作业与它们预定的时间储存在文件/usr/spool/cron/crontabs/username里。username使用户名，在相应的文 件中存放着该用户所要运行的命令。命令执行的结果，无论是标准输出还是错误输出，都将以邮件形式发给用户。文件里的每一个请求必须包含以spaces和 tabs分割的六个域。前五个字段可以取整数值，指定何时开始工作，第六个域是字符串，称为命令字段，其中包括了crontab调度执行的命令。 <br /> <br />第一道第五个字段的整数取值范围及意义是： <br /> <br />0～59&nbsp;表示分 <br /> <br />1～23&nbsp;表示小时 <br /> <br />1～31&nbsp;表示日 <br /> <br />1～12&nbsp;表示月份 <br /> <br />0～6&nbsp;表示星期（其中0表示星期日） <br /> <br />/usr/lib/cron/cron.allow表示谁能使用crontab命令。如果它是一个空文件表明没有一个用户能安排作业。如果这个文 件不存在，而有另外一个文件/usr/lib/cron/cron.deny,则只有不包括在这个文件中的用户才可以使用crontab命令。如果它是一 个空文件表明任何用户都可安排作业。两个文件同时存在时cron.allow优先，如果都不存在，只有超级用户可以安排作业。</div><img src ="http://www.blogjava.net/linuxmouse/aggbug/390990.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/linuxmouse/" target="_blank">Linuxmouse</a> 2012-11-07 22:00 <a href="http://www.blogjava.net/linuxmouse/archive/2012/11/07/390990.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>linux man 手册用法</title><link>http://www.blogjava.net/linuxmouse/archive/2012/11/07/390988.html</link><dc:creator>Linuxmouse</dc:creator><author>Linuxmouse</author><pubDate>Wed, 07 Nov 2012 13:48:00 GMT</pubDate><guid>http://www.blogjava.net/linuxmouse/archive/2012/11/07/390988.html</guid><wfw:comment>http://www.blogjava.net/linuxmouse/comments/390988.html</wfw:comment><comments>http://www.blogjava.net/linuxmouse/archive/2012/11/07/390988.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/linuxmouse/comments/commentRss/390988.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/linuxmouse/services/trackbacks/390988.html</trackback:ping><description><![CDATA[Linux的man很强大，该手册分成很多section，使用man时可以指定不同的section来浏览，各个section意义如下： <br />
1 - commands<br />
2 - system calls<br />
3 - library calls<br />
4 - special files<br />
5 - file formats and convertions<br />
6 - games for linux<br />
7 - macro packages and conventions<br />
8 - system management commands<br />
9 - 其他<br />
解释一下, <br />
1是普通的命令<br />
2是系统调用,如open,write之类的(通过这个，至少可以很方便的查到调用这个函数，需要加什么头文件)<br />
3是库函数,如printf,fread<br />
4是特殊文件,也就是/dev下的各种设备文件<br />
5是指文件的格式,比如passwd, 就会说明这个文件中各个字段的含义<br />
6是给游戏留的,由各个游戏自己定义<br />
7是附件还有一些变量,比如向environ这种全局变量在这里就有说明<br />
8是系统管理用的命令,这些命令只能由root使用,如ifconfig<br />
想要指定section就直接在man的后面加上数字,比如 :<br />
man 1 ls<br />
man 3 printf<br />
等等<br />
对于像open,kill这种既有命令,又有系统调用的来说,man open则显示的是open(1),也就是从最前面的section开始,如果想查看open系统调用的话,就得man 2 open<img src ="http://www.blogjava.net/linuxmouse/aggbug/390988.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/linuxmouse/" target="_blank">Linuxmouse</a> 2012-11-07 21:48 <a href="http://www.blogjava.net/linuxmouse/archive/2012/11/07/390988.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>FreeBSD 自动启动程序</title><link>http://www.blogjava.net/linuxmouse/archive/2012/09/29/388844.html</link><dc:creator>Linuxmouse</dc:creator><author>Linuxmouse</author><pubDate>Sat, 29 Sep 2012 07:32:00 GMT</pubDate><guid>http://www.blogjava.net/linuxmouse/archive/2012/09/29/388844.html</guid><wfw:comment>http://www.blogjava.net/linuxmouse/comments/388844.html</wfw:comment><comments>http://www.blogjava.net/linuxmouse/archive/2012/09/29/388844.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/linuxmouse/comments/commentRss/388844.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/linuxmouse/services/trackbacks/388844.html</trackback:ping><description><![CDATA[<div><p>　　比如我要启动mysql， 那么我就需要写一个 mysql.sh的文件，里面包含以下内容：</p> <p>　　#! /bin/sh</p> <p>　　/usr/local/mysql/bin/mysqld_safe &amp;</p> <p>　　然后把mysql.sh 复制到 /usr/local/etc/rc.d 下面，然后：</p> <p>　　chmod 755 /usr/local/etc/rc.d/mysql.sh</p> <p>　　就是设置为该脚本文件属性为755，重启动系统后就能自动启动该服务了!</p> <p>　　启动其他服务类似。</p> <p>　　当然，除了上面的启动服务方式，还有一种方法。</p> <p>　　就是在 /etc/rc.local 里面加上要启动的服务，那么系统下次启动的时候就会自动启动。</p> <p>　　如果 /etc/rc.local 文件不存在，那么就建立一个，比如我们要让我们的mysql启动，那么就编辑该文件：</p> <p>　　ee /etc/rc.local</p> <p>　　然后在里面加上一行：</p> <p>　　/usr/local/mysql/bin/mysqld_safe &amp;</p> <p>　　那么下次系统启动的话，mysql就启动了，如果要启动很多，就依此类推加上启动命令。</p></div><img src ="http://www.blogjava.net/linuxmouse/aggbug/388844.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/linuxmouse/" target="_blank">Linuxmouse</a> 2012-09-29 15:32 <a href="http://www.blogjava.net/linuxmouse/archive/2012/09/29/388844.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>redhat 各版本下载</title><link>http://www.blogjava.net/linuxmouse/archive/2012/03/26/372703.html</link><dc:creator>Linuxmouse</dc:creator><author>Linuxmouse</author><pubDate>Mon, 26 Mar 2012 05:36:00 GMT</pubDate><guid>http://www.blogjava.net/linuxmouse/archive/2012/03/26/372703.html</guid><wfw:comment>http://www.blogjava.net/linuxmouse/comments/372703.html</wfw:comment><comments>http://www.blogjava.net/linuxmouse/archive/2012/03/26/372703.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/linuxmouse/comments/commentRss/372703.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/linuxmouse/services/trackbacks/372703.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: &nbsp;&nbsp;<a href='http://www.blogjava.net/linuxmouse/archive/2012/03/26/372703.html'>阅读全文</a><img src ="http://www.blogjava.net/linuxmouse/aggbug/372703.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/linuxmouse/" target="_blank">Linuxmouse</a> 2012-03-26 13:36 <a href="http://www.blogjava.net/linuxmouse/archive/2012/03/26/372703.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>CentOS启用RPMForge软件库安装软件</title><link>http://www.blogjava.net/linuxmouse/archive/2012/03/09/371606.html</link><dc:creator>Linuxmouse</dc:creator><author>Linuxmouse</author><pubDate>Fri, 09 Mar 2012 15:18:00 GMT</pubDate><guid>http://www.blogjava.net/linuxmouse/archive/2012/03/09/371606.html</guid><wfw:comment>http://www.blogjava.net/linuxmouse/comments/371606.html</wfw:comment><comments>http://www.blogjava.net/linuxmouse/archive/2012/03/09/371606.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/linuxmouse/comments/commentRss/371606.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/linuxmouse/services/trackbacks/371606.html</trackback:ping><description><![CDATA[<div></div>64位系统使用如下命令：<br /> <br /> wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm<br /> rpm -Uhv rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm<br /> <br /> 32位系统使用如下命令:<br /> <br /> wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm<br /> rpm -Uhv rpmforge-release-0.5.2-2.el5.rf.i386.rpm<img src ="http://www.blogjava.net/linuxmouse/aggbug/371606.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/linuxmouse/" target="_blank">Linuxmouse</a> 2012-03-09 23:18 <a href="http://www.blogjava.net/linuxmouse/archive/2012/03/09/371606.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>FreeBSD备忘录 实用 转载</title><link>http://www.blogjava.net/linuxmouse/archive/2011/12/08/365839.html</link><dc:creator>Linuxmouse</dc:creator><author>Linuxmouse</author><pubDate>Thu, 08 Dec 2011 02:34:00 GMT</pubDate><guid>http://www.blogjava.net/linuxmouse/archive/2011/12/08/365839.html</guid><wfw:comment>http://www.blogjava.net/linuxmouse/comments/365839.html</wfw:comment><comments>http://www.blogjava.net/linuxmouse/archive/2011/12/08/365839.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/linuxmouse/comments/commentRss/365839.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/linuxmouse/services/trackbacks/365839.html</trackback:ping><description><![CDATA[01.查看网络流量<br /> &nbsp; &nbsp;a.systat -if 1 （1表示1s刷新屏幕一次）<br /> &nbsp; &nbsp;b.netstat 1<br /> &nbsp; &nbsp;# Traffic 流量 peak 峰值 average 平均值 <br /> <br /> 02.查看硬盘信息<br /> &nbsp; &nbsp;diskinfo -vt /dev/ad0<br /> &nbsp; &nbsp;disklable /dev/ad0 (分区信息)<br /> &nbsp; &nbsp;disklable /dev/ad0s2<br /> <br /> 03.查看核心信息<br /> &nbsp; &nbsp;vmstat 1<br /> <br /> 04.查看进程<br /> &nbsp; &nbsp;top&nbsp; &nbsp;ps auxww&nbsp;&nbsp;ps -ef |grep xxx<br /> <br /> 05.查看硬盘详细分区信息＆读写状况<br /> &nbsp; &nbsp;gstat<br /> <br /> 06.sysctl sysctl -a 查看所有变量（/etc/sysctl.conf）<br /> &nbsp; &nbsp;sysctl kern.maxproc 查看特定变量<br /> &nbsp; &nbsp;sysctl kern.maxfiles=5000 设置变量<br /> <br /> 07.查看磁盘空间使用情形&nbsp; &nbsp; df 和 du<br /> &nbsp; &nbsp;指令df用来查看整个档案系统的使用情形，<br /> &nbsp; &nbsp;如果您需要知道某个目录的使用情形用指令du。<br /> &nbsp; &nbsp;df -h<br /> &nbsp; &nbsp;du -h /etc<br /> &nbsp; &nbsp;du -sh /etc <br /> &nbsp; &nbsp;-s 参数来省略指定目录下的子目录<br /> &nbsp; &nbsp;-h 表示使用GB、MB等易读的格式<br /> <br /> 08.断电后系统无法启动<br /> &nbsp; &nbsp;a.启动到sing user模式<br /> &nbsp; &nbsp;b.fsck<br /> &nbsp; &nbsp;c.reboot<br /> <br /> 09.升级内核后无法启动<br /> &nbsp; &nbsp;a.重启机器到10秒读秒时按enter以外的任意键(新版bsd按6)<br /> &nbsp; &nbsp;b.unload<br /> &nbsp; &nbsp;c.boot kernel.old 或其他可以启动的内核<br /> &nbsp; &nbsp;另外一种方法<br /> &nbsp; &nbsp;a.使用cd1启动，选择Fixit--&gt;CDROM/DVD<br /> &nbsp; &nbsp;b.Fixit#mount /dev/ad0s2a /mnt mount硬盘上的文件系统<br /> &nbsp; &nbsp;c.cd /mnt/boot<br /> &nbsp; &nbsp;d.rm -rf kernel<br /> &nbsp; &nbsp;e.cp -R kernel.old kernel<br /> &nbsp; &nbsp;f.reboot<br /> &nbsp; &nbsp;<br /> &nbsp; &nbsp;修改了/boot/loader.conf以后不能正常引导系统了，当机器开始加载<br /> &nbsp; &nbsp;/boot/defaults/loader.conf的时候(未加载完)机器停止响应，我应该怎么办？<br /> &nbsp; &nbsp;a.使用cd1启动，选择Fixit--&gt;CDROM/DVD<br /> &nbsp; &nbsp;b.Fixit#mount /dev/ad0s2a /mnt mount硬盘上的文件系统<br /> &nbsp; &nbsp;c.cd /mnt/boot<br /> &nbsp; &nbsp;d.vi loader.conf 去掉错误的加载项<br /> &nbsp; &nbsp;e.reboot<br /> <br /> 10.丢失root密码<br /> &nbsp; &nbsp;<br /> &nbsp; &nbsp;启动到单用户模式,执行/sbin/mount -a, 然后用passwd更改密码<br /> &nbsp; &nbsp;/sbin/mount -a=挂接/etc/fstab里所有列出的文件系统<br /> &nbsp; &nbsp;如果单用户登录也需要密码<br /> &nbsp; &nbsp;a.使用cd1启动，选择Fixit--&gt;CDROM/DVD<br /> &nbsp; &nbsp;b.Fixit#mount /dev/ad0s2a /mnt mount硬盘上的文件系统<br /> &nbsp; &nbsp;c.cd /mnt/etc<br /> &nbsp; &nbsp;d.vi /ttys 找到when going to single-user mode,更改<br /> &nbsp; &nbsp;&nbsp;&nbsp;console none unknow off insecure为secure<br /> &nbsp; &nbsp;e.reboot,启动到单用户模式/sbin/mount -a,passwd<br /> <br /> &nbsp; &nbsp;启动到单用户模式后，ctrl+d进入多用户模式<br /> &nbsp; &nbsp;####让单用户登录也需要密码<br /> &nbsp; &nbsp;a.cd /etc<br /> &nbsp; &nbsp;b.vi /ttys 找到when going to single-user mode,更改<br /> &nbsp; &nbsp;&nbsp;&nbsp;console none unknow off secure为insecure<br /> <br /> 11.用win2000的引导器启动FreeBSD<br /> &nbsp; &nbsp;我在笔记本上装了双系统，win2000 和freebsd，装完 freebsd后 系统自动设置如下： <br /> &nbsp; &nbsp;f1 dos <br /> &nbsp; &nbsp;f2 freebsd <br /> &nbsp; &nbsp;先起动到dos下，fdisk /mbr，再把FreeBSD光盘上的boot\boot1复制到c:\,<br /> &nbsp; &nbsp;再编辑c:\boot.ini 加一行c:\boot1="FreeBsd"<br /> <br /> 12.硬盘分区时shift+F --&gt;NO可以使用全部空间<br /> <br /> 13.ctrl+alt+backspace 杀掉xwindows<br /> <br /> 14.alt+F1...F8 或 printscreensysr循环切换控制台<br /> <br /> 15.shutdown now 切换到单用户模式<br /> &nbsp; &nbsp;shutdown -p now shutdown -hp now 关闭电源<br /> &nbsp; &nbsp;shutdown -r now reboot 重新启动机器<br /> &nbsp; &nbsp;shutdown -p +90 (90分钟后关机)<br /> &nbsp; &nbsp;shutdown 0203122359(0203122359表示2002年3月12日23:59，格式是yymmddhhmm)<br /> <br /> 16.挂载ntfs,fat32分区和u盘<br /> &nbsp; &nbsp;ntfs: mount_ntfs -C eucCN /dev/ad0s5 /mnt/d<br /> &nbsp; &nbsp;fat32:mount_msdos -L zh_CN.eucCN /dev/ad0s6 /mnt/e<br /> &nbsp; &nbsp;u盘(scsi盘):&nbsp;&nbsp;mount_msdos -L zh_CN.eucCN /dev/da0s1 /mnt/u<br /> &nbsp; &nbsp;cdrom: #mount_cd9660 /dev/acd0 /mnt/cdrom<br /> &nbsp; &nbsp;NTFS在FreeBSD中只能只读而无法写入<br /> <br /> 17.卸载分区<br /> &nbsp; &nbsp;umount /dev/ad0s5 <br /> &nbsp; &nbsp;umount -f /dev/ad0s5 (强制卸载)<br /> <br /> 18.在/etc/fstab中挂载fat32分区<br /> &nbsp; &nbsp;/dev/ad0s5&nbsp;&nbsp;/mnt/d&nbsp;&nbsp;msdos&nbsp;&nbsp;rw,-L=zh_CN.eucCN 2 2<br /> <br /> 19.如何在FreeBSD5.X以上加载,卸载ISO文件<br /> &nbsp; &nbsp;mount iso文件： <br /> &nbsp; &nbsp;mdconfig -a -t vnode -f myisofile.iso (屏幕输出md0或者类似的设备名) <br /> &nbsp; &nbsp;mount -t cd9660 /dev/md0 /cdrom&nbsp; &nbsp;<br /> &nbsp; &nbsp;umount：&nbsp;&nbsp;<br /> &nbsp; &nbsp;umount /cdrom&nbsp;&nbsp;<br /> &nbsp; &nbsp;mdconfig -d -u 0 (上面的-u后面的数字和前面的md?中的数字一致) <br /> &nbsp; &nbsp;mdconfig -l 命令可以列出关于配置 md(4) 设备的信息<br /> <br /> 20.声卡<br /> &nbsp; &nbsp;vi /boot/defaults/loader.conf<br /> &nbsp; &nbsp;更改snd_ich_load="NO"-&gt;"YES" #intel ich<br /> &nbsp; &nbsp;检测声卡 kldstat 或 dmesg |grep pcm<br /> <br /> 21.ls 命令详解<br /> &nbsp; &nbsp;ls 显示本目录下的文件及目录<br /> &nbsp; &nbsp;ls -a显示本目录下的所有文件及目录（包括隐藏目录和文件）<br /> &nbsp; &nbsp;ls -l 显示本目录下所有文件的属性<br /> &nbsp; &nbsp;ls -l | grep ^d 只显示目录<br /> &nbsp; &nbsp;ls -l | grep ^- 只显示文件<br /> &nbsp; &nbsp;ls -l | grep ^d | wc &#8211;l&nbsp;&nbsp;统计当能目录下的子目录数<br /> &nbsp; &nbsp;ls -l | grep ^- | wc &#8211;l&nbsp;&nbsp;统计当能目录下的文件数<br /> &nbsp; &nbsp;ls -G&nbsp;&nbsp;以颜色显示目录名和文件名<br /> <br /> 22.查找程序或文件<br /> &nbsp; &nbsp;which 程序名<br /> &nbsp; &nbsp;whereis 程序名<br /> &nbsp; &nbsp;find 文件名<br /> &nbsp; &nbsp;locate 文件名<br /> &nbsp; &nbsp;locate: database too small: /var/db/locate.database的一种解决方法<br /> &nbsp; &nbsp;a.这个仅仅是因为你开机时间不够长，看看/etc/periodic/weekly/310.locate<br /> &nbsp; &nbsp;b.试试运行/usr/libexec/locate.updatedb看<br /> &nbsp; &nbsp;whatis xxx 要找东西但不知道它是什么<br /> &nbsp; &nbsp;grep bpf /usr/src/sys/i386/conf/GENERIC 在文件中找指定文本<br /> &nbsp; &nbsp;#只能对文本进行grep,如是命令,则<br /> &nbsp; &nbsp;command |grep text<br /> &nbsp; &nbsp;grep text filename<br /> <br /> 23.xmms乱码问题 (要拷贝simsun.ttf和taboma.ttf到/usr/X11R6/lib/X11/fonts/TrueType/)<br /> &nbsp; &nbsp;在用户目录下建立 .gtkrc.mine 文件.代码如下<br /> &nbsp; &nbsp; style "gtk-default-zh-cn" { <br /> &nbsp; &nbsp; fontset = "-*-tahoma-medium-r-normal-*-12-0-0-0-p-0-iso8859-1,<br /> &nbsp; &nbsp;-misc-simsun-medium-r-normal-*-*-120-*-*-p-*-gbk-0,*-r-*" }<br /> &nbsp; &nbsp;class "GtkWidget" style "gtk-default-zh-cn" <br /> &nbsp; &nbsp;修改xmms中的字体设置，将播放清单及主窗口的字体修改为下面的设置 <br /> &nbsp; &nbsp;-*-tahoma-medium-r-normal-*-12-0-0-0-p-0-iso8859-1,<br /> &nbsp; &nbsp;-misc-simsun-medium-r-normal-*-*-120-*-*-p-*-gbk-0,*-r-* <br /> &nbsp; &nbsp;<br /> &nbsp; &nbsp;xorg6.9+xfce4+xmms<br /> &nbsp; &nbsp;cd /usr/ports/chineses/xmms make install clean<br /> &nbsp; &nbsp;拷贝simsun.ttf到/usr/X11R6/lib/X11/fonts/TTF/,无需要建立.gtkrc.mine<br /> &nbsp; &nbsp;只要修改xmms中的字体设置,字体simsun,size 12就好了。<br /> &nbsp; &nbsp;<br /> 24.停止sendmail<br /> &nbsp; &nbsp;vi /etc/rc.conf 加入<br /> &nbsp; &nbsp;sendmail_enable="NONE"<br /> <br /> 25.you have mail<br /> &nbsp; &nbsp;mail 回车,输入1看第一封邮件...输入?看帮助<br /> &nbsp; &nbsp;mail 古老的 UNIX 邮件处理程序<br /> &nbsp; &nbsp;如果我们要寄信给非本机的使用者，可以使用的收件人格式如下：<br /> &nbsp; &nbsp;mail -s"hi, my friend" <a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;&#106;&#97;&#99;&#107;&#64;&#109;&#121;&#109;&#97;&#105;&#108;&#46;&#99;&#111;&#109;">jack@mymail.com</a><br /> &nbsp; &nbsp;mail -s "hi, my friend" <a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;&#106;&#97;&#99;&#107;&#64;&#109;&#121;&#109;&#97;&#105;&#108;&#46;&#99;&#111;&#109;">jack@mymail.com</a> &lt; content.txt<br /> &nbsp; &nbsp;执行了 mail 之后，程序会先要求我们输入邮件主旨，输入后就可以开始打本文了。<br /> &nbsp; &nbsp;当完成本文的编辑之后，可以按 Ctrl+D 来将信件送出，或是按二次 Ctrl+C 取消。<br /> <br /> 26.traceroute ＆ping的整合工具my traceroute /mtr<br /> &nbsp; &nbsp;/usr/ports/net/mtr<br /> &nbsp; &nbsp;使用: mtr <a href="http://www.163.com/" target="_blank">www.163.com</a><br /> <br /> 27.使用gnome2的gdm做桌面管理器<br /> &nbsp; &nbsp;vi /etc/rc.conf 加入<br /> &nbsp; &nbsp;gdm_enable="YES"<br /> &nbsp; &nbsp;vi /root/.dmrc 更改Language=zh_CN.UTF-8--&gt;zh_CN.eucCN<br /> <br /> 28.远程连接windows终端<br /> &nbsp; &nbsp;rdesktop [-a 16 -f] server'IP[:port]<br /> &nbsp; &nbsp;-a 16表示16位色,-f表示全屏<br /> &nbsp; &nbsp;gui，grdesktop (/usr/ports/net/grdesktop)<br /> &nbsp; &nbsp;<br /> 29.播放APE格式音乐<br /> &nbsp; &nbsp;/usr/ports/chinese/xmms/ /usr/ports/audio/xmms-mac(ape插件)xmms-wma(wma插件)<br /> <br /> 30.看图<br /> &nbsp; &nbsp;/usr/ports/graphics/xnview<br /> <br /> 31.apache22+php5+mysql+postgresql+ZendOptimizer<br /> &nbsp; &nbsp;a,apache22:<br /> &nbsp; &nbsp;&nbsp;&nbsp;cd /usr/ports/www/apache22<br /> &nbsp; &nbsp;&nbsp;&nbsp;make install clean<br /> &nbsp; &nbsp;b,php5:<br /> &nbsp; &nbsp;&nbsp;&nbsp;cd /usr/ports/lang/php5<br /> &nbsp; &nbsp;&nbsp;&nbsp;make install clean <br /> &nbsp; &nbsp;&nbsp;&nbsp;选中APACHE，就可以联编出用于与Apache web服务器配合使用的可动态加载的mod_php5模块.<br /> &nbsp; &nbsp;&nbsp;&nbsp;勿选debug,否则不能装ZendOptimizer<br /> &nbsp; &nbsp;c,php5扩展:<br /> &nbsp; &nbsp;&nbsp;&nbsp;cd /usr/ports/lang/php5-extesions<br /> &nbsp; &nbsp;&nbsp;&nbsp;make install [FORCE_PKG_REGISTER=yes] 强迫安装<br /> &nbsp; &nbsp;&nbsp;&nbsp;make clean<br /> &nbsp; &nbsp;&nbsp;&nbsp;(除预设项目还应选中CTYPE,EXIF,GD,ICONV,IMAP,PCRE,SESSION,ZLIB)<br /> &nbsp; &nbsp;&nbsp;&nbsp;FreeBSD中的PHP支持是高度模块化的，因此基本安装的功能十分有限。增加其他功能非常简单，<br /> &nbsp; &nbsp;&nbsp;&nbsp;只需通过lang/php5-extensions即可完成。这个port提供了一个菜单驱动的界面来帮助完成PHP<br /> &nbsp; &nbsp;&nbsp;&nbsp;扩展的安装。另外也可以通过对应的port来单独安装扩展。例如要将对于MySQL数据库服务器<br /> &nbsp; &nbsp;&nbsp;&nbsp;的支持加入PHP5，只需简单地安装databases/php5-mysql.<br /> &nbsp; &nbsp;d,cp /usr/local/etc/php.ini.recommended /usr/local/etc/php.ini<br /> &nbsp; &nbsp;e,ZendOptimizer<br /> &nbsp; &nbsp;&nbsp;&nbsp;cd /usr/ports/devel/ZendOptimizer<br /> &nbsp; &nbsp;&nbsp;&nbsp;make install clean<br /> &nbsp; &nbsp;f,mysql:<br /> &nbsp; &nbsp;&nbsp;&nbsp;cd /usr/ports/databases/mysql41-server<br /> &nbsp; &nbsp;&nbsp;&nbsp;make WITH_OPENSSL=yes BUILD_OPTIMIZED=yes WITH_CHARSET=gbk WITH_XCHARSET=all SKIP_DNS_CHECK=yes install<br /> &nbsp; &nbsp;&nbsp;&nbsp;./work/mysql-5.0.24/scripts/mysql_install_db<br /> &nbsp; &nbsp;&nbsp;&nbsp;cd /usr/ports/databases/php5-mysql<br /> &nbsp; &nbsp;&nbsp;&nbsp;make install clean<br /> &nbsp; &nbsp;g,postgresql<br /> &nbsp; &nbsp;&nbsp;&nbsp;cd /usr/ports/databases/postgresql81-server<br /> &nbsp; &nbsp;&nbsp;&nbsp;make install clean<br /> &nbsp; &nbsp;&nbsp;&nbsp;/usr/local/etc/rc.d/postgresql initdb<br /> &nbsp; &nbsp;&nbsp;&nbsp;echo 'postgresql_enable="YES"' &gt;&gt; /etc/rc.conf<br /> &nbsp; &nbsp;&nbsp;&nbsp;cd /usr/ports/databases/php5-pgsql<br /> &nbsp; &nbsp;&nbsp;&nbsp;make install clean<br /> <br /> 32.怎样刷新环境变量值，而不用退出再登陆？<br /> &nbsp; &nbsp;a,比如要重新设置环境变量ABC的值为abcdef <br /> &nbsp; &nbsp;&nbsp;&nbsp;bash$ export ABC=abcdef <br /> &nbsp; &nbsp;&nbsp;&nbsp;csh% setenv ABC abcdef<br /> &nbsp; &nbsp;b,更新了PATH变量指定目录里可执行命令<br /> &nbsp; &nbsp;&nbsp;&nbsp;rehash<br /> &nbsp; &nbsp;c,更新配置文件 <br /> &nbsp; &nbsp;&nbsp;&nbsp;比如你编辑了.cshrc等文件，就需要用source命令 <br /> &nbsp; &nbsp;&nbsp;&nbsp;source .cshrc<br /> <br /> 33.检视软件间的关联<br /> &nbsp; &nbsp;cd /usr/ports/sysutils/pkg_tree<br /> &nbsp; &nbsp;make install clean<br /> &nbsp; &nbsp;之后我们就可以使用 pkg_tree | more 来看各个软件之间的关系了 <br /> <br /> 34.使用 portupgrade 更新软件<br /> &nbsp; &nbsp;cd /usr/ports/sysutils/portupgrade<br /> &nbsp; &nbsp;make install clean<br /> &nbsp; &nbsp;配置文件:/usr/local/etc/pkgtools.conf<br /> &nbsp; &nbsp;如果您只想要升级某一个软件本身，而非所有相依的软件，只要使用<br /> &nbsp; &nbsp;portupgrade "pkgname" 即可。如果您要升级所有和该软件相依的其它软件，<br /> &nbsp; &nbsp;则可以加上参数 -r。如果您要更新包含相依软件的相依软件，则可以使用<br /> &nbsp; &nbsp;参数 -R。另外，您可以使用参数 -m 来要求编译 (make) ports 时多传入<br /> &nbsp; &nbsp;一些参数，还可以使用参数 -f 要求就算版本一样也强制更新。portupgrade <br /> &nbsp; &nbsp;在更新软件时，会保留您原本的设定档。例如，在更新 Apache 时，它会保留<br /> &nbsp; &nbsp;httpd.conf的设定。假设我们更新软件perl-5.8，我们可以用下列指令更新：<br /> &nbsp; &nbsp;# portupgrade -rRf "perl-5.8.*" -m "ENABLE_SUIDPERL=yes"<br /> <br /> 35.ports安装失败提示<br /> &nbsp; &nbsp;stop in /usr/ports/lang/ruby18/work <br /> &nbsp; &nbsp;删除work目录下所有文件＆文件夹再次安装即可.(make clean)<br /> <br /> 36.ntop--网络监控软件<br /> &nbsp; &nbsp;cd /usr/ports/net/ntop<br /> &nbsp; &nbsp;make install clean<br /> &nbsp; &nbsp;vi /etc/rc.conf 加入<br /> &nbsp; &nbsp;ntop_enable="YES"<br /> &nbsp; &nbsp;在地址栏中输入<a href="http://x.x.x.x:3000/" target="_blank">http://x.x.x.x:3000</a> 即出来管理界面.<br /> <br /> 37.修改/etc/rc.conf不重启生效<br /> &nbsp; &nbsp;a.sh /etc/rc<br /> &nbsp; &nbsp;b./etc/netstart <br /> <br /> 38.freebsd启动的时候停到blanktime的解决办法<br /> &nbsp; &nbsp;可以试试 这个参数:blanktime="NO" <br /> &nbsp; &nbsp;etc/rc.conf 中把 default_router 注释掉<br /> &nbsp; &nbsp;#未验证!!!<br /> <br /> 39.Bsd 下的QQ <br /> &nbsp; &nbsp;eva不错，运行速度飞快。<br /> &nbsp; &nbsp;/usr/ports/net-im/eva<br /> &nbsp; &nbsp;gaim-openq<br /> &nbsp; &nbsp;/usr/ports/net-im/gaim-openq<br /> <br /> 40.一次性把所有安装的ports删除掉<br /> &nbsp; &nbsp;a.pkg_delete -a<br /> &nbsp; &nbsp;&nbsp;&nbsp;以下步骤去掉配置文件，解决一些疑难问题 <br /> &nbsp; &nbsp;&nbsp;&nbsp;rm -fr /usr/local/ <br /> &nbsp; &nbsp;&nbsp;&nbsp;rm -fr /var/db/ports/<br /> &nbsp; &nbsp;&nbsp;&nbsp;cd /usr/ports &amp;&amp; make NOCLEANDEPENDS=yes clean <br /> &nbsp; &nbsp;&nbsp;&nbsp;portsnap fetch update<br /> &nbsp; &nbsp;b.安装pkg_cutleaves它会告诉你，哪些package没有人依赖，并让你决定要不要删除<br /> &nbsp; &nbsp;c.make deinstall与pkg_delete有什麽不同？ <br /> &nbsp; &nbsp;简单来说，make deinstall会移除该port，并且不会叁照其相依相关的ports。 <br /> &nbsp; &nbsp;pkg_delete在移除该port前，会叁照其相依相关的ports，并且pkg_delete <br /> &nbsp; &nbsp;有支援 wild card，如要移除所有p开头的 ports，则： <br /> &nbsp; &nbsp;cd /var/db/pkg/ <br /> &nbsp; &nbsp;pkg_delete p*&nbsp;&nbsp;<br /> &nbsp; &nbsp;要注意的是，如果使用 `make deinstall'，则最好确定系统目前所 <br /> &nbsp; &nbsp;安装的版本，与 ports collection 中显示的版本符合，否则有可能会出现非预 <br /> &nbsp; &nbsp;期性错误；而pkg_delete是因为直接删除系统中所安装的版本，所以没有此问题。<br /> &nbsp; &nbsp;因此，换句话说，当系统所安装的版本符合ports collections中的版本，则可 <br /> &nbsp; &nbsp;以使用make deinstall或pkg_delete，否则的话最好用pkg_delete。<br /> <br /> 41.pure-ftp安装<br /> &nbsp; &nbsp;cd /usr/ports/ftp/pure-ftpd/<br /> &nbsp; &nbsp;make WITH_LANG=simplified-chinese install clean<br /> &nbsp; &nbsp;[X] BANNER&nbsp; &nbsp;Show pure-ftpd welcome upon session start <br /> &nbsp; &nbsp;cd /usr/local/etc/<br /> &nbsp; &nbsp;cp pure-ftpd.conf.sample pure-ftpd.conf<br /> &nbsp; &nbsp;vi /etc/rc.conf --&gt;加入pureftpd_enable="YES"<br /> &nbsp; &nbsp;关于pureftpd的编码问题<br /> &nbsp; &nbsp;在win下登陆ftp然后建立中文文件夹,传中文文件然后用FlashFXP登陆看到这些<br /> &nbsp; &nbsp;中文文件和文件夹名字全部是乱码.pure-ftpd.conf中强制用gbk就可以了.<br /> &nbsp; &nbsp;FileSystemCharset&nbsp; &nbsp;&nbsp; &nbsp; gbk <br /> &nbsp; &nbsp;ClientCharset&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;gbk<br /> <br /> 42.开机自动校准时间<br /> &nbsp; &nbsp;vi /etc/rc.conf---&gt;加入<br /> &nbsp; &nbsp;ntpdate_enable="YES"&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; # Run ntpdate to sync time on boot (or NO).<br /> &nbsp; &nbsp;ntpdate_flags="218.75.4.130"&nbsp; &nbsp;&nbsp;&nbsp;# cn.pool.ntp.org<br /> <br /> 43.将/usr/ports/distfiles/目录放到/data/disktfiles&nbsp; &nbsp;<br /> &nbsp; &nbsp;cd /usr/ports <br /> &nbsp; &nbsp;mv distfiles /data/distfiles [移动]<br /> &nbsp; &nbsp;ln -s /data/distfiles distfiles [链接][要在/usr/ports目录下做]<br /> &nbsp; &nbsp;ln -s source_file[_dir] target_file[_dir]<br /> <br /> 44.FreeBSD下面通过串口连接到路由器<br /> &nbsp; &nbsp;使用cu -s speed -l line，就可以连接到COM口或者家猫的线路上，我用的是COM1口，<br /> &nbsp; &nbsp;连接Cisco2924XL，使用cu -s 9600 -l ttyd0，即可连接上交换机配置界面。<br /> <br /> 45.电子书：CHM、PDF的查看<br /> &nbsp; &nbsp;chmsee,kchmviewer,xpdf,xchm,Acrobat Reader...chmsee对中文支持比较好<br /> &nbsp; &nbsp;/usr/ports/print/acroread7<br /> <br /> 46.使用axel或者prozilla加速你的port下载&nbsp;&nbsp;<br /> &nbsp; &nbsp;a.axel(据说能搞定文件夹钳套,不错!推荐使用 )<br /> &nbsp; &nbsp;cd /usr/ports/ftp/axel<br /> &nbsp; &nbsp;make install clean <br /> &nbsp; &nbsp;vi /etc/make.conf 加入<br /> &nbsp; &nbsp;FETCH_CMD=axel -a <br /> &nbsp; &nbsp;DISABLE_SIZE=yes<br /> &nbsp; &nbsp;vi /usr/local/etc/axelrc 修改代码<br /> &nbsp; &nbsp;#num_connections = 4<br /> &nbsp; &nbsp;num_connections = 10 <br /> &nbsp; &nbsp;4改为10,num_connections前面不留空格,否则出错.<br /> &nbsp; &nbsp;(-a 交互的进步指示器,num_connections = 10 10线程下载) <br /> &nbsp; &nbsp;SIZE参数用来在取得文件之前检查文件的大小.而DISABLE_SIZE则是是否开启这项功能<br /> &nbsp; &nbsp;b.prozilla(速度快,遇到欠套的文件夹会出问题)<br /> &nbsp; &nbsp;cd /port/ftp/prozilla<br /> &nbsp; &nbsp;make install clean <br /> &nbsp; &nbsp;vi /etc/make.conf 加入<br /> &nbsp; &nbsp;FETCH_CMD=proz -s -k=10 -r --no-curses<br /> &nbsp; &nbsp;DISABLE_SIZE=yes<br /> &nbsp; &nbsp;(-s 查找最快的境像,-k=10 10个线程下载,-r 重新开始一个被打断的下载)<br /> &nbsp; &nbsp;c.wget(未测试)<br /> &nbsp; &nbsp;cd /usr/ports/ftp/wget/ <br /> &nbsp; &nbsp;make install clean<br /> &nbsp; &nbsp;vi /etc/make.conf 加入<br /> &nbsp; &nbsp;FETCH_CMD=wget -c -t 1<br /> &nbsp; &nbsp;DISABLE_SIZE=yes #这行是必要的<br /> &nbsp; &nbsp;d.在其它机器上fetch <br /> &nbsp; &nbsp;make fetch-recursive (fetch:取得recursive:递归的)<br /> &nbsp; &nbsp;然后将/usr/ports/distfiles拿走。<br /> <br /> &nbsp; &nbsp;###make install设置是/etc/make.conf <br /> 　 ###pkg_add是在~/.cshrc或~/.profile<br /> &nbsp; &nbsp;e.vi /etc/csh.cshrc<br /> &nbsp; &nbsp;加上以下一行可以在让pkg_add先从更快的站点下载<br /> &nbsp; &nbsp;setenv PACKAGEROOT <a href="ftp://ftp.cn.freebsd.org/" target="_blank">ftp://ftp.cn.freebsd.org</a><br /> &nbsp; &nbsp;你可以先设定 PACKAGEROOT，这是用来抓取套件的位置,笔者通常设定 <br /> &nbsp; &nbsp;setenv PACKAGEROOT <a href="ftp://ftp.tw.freebsd.org/" target="_blank">ftp://ftp.tw.freebsd.org</a><br /> &nbsp; &nbsp;因为这是我认为最稳定的机器，然后就可以透过pkg_add -r 套件名来安装套件，<br /> &nbsp; &nbsp;他会自动的到pub/FreeBSD/ports/i386/packages-4.9-release/Latest/底下<br /> &nbsp; &nbsp;寻找套件，而且你不需要知道版本，只要知道套件名称即可，他会自动安 装<br /> &nbsp; &nbsp;当时的最新版，中文的部分只要加上 zh-，像是 zh-xcin。 <br /> &nbsp; &nbsp;你也可以直接指定 PACKAGESITE 来指向特定的位置。像是你希望安装的套件是 <br /> &nbsp; &nbsp;最新的，而不是 release 时的版本。 <br /> &nbsp; &nbsp;setenv PACKAGESITE <a href="ftp://ftp.tw.freebsd.org/pub/Fre" target="_blank">ftp://ftp.tw.freebsd.org/pub/Fre</a> ... ages-stable/Latest/<br /> &nbsp; &nbsp;<br /> &nbsp; &nbsp;f.vi /etc/make.conf <br /> &nbsp; &nbsp;加上以下一行可以在让make先从更快的站点下载ports Distfiles<br /> &nbsp; &nbsp;MASTER_SITE_OVERRIDE?=http://ports.cn.freebsd.org/${DIST_SUBDIR}/<br /> &nbsp; &nbsp;<br /> &nbsp; &nbsp;####<a href="http://ports.cn.freebsd.org/" target="_blank">http://ports.cn.freebsd.org/</a><br /> &nbsp; &nbsp;Welcome to use FreeBSD Ports Distfiles Mirror.<br /> &nbsp; &nbsp;This mirror is running on China Telecom 100Mbit network.<br /> &nbsp; &nbsp;How to use? Set your /etc/make.conf like this:<br /> &nbsp; &nbsp;MASTER_SITE_OVERRIDE?=http://ports.cn.freebsd.org/${DIST_SUBDIR}/<br /> &nbsp; &nbsp;or like this:<br /> &nbsp; &nbsp;MASTER_SITE_OVERRIDE?=http://ports.hshh.org/${DIST_SUBDIR}/<br /> <br /> 47.星际译王<br /> &nbsp; &nbsp;辞典程序： /usr/ports/textproc/stardict2/<br /> &nbsp; &nbsp;简体中文辞典：/usr/ports/chinese/stardict2-dict-zh_CN/<br /> <br /> 48.控制台调音量<br /> &nbsp; &nbsp;mixer<br /> <br /> 49.How to build openoffice<br /> &nbsp; &nbsp;cd /usr/ports/editors/openoffice.org-2.0<br /> &nbsp; &nbsp;Building/installing/packaging a localized language package (Japanese version for example)<br /> &nbsp; &nbsp;make LOCALIZED_LANG=ja install<br /> &nbsp; &nbsp;去这里<a href="ftp://ooopackages.good-day.net/pub/OpenOffice.org/FreeBSD/" target="_blank">ftp://ooopackages.good-day.net/pub/OpenOffice.org/FreeBSD/</a>里面的tbz文件，<br /> &nbsp; &nbsp;可以直接pkg_add<br /> <br /> 50.OPERA，支持Flash浏览器<br /> &nbsp;&nbsp;cd /usr/ports/www/linux-opera　　<br /> （注意是www/linux-opera，www/opera是不支持Flash的。） <br /> &nbsp;&nbsp;cd /usr/ports/www/opera<br /> &nbsp;&nbsp;make config<br /> &nbsp;&nbsp;选中[X]SHARED Use a shared Qt library(instead of static)[解决在opera中输入汉字的问题]<br /> &nbsp;&nbsp;make install clean<br /> &nbsp;&nbsp;安装后的美化:<br /> &nbsp;&nbsp;A.Tools-&gt;Preference-&gt;Advanced-&gt;Fonts，把所有的字体都改成Simsun，字体大小设成12。<br /> &nbsp;&nbsp;B.最小字体大小（像素）改为12.[解决一些网站看不清楚的问题]<br /> <br /> 51.bt客户端<br /> &nbsp; &nbsp;/usr/ports/net-p2p/py-bittorrent&nbsp; &nbsp;安装完成后执行bittorrent<br /> &nbsp; &nbsp;/usr/ports/net-p2p/rtorrent 功能多，速度快，还完美支持中文编码！<br /> <br /> 52.emule客户端<br /> &nbsp; &nbsp;/usr/ports/net-p2p/amule2<br /> <br /> 53.ipguard解决arp攻击<br /> &nbsp; &nbsp;ipguard-&gt;Tool designed to protect LAN IP adress space by ARP spoofing <br /> &nbsp; &nbsp;/usr/ports/security/ipguard <br /> &nbsp; &nbsp; make install (不要clean参数,否则无ethers.sample文件)<br /> &nbsp; &nbsp;补充：<br /> &nbsp; &nbsp;A.以/usr/ports/security/ipguard/work/ipguard-0.04/doc/ethers.sample<br /> &nbsp; &nbsp;文件为实例，建立/etc/ethers文件。&nbsp;&nbsp;<br /> &nbsp; &nbsp;B.And then start ipguard: <br /> &nbsp; &nbsp;cd /usr/local/etc/rc.d&nbsp;&nbsp;<br /> &nbsp; &nbsp;mv ipguard.sh.sample ipguard.sh&nbsp; &nbsp;&nbsp;&nbsp;<br /> &nbsp; &nbsp;/usr/local/etc/rc.d/ipguard.sh start<br /> &nbsp; &nbsp;ipguard.sh启动脚本里默认有iface=fxp0，这里应该替换为你做NAT的内网网卡名称。<br /> <br /> 54.一些安装参数<br /> &nbsp; &nbsp;make fetch 只抓取tarball <br /> &nbsp; &nbsp;make fetch-recursive 抓取安装ports所有须要的其他ports的tarball<br /> &nbsp; &nbsp;make fetch-list 列出port所需的文件<br /> &nbsp; &nbsp;make clean Ports里面make clean,会附带着make clean依赖的软件的<br /> &nbsp; &nbsp;make -DBATCH install不需要用户输入任何东西<br /> &nbsp; &nbsp;make -DINTERACTIVE install 继续上一步<br /> &nbsp; &nbsp;make configure <br /> &nbsp; &nbsp;make distclean，删除不想要的distfiles<br /> &nbsp; &nbsp;<br /> 55.pkg_info<br /> &nbsp; &nbsp;pkg_info |grep zh-fcitx (查软件版本)<br /> &nbsp; &nbsp;#ls /var/db/pkg也可以查软件版本<br /> &nbsp; &nbsp;pkg_info -L zh-fcitx-3.4 (查看软件安装目录和安装的文件)<br /> &nbsp; &nbsp;pkg_info -xL zh-fcitx (加x了不需要加软件版本号)<br /> &nbsp; &nbsp;pkg_info -r zh-fcitx-3.4 (查看软件依赖情况)<br /> &nbsp; &nbsp;pkg_info -W fcitx (查看fcitx属于哪个软件)<br /> &nbsp; &nbsp;<br /> 56.Ports如何清除安装参数<br /> &nbsp; &nbsp;cd /usr/ports/www/opera<br /> &nbsp; &nbsp;make distclean移除不是port collections所期望下载的文件&nbsp; &nbsp;<br /> &nbsp; &nbsp;make rmconfig清除用户配置的参数<br /> &nbsp; &nbsp;make showconfig查看当前配置的参数<br /> &nbsp; &nbsp;make config更改参数 <br /> <br /> 57.一款好用的网络性能测试工具iperf<br /> &nbsp;&nbsp;/usr/ports/benchmarks/iperf<br /> <br /> 58.FreeBSD用户帐户锁定<br /> &nbsp; &nbsp;a.用vipw把他的shell修改成/sbin/nologin就可以了.<br /> &nbsp; &nbsp;b.pw lock useri 解锁用pw unlock userid<br /> 59.中文locale<br /> &nbsp; &nbsp;zh_CN.eucCN zh_CN.GBK zh_CN.GB18030 zh_CN.euc zh_CN.UTF-8<br /> &nbsp; &nbsp;#语言代码_国家代码.字符编码<br /> &nbsp; &nbsp;#查看环境变量：locale<br /> &nbsp; &nbsp;#目前还是zh_CN.eucCN(使用GB2312编码)locale最为正式，也最为成熟。<br /> <br /> 60.本地化设置,以系统默认的csh为例<br /> &nbsp; &nbsp;vi /etc/csh.cshrc 加入<br /> &nbsp; &nbsp;setenv LANG zh_CN.eucCN (语言设为中文)<br /> &nbsp; &nbsp;setenv LC_ALL zh_CN.eucCN (所有本地子集设为中文)<br /> &nbsp; &nbsp;setenv XMODIFIERS @im=fcitx (X下的中文输入法)<br /> &nbsp; &nbsp;set prompt = "%B%m&lt;%/&gt;"(个性化控制台%B颜色%m主机%/目录)<br /> &nbsp; &nbsp;set autolist&nbsp;&nbsp;(自动补齐扩展)<br /> &nbsp; &nbsp;set nobeep&nbsp; &nbsp; (告诉应用程式避免发出哔哔声)<br /> &nbsp; &nbsp;set filec&nbsp; &nbsp;&nbsp;&nbsp;(使档案名称在命令列被完成)<br /> &nbsp; &nbsp;alias ls&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;ls -FG (彩色化ls)<br /> <br /> 61.fcitx小企鹅输入法(有关步骤见60)<br /> &nbsp; &nbsp;/usr/ports/chineses/fcitx<br /> &nbsp; &nbsp;vi /root/.xinitrc 添加<br /> &nbsp; &nbsp;exec fcitx&amp; 到最前一行<br /> <br /> 62.安装X Server xorg-6.9.0<br /> &nbsp; &nbsp;1.cp freebsddisk1 disk2 PKG to /data/pkg61目录<br /> &nbsp; &nbsp;2.cd /data/pkg61<br /> &nbsp; &nbsp;3.pkg_add xorg-6.9.0.tbz<br /> &nbsp; &nbsp;4.rehash<br /> &nbsp; &nbsp;5.X[Xorg] -configure (生成/root/xorg.conf.new)<br /> &nbsp; &nbsp;6.X[Xorg] -config /root/xorg.conf.new (测试xorg.conf.new配置是否正确)<br /> &nbsp; &nbsp;7.cp /root/xorg.conf.new /etc/x11/xorg.conf<br /> <br /> 63.安装桌面环境gnome2 and xfce4 and kde3.5.1<br /> &nbsp; &nbsp;gnome2-2.12.3<br /> &nbsp; &nbsp;1.cd /data/pkg61<br /> &nbsp; &nbsp;2.pkg_add gnome2-2.12.3.tbz<br /> &nbsp; &nbsp;3.rehash<br /> &nbsp; &nbsp;4.vi /root/.xinitrc 加入 exec gnome-session<br /> &nbsp; &nbsp;#gnome2提示vi /etc/sysctl.conf,加入<br /> &nbsp; &nbsp;kern.ipc.shmmax=67108864<br /> &nbsp; &nbsp;kern.ipc.shmall=32768<br /> &nbsp; &nbsp;kern.maxfiles=25000<br /> &nbsp; &nbsp;xfce4<br /> &nbsp; &nbsp;1.cd /usr/ports/x11-wm/xfce4<br /> &nbsp; &nbsp;2.make install clean<br /> &nbsp; &nbsp;3.rehash<br /> &nbsp; &nbsp;4.vi /root/.xinitrc 加入 exec xfce4-session<br /> &nbsp; &nbsp;kde-3.5.1<br /> &nbsp; &nbsp;1.cd /data/pkg61<br /> &nbsp; &nbsp;2.pkg_add kde-3.5.1.tbz<br /> &nbsp; &nbsp;3.rehash<br /> &nbsp; &nbsp;4.cd /usr/ports/chineses/kde3-i18n-zh_CN<br /> &nbsp; &nbsp;5.make install clean (kde3汉化)<br /> &nbsp; &nbsp;6.vi /root/.xinitrc 加入 exec startkde<br /> &nbsp; &nbsp;&nbsp;&nbsp;pkg_add -r kde<br /> &nbsp; &nbsp;&nbsp;&nbsp;pkg_add -r zh_CN-kde-i18n<br /> &nbsp; &nbsp;&nbsp;&nbsp;pkg_add -r zh_CN-koffice-i18n<br /> <br /> &nbsp; &nbsp;###more /root/.xinitrc<br /> &nbsp; &nbsp;exec fcitx&amp;<br /> &nbsp; &nbsp;exec gnome-session<br /> &nbsp; &nbsp;#exec xfce4-session<br /> &nbsp; &nbsp;#exec startkde<br /> &nbsp; &nbsp;#exec /usr/X11R6/bin/gnome-session<br /> &nbsp; &nbsp;#exec /usr/local/bin/xfce4-session<br /> &nbsp; &nbsp;#exec /usr/local/bin/startkde<br /> <br /> 64.在Xwindow中使用TrueType字体(simsun宋体,msyh雅黑,tahoma)<br /> &nbsp; &nbsp;1.cp simsun.ttc /usr/X11R6/lib/X11/fonts/TTF/simsun.ttf<br /> &nbsp; &nbsp;2.cp msyh.ttf tahoma.ttf /usr/X11R6/lib/X11/fonts/TTF/<br /> &nbsp; &nbsp;3.cd /usr/X11R6/lib/X11/fonts/TTF<br /> &nbsp; &nbsp;#下面4,5步骤更新字体信息,6重建字体缓存.<br /> &nbsp; &nbsp;4.mkfontscale (生成fonts.scale)否则xorg报错如下:<br /> &nbsp; &nbsp;Could not init font path element/usr/X11R6/lib/X11/fonts/TTF/,removing from list!<br /> &nbsp; &nbsp;5.mkfontdir (生成fonts.dir)否则xorg报错如下:<br /> &nbsp; &nbsp; (WW) `fonts.dir' not found (or not valid) in "/usr/X11R6/lib/X11/fonts/TTF/".<br /> &nbsp; &nbsp; Entry deleted from font path.<br /> &nbsp; &nbsp; (Run 'mkfontdir' on "/usr/X11R6/lib/X11/fonts/TTF/".<br /> &nbsp; &nbsp;6.fc-cache -f -v (生成fonts.cache-1) <br /> &nbsp; &nbsp;7.vi /etc/X11/xorg.conf 确认8 <br /> &nbsp; &nbsp;8.Load "freetype" (启用支持TrueType字体)<br /> &nbsp; &nbsp;#现在X应用程序已经记住已安装的TrueType字体.<br /> &nbsp; &nbsp;9.在gnome和其他X程序中把字体设置为宋体或雅黑.<br /> <br /> 65.xlsfonts显示系统中安装的字体<br /> <br /> 66.FreeBSD中3D加速功能的启用<br /> &nbsp; &nbsp;a.DRI。<br /> &nbsp; &nbsp;这是实现3D功能最重要的部分。DRI是Direct Rendering Infrastructure,<br /> &nbsp; &nbsp;可以简单的把它理解为X和硬件间的接口.但它包含很多独立的模块，负责<br /> &nbsp; &nbsp;从X到硬件的各个环节，包括内核。它最主要的工作就是将Mesa或OpenGL的<br /> &nbsp; &nbsp;函数调用转换为硬件的指令，从而指挥硬件进行渲染等工作。<br /> &nbsp; &nbsp;b.测试你的显卡是不是能实现3D功能，可以采取以下办法：<br /> &nbsp; &nbsp;1.dmesg | grep agp，如果出现:<br /> &nbsp; &nbsp;agp0: &lt;VIA 82C691 (Apollo Pro) host to PCI bridge&gt; mem <br /> &nbsp; &nbsp;0xe0000000-0xe3ffffff at device 0.0 on pci0<br /> &nbsp; &nbsp;的字样，那么你的显卡就有可能实现3D功能.如果什么也没有的话，那么<br /> &nbsp; &nbsp;恭喜你，你再也不用为3D功能而费心了.<br /> &nbsp; &nbsp;2.kldload drm，如果没报错的话，那么你的显卡基本上就可以实现3D功能了。<br /> &nbsp; &nbsp;c.3D功能的确认<br /> &nbsp; &nbsp;运行：glxinfo。在第二行或第三行，如果出现&#8221;Direct Rendering: YES&#8220;字样，<br /> &nbsp; &nbsp;那就说明已经启用3D加速了。<br /> &nbsp; &nbsp;more /var/log/Xorg.0.log | grep "direct rendering"如果出现下面的字样，<br /> &nbsp; &nbsp;(II) I810(0): direct rendering: Enabled那么你的3D就启用的。如果没有， <br /> &nbsp; &nbsp;那么你要仔细读/var/log/Xorg.0.log。它会在某一行告诉你没启用的原因的。<br /> &nbsp; &nbsp;d.nvidia显卡驱动安装 cd /usr/ports/x11/nvidia-driver/<br /> <br /> 67.刷新率的问题，<br /> &nbsp; &nbsp;将xorg.conf里的Modes行改成:Modes&nbsp; &nbsp;"1024x768"(小写的X)<br /> &nbsp; &nbsp;选择默认的分辨率和色深。 这是在 "Screen" 小节中定义的：<br /> &nbsp; &nbsp;Section "Screen"<br /> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;Identifier "Screen0"<br /> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;Device&nbsp; &nbsp;&nbsp;&nbsp;"Card0"<br /> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;Monitor&nbsp; &nbsp; "Monitor0"<br /> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;DefaultDepth 24<br /> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;SubSection "Display"<br /> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; Viewport&nbsp;&nbsp;0 0<br /> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; Depth&nbsp; &nbsp;&nbsp;&nbsp;24<br /> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; Modes&nbsp; &nbsp;&nbsp;&nbsp;"1024x768"<br /> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;EndSubSection<br /> &nbsp; &nbsp; EndSection<br /> &nbsp; &nbsp;<br /> 68.make world<br /> &nbsp; &nbsp;cvsup -g -L 2 -h cvsup.freebsdchina.org standard-supfile&nbsp;&nbsp;(升级源码树)<br /> &nbsp; &nbsp;cp /usr/share/examples/etc/make.conf /etc/make.conf<br /> &nbsp; &nbsp;vi /etc/make.conf,保留如下内容<br /> &nbsp; &nbsp;CFLAGS= -O -pipe<br /> &nbsp; &nbsp;COPTFLAGS= -O -pipe<br /> &nbsp; &nbsp;cd /usr/src/sys/i386/conf&nbsp;&nbsp;(更改内核配置文件)<br /> &nbsp; &nbsp;cp GENERIC TDS<br /> &nbsp; &nbsp;vi TDS (按需要修改其内容)<br /> &nbsp; &nbsp;shutdown now&nbsp;&nbsp;(重启到单用户模式)&nbsp;&nbsp;<br /> &nbsp; &nbsp;adjkerntz -i&nbsp;&nbsp;(确定本地时间设置)<br /> &nbsp; &nbsp;cd /usr/src<br /> &nbsp; &nbsp;make -j4 buildworld&nbsp;&nbsp;(编译基本系统)<br /> &nbsp; &nbsp;make buildkernel KERNCONF=TDS&nbsp;&nbsp;(编译新内核)<br /> &nbsp; &nbsp;make installkernel KERNCONF=TDS&nbsp;&nbsp;(安装新内核)<br /> &nbsp; &nbsp;reboot&nbsp;&nbsp;(重新启动)<br /> &nbsp; &nbsp;shutdown now&nbsp;&nbsp;(重启到单用户模式)<br /> &nbsp; &nbsp;cd /usr/src<br /> &nbsp; &nbsp;mergemaster -p&nbsp;&nbsp;(更新/etc目录里的文件,-p预建模式)<br /> &nbsp; &nbsp;make installworld&nbsp;&nbsp;(安装新的二进制)<br /> &nbsp; &nbsp;mergemaster -Ui&nbsp; &nbsp; (更新makeinstallworld不更新的文件,-U進了6-STABLE了,這功能很讚，<br /> &nbsp; &nbsp;就是他會看哪些/etc 的檔案，你沒有改過的，就會自動 merge，這樣子可以省下很多時間跟力氣。<br /> &nbsp; &nbsp;shutdown -r now&nbsp;&nbsp;(重新启动) <br /> &nbsp; &nbsp;uname -a&nbsp;&nbsp;(查看系统信息) <br /> &nbsp; &nbsp;cd /usr/src<br /> &nbsp; &nbsp;make cleanworld&nbsp;&nbsp;(清除升级过程产生的临时文件)<br /> &nbsp; &nbsp;#############################################<br /> &nbsp; &nbsp;中断的 build 可以被恢复吗<br /> &nbsp; &nbsp;cd /usr/src<br /> &nbsp; &nbsp;make -DNOCLEAN all<br /> &nbsp; &nbsp;这样就不会取消先前的 make buildworld 所做的工作。<br /> &nbsp; &nbsp;##############################################<br /> &nbsp; &nbsp;如果出现了错误我该怎么办？<br /> &nbsp; &nbsp;删除以往的系统更新树<br /> &nbsp; &nbsp;cd /usr/obj<br /> &nbsp; &nbsp;chflags -R noschg *<br /> &nbsp; &nbsp;rm -rf *<br /> &nbsp; &nbsp;cd /usr/src<br /> &nbsp; &nbsp;make cleandir<br /> &nbsp; &nbsp;make cleandir<br /> &nbsp; &nbsp;不错，make cleandir 真的要执行两次。<br /> &nbsp; &nbsp;然后重新开始整个过程，使用 make buildworld 开始。<br /> <br /> &nbsp; &nbsp;mergemaster -p的说明 <br /> &nbsp; &nbsp;mergemaster -p的作用是建立一个临时的根环境，把新的配置文件映射到这个环境当中，<br /> &nbsp; &nbsp;然后和系统的配置文件进行比较和处理，目的是保证系统配置文件的更新，这一点很重要！<br /> &nbsp; &nbsp;在执行"mergemaster -p"的过程中，主要是进行以下处理： <br /> &nbsp; &nbsp;检测系统是否存在临时的根环境，如果存在，让用户选择是利用现有的还是删除它，然后新建！ <br /> &nbsp; &nbsp;*** The directory specified for the temporary root environment, <br /> &nbsp; &nbsp;/var/tmp/temproot, exists. This can be a security risk if untrusted <br /> &nbsp; &nbsp;users have access to the system. <br /> &nbsp; &nbsp;Use 'd' to delete the old /var/tmp/temproot and continue 删除旧的/var/tmp/temproot<br /> &nbsp; &nbsp;Use 't' to select a new temporary root directory 为temproot选择新的目录<br /> &nbsp; &nbsp;Use 'e' to exit mergemaster 退出mergemaster<br /> &nbsp; &nbsp;Default is to use /var/tmp/temproot as is <br /> &nbsp; &nbsp;How should I deal with this? [Use the existing /var/tmp/temproot] <br /> &nbsp; &nbsp;一般的处理是选 "d" ，删除原有的目录，系统开始重新建立这个临时的根环境。<br /> &nbsp; &nbsp;只要进行的不是大跨度的 FreeBSD 版本升级,可以简单地跳过这一步.<br /> <br /> &nbsp; &nbsp;mergemaster的说明 <br /> &nbsp; &nbsp;重新编译整个系统不会使用新的或改过的配置文件更新某些目录(尤其像 /etc,/var和/usr)<br /> &nbsp; &nbsp;更新这些文件最简单的方式就是使用 mergemaster，手工去做也是可以的，只要您愿意。<br /> &nbsp; &nbsp;不管您选择哪一种，一定记得备份/etc 以防出错。<br /> &nbsp; &nbsp;mergemaster操作中可能会遇到以下操作提示: <br /> &nbsp; &nbsp;Use 'd' to delete the temporary 删除文件,不更新相应的系统配置文件 <br /> &nbsp; &nbsp;Use 'i' to install the temporary 安装文件,使用新的配置文件覆盖旧文件 <br /> &nbsp; &nbsp;Use 'm' to merge the temporary and installed versions 对旧的配置文件进行合并处理,并安装<br /> &nbsp; &nbsp;Use 'v' to view the diff results again 察看新文件与旧文件的差异<br /> &nbsp; &nbsp;<br /> &nbsp; &nbsp;###跟踪多台机器,以A.B2个机器为例。A要启动nfs_server,B要启动nfs_client<br /> &nbsp; &nbsp;A:/etc/rc.conf<br /> &nbsp; &nbsp;&nbsp;&nbsp;rpcbind_enable="YES"<br /> &nbsp; &nbsp;&nbsp;&nbsp;nfs_server_enable="YES"<br /> &nbsp; &nbsp;&nbsp;&nbsp;/etc/exports<br /> &nbsp; &nbsp;&nbsp;&nbsp;/usr/src /usr/obj /usr/ports&nbsp;&nbsp;-maproot=0&nbsp;&nbsp;192.168.0.61(B-ip)<br /> &nbsp; &nbsp;B:/etc/rc.conf<br /> &nbsp; &nbsp;&nbsp;&nbsp;nfs_client_enable="YES"<br /> &nbsp; &nbsp;A.cd /usr/src<br /> &nbsp; &nbsp;&nbsp;&nbsp;make -j4 buildworld&nbsp;&nbsp;(编译基本系统)<br /> &nbsp; &nbsp;&nbsp;&nbsp;make buildkernel KERNCONF=TDS&nbsp;&nbsp;(编译新内核)<br /> &nbsp; &nbsp;B。mount b-ip:/usr/src /usr/src<br /> &nbsp; &nbsp;&nbsp; &nbsp;mount b-ip:/usr/obj /usr/obj<br /> &nbsp; &nbsp;&nbsp; &nbsp;cd /usr/src<br /> &nbsp; &nbsp;&nbsp; &nbsp;make installkernel KERNCONF=TDS&nbsp;&nbsp;(安装新内核)<br /> &nbsp; &nbsp;&nbsp; &nbsp;reboot&nbsp;&nbsp;(重新启动)<br /> &nbsp; &nbsp;&nbsp; &nbsp;shutdown now&nbsp;&nbsp;(重启到单用户模式)<br /> &nbsp; &nbsp;&nbsp; &nbsp;cd /usr/src<br /> &nbsp; &nbsp;&nbsp; &nbsp;mergemaster -p&nbsp;&nbsp;(更新/etc目录里的文件,-p预建模式)<br /> &nbsp; &nbsp;&nbsp; &nbsp;make installworld&nbsp;&nbsp;(安装新的二进制)<br /> &nbsp; &nbsp;&nbsp; &nbsp;mergemaster -U&nbsp;&nbsp;(更新makeinstallworld不更新的文件,-U進了6-STABLE了,這功能很讚，<br /> <br /> 69.freebsd上下的jdk的安装方法(FreeBSD基金会提供的diablo-jdk)<br /> &nbsp; &nbsp;cd /usr/ports/java/diablo-jdk15<br /> &nbsp; &nbsp;最好是通过port的diablo-jdk安装，而不是直接pkg_add，因为后者可能会出现依赖关系不对的问题。<br /> &nbsp; &nbsp;JDK与JRE的关系<br /> &nbsp; &nbsp;JAVA DEVELOPMENT KIT 与JAVA RUNTIME ENVIROMENT之间是什么关系？<br /> &nbsp; &nbsp;JRE只是Java的运行环境，而JDK是Java的开发、运行和调试一体的环境。<br /> &nbsp; &nbsp;<br /> &nbsp; &nbsp;JAVA环境变量的设置<br /> &nbsp; &nbsp;csh 就在/etc/csh.cshrc <br /> &nbsp; &nbsp;setenv JAVA_HOME /usr/local/diablo-jdk1.5.0 <br /> &nbsp; &nbsp;setenv CLASS_PATH .:/usr/local/diablo-jdk1.5.0/lib/dt.jar <br /> &nbsp; &nbsp;bash就在/etc/profile<br /> &nbsp; &nbsp;export JAVA_HOME=/usr/local/diablo-jdk1.5.0 <br /> &nbsp; &nbsp;#export CATALINA_HOME=/usr/local/jakarta-tomcat5 <br /> &nbsp; &nbsp;export CLASSPATH=.JAVA_HOME/jre/lib/rt.jarJAVA_HOME/lib/dt.jarJAVA_HOME/lib/tools.jar <br /> &nbsp; &nbsp;<br /> 70.查找最快的cvsup站点<br /> &nbsp; &nbsp;cd /usr/ports/sysutils/fastest-cvsup<br /> &nbsp; &nbsp;make install clean<br /> &nbsp; &nbsp;fastest-cvsup -c jp,cn,hk,us<br /> <br /> 71.chmod 命令概解：chmod命令用于改变文件的运行级别(读=4写=2执行=1)<br /> &nbsp; &nbsp;chmod 400 files 给某文件以只读权限<br /> &nbsp; &nbsp;chmod 600 files 给某文件以只读、写权限<br /> &nbsp; &nbsp;chmod 700 files 给某文件以只读、写、执行权限<br /> &nbsp; &nbsp;chmod -R 400 directory 改变某目录下所有文件的运行权限为只读权限<br /> &nbsp; &nbsp;chmod -R 600 directory 改变某目录下所有文件的运行权限为以只读、写权限<br /> &nbsp; &nbsp;chmod -R 700 directory 改变某目录下所有文件的运行权限为只读、写、执行权限<br /> <br /> 72.chown概解：改变文件及文件夹的用户所属<br /> &nbsp; &nbsp;chown root:wheel files 改变文件的用户为root用户组为wheel组<br /> &nbsp; &nbsp;chown -R root:wheel directory 改变目录的用户为root用户组为wheel组<br /> <br /> 73.crontab 指令語法<br /> &nbsp; &nbsp;crontab [ -u user ] file <br /> &nbsp; &nbsp;crontab [ -u user ] { -l | -r | -e }<br /> &nbsp; &nbsp;crontab 提供我们在固定的间隔时间执行自订的程序、系统指令或 shell secrip。时间间隔的单位可以是分钟、<br /> &nbsp; &nbsp;小时、日、周、月及以上的任意组合。允许使用者离线执行，并且可以将执行结果以 email 通知使用者。因此，<br /> &nbsp; &nbsp;非常设合对周期性的管理分析或数据备份等工作。<br /> &nbsp; &nbsp;基本上，crontab 的指令格式分为六个部分，前五个为时间间隔，最后则是执行的指令。每一个部分用空格来区隔。<br /> &nbsp; &nbsp;crontab -e : 执行文字编辑器来设定时程表，内定的文字编辑器是 VI，如果你想用别的文字编辑器，则请先设定 <br /> &nbsp; &nbsp;VISUAL 环境变数来指定使用那个文字编辑器(比如说 setenv VISUAL joe) <br /> &nbsp; &nbsp;crontab -r : 删除目前的时程表 <br /> &nbsp; &nbsp;crontab -l : 列出目前的时程表 <br /> &nbsp; &nbsp;crontab file [-u user]-用指定的文件替代目前的crontab。<br /> &nbsp; &nbsp;时程表的格式如下:<br /> &nbsp; &nbsp;<br /> &nbsp; &nbsp;f1 f2 f3 f4 f5&nbsp; &nbsp;&nbsp;&nbsp;program <br /> &nbsp; &nbsp;分 时 天 月 星期几 要执行的程序<br /> &nbsp; &nbsp;<br /> &nbsp; &nbsp;当 f1 为 * 时表示每分钟都要执行 program，f2 为 * 时表示每小时都要执行程序，其馀类推 <br /> &nbsp; &nbsp;当 f1 为 a-b 时表示从第 a 分钟到第 b 分钟这段时间内要执行，f2 为 a-b 时表示从第 a 到第 b 小时都要执行，其馀类推 <br /> &nbsp; &nbsp;当 f1 为 */n 时表示每 n 分钟个时间间隔执行一次，f2 为 */n 表示每 n 小时个时间间隔执行一次，其馀类推 <br /> &nbsp; &nbsp;当 f1 为 a, b, c,... 时表示第 a, b, c,... 分钟要执行，f2 为 a, b, c,... 时表示第 a, b, c...个小时要执行，其馀类推 <br /> &nbsp; &nbsp;使用者也可以将所有的设定先存放在档案 file 中，用 crontab file 的方式来设定时程表。 <br /> &nbsp; &nbsp;先前曾提到，crontab 的格式分成六个部分，前五个是时间参数。在上例中你会发现除了数字与英文名称，<br /> &nbsp; &nbsp;有使用到符号"*"，这个符号代表每一单位的意思，譬如30 3 * * *既代表30分3点每日每月星期的每天。<br /> &nbsp; &nbsp;时间的指定，可以是单一的数字，或几个数字用逗号来连接。看下例<br /> &nbsp; &nbsp;30 3,12 * * * /root/fbin/bak-web <br /> &nbsp; &nbsp;其中的第二项为 3,12，这代表 3 以及 12 小时的意思。再来看下例<br /> &nbsp; &nbsp;30 */6 * * * /root/fbin/bak-web <br /> &nbsp; &nbsp;我把第二项改成 */6 这代表每 6 小时，也相当于 6,12,18,24 的作用。此外还有一个区段的做法<br /> &nbsp; &nbsp;30 8-18/2 * * * /root/fbin/bak-web <br /> &nbsp; &nbsp;我把第二项改成 8-18/2 这代表在 8 小时到 18 小时之间每 2 小时，也相当于 8,10,12,14,16,18 的作用<br /> <br /> 74.使用portsnap更新系统ports<br /> &nbsp; &nbsp;portsnap从6.0开始引进系统，给与用户方便的更新系统ports <br /> &nbsp; &nbsp;portsnap的命令比较少,fetch 获取数据,extract 释放全部ports,update 更新ports <br /> &nbsp; &nbsp;第一次使用可以portsnap fetch extract,以后使用可以portsnap fetch update <br /> &nbsp; &nbsp;国内镜像站<br /> &nbsp; &nbsp;portsnap.hshh.org <br /> &nbsp; &nbsp;portsnap2.hshh.org <br /> &nbsp; &nbsp;portsnap3.hshh.org (网通) <br /> &nbsp; &nbsp;使用方法: <br /> &nbsp; &nbsp;/etc/portsnap.conf 里面更改 <br /> &nbsp; &nbsp;SERVERNAME=portsnap.hshh.org <br /> &nbsp; &nbsp;使用portupgrade 更新已安装的软件<br /> <br /> 75.清屏<br /> &nbsp; &nbsp;clear或ctrl+L<br /> 76.freebsd 怎么安装GF4 MX 440的显卡<br /> &nbsp; &nbsp;首先更新ports和src，到/usr/ports/x11/nvidia-driver下make install clean，要選中linux的支持。<br /> &nbsp; &nbsp;然后到/usr/ports/x11/nvidia-xconfig下make install clean，還可以到/usr/ports/x11/nvidia-settings下安裝控制面板。<br /> &nbsp; &nbsp;運行nvidia-xconfig會自動生成xorg.conf文件，然后根据需要自行更改。<br /> <br /> 77.如何知道一个文件属于哪个port，比如libplds4.so.1<br /> &nbsp; &nbsp;pkg_info -W filename<br /> <br /> 78.mplayer<br /> &nbsp; &nbsp;cd /usr/ports/multimedia/mplayer<br /> &nbsp; &nbsp;make install clean<br /> &nbsp; &nbsp;问题：如何让mplayer支持srt格式的字幕？<br /> &nbsp; &nbsp;解答：首先复制一个中文ttf字体文件到 ~/.mplayer/ 目录下，并改名为 subfont.ttf ；然后在gmplayer的选项<br /> &nbsp; &nbsp;(Preferences)-&gt;Subtitle &amp; OSD 中将 Encoding 项选为&#8220;Simplified Chinese charset (CP936)&#8221;。如果你还<br /> &nbsp; &nbsp;使用命令行播放电影，还需要在 ~/.mplayer/config 文件中加上这么一行：subcp=cp936 。如果仍然不能<br /> &nbsp; &nbsp;显示字幕，请看看字幕文件名和电影文件名是否相配：如果avi文件是movie.avi的话，字幕文件名应该是movie.srt。<br /> &nbsp; &nbsp;问题：怎么mplayer不能显示.idx+.rar格式的字幕？<br /> &nbsp; &nbsp;解答：先将rar文件中的sub文件解压出来 。<br /> &nbsp; &nbsp;问题：如何让mplayer的播放窗口保持在最前面？<br /> &nbsp; &nbsp;解答：修改 ~/.mplayer/config 文件，加上这么一行：ontop=yes 。<br /> &nbsp; &nbsp;问题：如何让mplayer的画面随窗口大小自动缩放呢？<br /> &nbsp; &nbsp;解答：修改 ~/.mplayer/config 文件，加上这么一行：zoom=yes。<br /> &nbsp; &nbsp;测试通过by tds 061119。fb61+xorg6.9+xfce4+gmplayer<br /> <br /> 79.设置控制台高分辩率<br /> &nbsp; &nbsp;1.在内核配制文件里加入下面的编译内核<br /> &nbsp; &nbsp;&nbsp;&nbsp;options&nbsp; &nbsp;&nbsp; &nbsp;VESA <br /> &nbsp; &nbsp;&nbsp;&nbsp;options&nbsp; &nbsp;&nbsp; &nbsp;SC_PIXEL_MODE<br /> &nbsp; &nbsp;第一行选项让內核支持VESA 2，第二行让内核支持控制台图形模式。<br /> &nbsp; &nbsp;2.vidcontrol -i mode 查询出所有模式<br /> &nbsp; &nbsp;&nbsp;&nbsp;......<br /> &nbsp; &nbsp;&nbsp;&nbsp;279 (0x117) 0x0000000f G 1024x768x16 1&nbsp; &nbsp;8x16&nbsp;&nbsp;0xa0000 64k 64k 0xd8000000 65536k <br /> &nbsp; &nbsp;&nbsp;&nbsp;280 (0x11 0x0000000f G 1024x768x32 1&nbsp; &nbsp;8x16&nbsp;&nbsp;0xa0000 64k 64k 0xd8000000 65536k <br /> &nbsp; &nbsp;&nbsp;&nbsp;......<br /> &nbsp; &nbsp;3.测试模式<br /> &nbsp; &nbsp;&nbsp;&nbsp;vidcontrol MODE_280<br /> &nbsp; &nbsp;4.vi /etc/rc.conf加入下面这条 <br /> &nbsp; &nbsp;&nbsp;&nbsp;allscreens_flags="MODE_280"<br /> &nbsp; &nbsp;5.把console改成黑底绿字的<br /> &nbsp; &nbsp;&nbsp;&nbsp;vidcontrol green<br /> <br /> 80.设置FreeBSD console下的字体大小<br /> &nbsp; &nbsp;vidcontrol -f ...<br /> <br /> 81.锁住终端<br /> &nbsp; &nbsp;lock -np<br /> &nbsp; &nbsp;-n 永不超时,-p 使用系统密码作为开启终端的密匙<br /> <br /> 82.刻录CD ISO映像文件<br /> &nbsp; &nbsp;burncd -f /dev/acd0 -s max data imagefile.iso fixate<br /> &nbsp; &nbsp;刻录一个文件到CD上而不创建ISO9660文件系统<br /> &nbsp; &nbsp;burncd -f /dev/acd1 -s 12 data archive.tar.gz fixate<br /> &nbsp; &nbsp;生成ISO文件<br /> &nbsp; &nbsp;mkisofs -o imagefile.iso /path/to/tree<br /> &nbsp; &nbsp;把数据CD复制成一个与之等价的镜像文件<br /> &nbsp; &nbsp;dd if=/dev/acd0 of=file.iso bs=2048<br /> <br /> 83.类似flashget的东东download for X，d4x<br /> &nbsp; &nbsp;/usr/ports/ftp/downloader<br /> <br /> 84.使用watch监视终端<br /> &nbsp; &nbsp;1.编辑核心加入pseudo-device snp或者kldload snp<br /> &nbsp; &nbsp;2.cd /dev&nbsp;&nbsp;./MAKEDEV snp0 snp1<br /> &nbsp; &nbsp;3.watch ttyp1<br /> &nbsp; &nbsp;去换终端ctrl-x<br /> &nbsp; &nbsp;退出watch ctrl-g<br /> <br /> 85.kldload xxx 加载xxx模块<br /> &nbsp; &nbsp;kldstat 查看已加载的模块<br /> &nbsp; &nbsp;kldunload xxx 从核心中移除<br /> <br /> 86.让程序读取新的配置文件<br /> &nbsp; &nbsp;kill -HUP 199&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;(进称号)<br /> &nbsp; &nbsp;killall -HUP sshd&nbsp; &nbsp; (进程名)<br /> &nbsp; &nbsp;上述指令中的参数 -HUP 也可以使用 -1 来取代<br /> <br /> 87.登入后的讯息Message Of The Day(motd)<br /> &nbsp; &nbsp;编辑 /etc/motd 来制作自己的画面<br /> &nbsp; &nbsp;登入前的讯息<br /> &nbsp; &nbsp;修改 /etc/gettytab 及 /etc/issue<br /> &nbsp; &nbsp;编辑 /etc/gettytab，找到 default的地方。<br /> &nbsp; &nbsp;default:\:cb:ce:ck:lc:fd#1000:im=\r\n%s/%m (%h) (%t)\r\n\r\n:sp#1200:\<br /> &nbsp; &nbsp;:if=/etc/issue:<br /> &nbsp; &nbsp;其中的%s %m %h %t分别对应到FreeBSD i386 example.com ttyp0，如果你不想显示FreeBSD，<br /> &nbsp; &nbsp;就把%s拿掉。最后一行if=/etc/issue就是表如果没有issue这个档的话，就执行default。<br /> <br /> 88.变更自己所使用的Shell<br /> &nbsp; &nbsp;chsh -s /bin/tcsh<br /> &nbsp; &nbsp;上述指令将Shell变更成/bin/tcsh。注意!输入的shell名称一定要存在于/etc/shells中<br /> <br /> 89.Shell 的环境变量<br /> &nbsp; &nbsp;tcsh可以使用setenv看目前所有的环境变量，也可以使用setenv来改变一个环境变量的值<br /> &nbsp; &nbsp;setenv EDITOR ee<br /> &nbsp; &nbsp;如果您使用的是 Bourne Shell：<br /> &nbsp; &nbsp;export EDITOR="ee"<br /> <br /> 90./etc/master.passwd 介绍<br /> &nbsp; &nbsp;FreeBSD使用shadow password的方式来保护密码文件，只有root才可以读取编码后的密码文件<br /> &nbsp; &nbsp;/etc/master.passwd。但是这并不是系统用来验证的档案，为了加快速度，FreeBSD将该文件<br /> &nbsp; &nbsp;做成数据库/etc/spwd.db及/etc/pwd.db，因此在修改完master.passwd后，必须使用指令<br /> &nbsp; &nbsp;pwd_mkdb来将master.passwd做成数据库档案。不过一般而言，我会使用vipw这个指令来修改<br /> &nbsp; &nbsp;master.passwd，vipw会先将master.passwd以预设的文书编辑软件打开，修改完存盘后，<br /> &nbsp; &nbsp;它会视需要自动更新数据库。<br /> &nbsp; &nbsp;pwd_mkdb -p -d /etc /etc/master.passwd<br /> &nbsp; &nbsp;master.passwd这个档案内容中，每个使用者都是独立的一行，每个字段使用冒号分开，格式是：<br /> &nbsp; &nbsp;name:password:UID:GID:class:change:expire:fullname:home:shell<br /> &nbsp; &nbsp;pwd_mkdb介绍<br /> &nbsp; &nbsp;如果我们直接以文书编辑软件来修改/etc/master.passwd，在修改完后，必须执行pwd_mkdb<br /> &nbsp; &nbsp;来将更新的数据做成系统可以读取的数据库文件。pwd_mkdb还会自动建立/etc/passwd。<br /> <br /> 91.将使用者目录拥有者更改为所属的使用者<br /> &nbsp; &nbsp;chown -R user:group /home/user<br /> &nbsp; &nbsp;使用参数-R将目录user及其下所有档案及子目录的拥有人改变成user<br /> <br /> 92.记录使用者指令<br /> &nbsp; &nbsp;修改 /etc/rc.conf，加上下列一行设定：<br /> &nbsp; &nbsp;accounting_enable="YES"<br /> &nbsp; &nbsp;系统会将使用者的历程记录在/var/account/acct*中，最新的记录是acct<br /> &nbsp; &nbsp;当下达指令lastcomm时，则系统会以/var/account/acct为参考，印出所记录的数据。<br /> &nbsp; &nbsp;也可以使用lastcomm -f acct1来查看前一天的资料。<br /> <br /> 93.sudo<br /> &nbsp; &nbsp;如果你希望它能将执行sudo的log记下来的话，必须先编辑/usr/ports/security/sudo/Makefile，<br /> &nbsp; &nbsp;将CONFIGURE_ARGS中的参数 --disable-log-wrap 拿掉。 <br /> &nbsp; &nbsp;cd /usr/ports/security/sudo<br /> &nbsp; &nbsp;make install clean<br /> &nbsp; &nbsp;安装完后，我们要先执行/usr/local/sbin/visudo以设定sudo的设定档(/usr/loca/etc/sudoers)<br /> &nbsp; &nbsp;设定完后，使用者即可执行sudo &lt;允许的指令&gt;，使用者只要输入自己的密码即可，不必知道root密码，<br /> &nbsp; &nbsp;而且5分钟内再次执行sudo时不需再输入密码。如果你有打开log记录功能，sudo执行成功或失败的log<br /> &nbsp; &nbsp;都将被记录到/var/log/sudo.log中。<br /> <br /> 94./usr/ports/dns/ddclient动态dns更新软件<br /> <br /> 95.SCSI工具camcontrol<br /> &nbsp; &nbsp;camcontrol devlist 查看目前所有USB装置<br /> &nbsp; &nbsp;ATA工具<br /> &nbsp; &nbsp;atacontrol list 查看目前所有ATA装置<br /> <br /> 96.如果我们只知道一个关键词，却不知要使用哪一个指令，我们可以使用参数k来查询。<br /> &nbsp; &nbsp;例如我们要查询 firewall 相关的指令：man -k firewall<br /> <br /> 97.bg<br /> &nbsp; &nbsp;将指定的程序放入背景中执行。当我们下达一个指令后，必须要等待该程序结束后才能输入下一个命令。<br /> &nbsp; &nbsp;如果该程序必须执行一段很长的时间，我们不想等程序结束，可以把它放到背景中执行。在下达指令后，<br /> &nbsp; &nbsp;按 Ctrl+Z 来暂停程序，接着再执行 bg 即可将程序放到背景中执行。<br /> &nbsp; &nbsp;$ sleep 1000<br /> &nbsp; &nbsp;^Z<br /> &nbsp; &nbsp;Suspended<br /> &nbsp; &nbsp;$ bg<br /> &nbsp; &nbsp;[1] sleep 1000 &amp;<br /> &nbsp; &nbsp;我们也可以在所要执行的指令后面加上符号 "&amp;"，就可以将该程序放到背景执行：<br /> &nbsp; &nbsp;$ sleep 1000 &amp;<br /> &nbsp; &nbsp;[2] 46461<br /> <br /> 98.jobs<br /> &nbsp; &nbsp;jobs 指令可以让我们查询目前有哪些程序在背景执行。如果加入参数 -l 可以得到 PID 的信息。<br /> &nbsp; &nbsp;jobs -l<br /> &nbsp; &nbsp;[1] + 46459 Running sleep 1000<br /> &nbsp; &nbsp;[2] - 46461 Running sleep 1500<br /> <br /> 99.fg<br /> &nbsp; &nbsp;将指定的程序放到前景中执行。我们使用jobs看到目前在背景执行的程序之后，可以使用fg把它叫回前景。<br /> &nbsp; &nbsp;例如要叫回第一个在背景中执行的程序：<br /> &nbsp; &nbsp;fg %1<br /> &nbsp; &nbsp;sleep 1000<br /> <br /> 100.sync<br /> &nbsp; &nbsp; 让系统暂存的数据强制存回硬盘<br /> <br /> 101.cp -Rp sourdir tardir<br /> &nbsp; &nbsp; -R完成递归复制(即可以复制目录以下的所有内容)，-p保留文件的时间、所属等等<br /> <br /> 102.ssh username@hostname<br /> &nbsp; &nbsp; 从远程拷贝 scp user@host:/path/to/files local_file_name <br /> &nbsp; &nbsp; 拷贝到远程 scp local_file_name user@host:/path/to/files <br /> <br /> 103.使用Portaudit监视第三方安全问题<br /> &nbsp; &nbsp; cd /usr/ports/security/portaudit &amp;&amp; make install clean<br /> &nbsp; &nbsp; 安装完成之后更新数据库<br /> &nbsp; &nbsp; portaudit -Fda<br /> &nbsp; &nbsp; 使用下面的命令对通过Ports Collection安装的第三方软件工具进行审计<br /> &nbsp; &nbsp; portaudit -a<br /> <br /> 104.我要怎么从 X 切换到 virtual consoles？<br /> &nbsp; &nbsp; 请用Ctrl+Alt+Fn以切回至console。Ctrl+Alt+F1可以切回至第一个console。<br /> &nbsp; &nbsp; 当你切回至文字console后，你就可以使用一般的Alt+Fn组合键在各console之间切换了。<br /> &nbsp; &nbsp; 要回到X的话，你就可以使用Alt+F9以返回至X中。<br /> <br /> 105.FB下Free的杀毒软件<br /> &nbsp; &nbsp; clamav (security/clamav)<br /> &nbsp; &nbsp; man clamscan 扫描 <br /> &nbsp; &nbsp; man freshclam 更新病毒库 <br /> &nbsp; &nbsp; man clamd <br /> &nbsp; &nbsp; man clamdscan <br /> &nbsp; &nbsp; man sigtool <br /> &nbsp; &nbsp; 配置文件 <br /> &nbsp; &nbsp; /use/local/etc/freshclam.conf <br /> &nbsp; &nbsp; /usr/local/etc/clamd.conf <br /> &nbsp; &nbsp; 把conf里的#Example去掉 <br /> &nbsp; &nbsp; # Comment or remove the line below. <br /> &nbsp; &nbsp; #Example <br /> &nbsp; &nbsp; /etc/rc.conf加入 <br /> &nbsp; &nbsp; clamav_clamd_enable="YES" <br /> &nbsp; &nbsp; clamav_freshclam_enable="YES"<br /> <br /> 106.软件默认配置示例文件的一般存放位置<br /> &nbsp; &nbsp; /usr/share/examples<br /> &nbsp; &nbsp; /usr/local/share/examples<br /> <br /> 107.安装文泉驿字体<br /> &nbsp; &nbsp; cd /usr/ports/x11-fonts/wqy/<br /> &nbsp; &nbsp; make install clean<br /> <br /> 108.把/data/tftp打包成pxeinstfb62.tgz<br /> &nbsp; &nbsp; cd /data/<br /> &nbsp; &nbsp; tar zcvf pxeinstfb62.tgz tftp<br /> &nbsp; &nbsp; 解压<br /> &nbsp; &nbsp; tar zxvf pxeinstfb62.tgz<br /> <br /> 109.ports下有没有xxx这个软件？在哪个目录下？ <br /> &nbsp; &nbsp; 回答：有两种办法来查找，一是通过软件名：<br /> &nbsp; &nbsp; make fetchindex<br /> &nbsp; &nbsp; cd /usr/ports<br /> &nbsp; &nbsp; make search name=xxx | grep ^Path<br /> &nbsp; &nbsp; 另一种是通过关键字，也就是在软件名和说明中只要包括这个单词的都会查找出来：<br /> &nbsp; &nbsp; cd /usr/ports<br /> &nbsp; &nbsp; make search key=xxx | grep ^Path<br /> <br /> 110.FreeBSD如何获得硬件信息?<br /> &nbsp; &nbsp; sysctl -a | grep "^dev\."<br /> &nbsp; &nbsp; pciconf -lv<img src ="http://www.blogjava.net/linuxmouse/aggbug/365839.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/linuxmouse/" target="_blank">Linuxmouse</a> 2011-12-08 10:34 <a href="http://www.blogjava.net/linuxmouse/archive/2011/12/08/365839.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[转]shell编程的标准条件语句</title><link>http://www.blogjava.net/linuxmouse/archive/2011/09/14/358595.html</link><dc:creator>Linuxmouse</dc:creator><author>Linuxmouse</author><pubDate>Wed, 14 Sep 2011 04:53:00 GMT</pubDate><guid>http://www.blogjava.net/linuxmouse/archive/2011/09/14/358595.html</guid><wfw:comment>http://www.blogjava.net/linuxmouse/comments/358595.html</wfw:comment><comments>http://www.blogjava.net/linuxmouse/archive/2011/09/14/358595.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/linuxmouse/comments/commentRss/358595.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/linuxmouse/services/trackbacks/358595.html</trackback:ping><description><![CDATA[<span href="http://bbs.chinaunix.net/tag.php?name=shell">shell</span><span href="http://bbs.chinaunix.net/tag.php?name=%B1%E0%B3%CC">编程</span>的标准条件语句<br />
是这样的:<br />
<div style="background-color: #eeeeee; font-size: 13px; border: 1px solid #cccccc; padding: 4px 5px 4px 4px; width: 98%;"><!--<br />
<br />
Code highlighting produced by Actipro CodeHighlighter (freeware)<br />
http://www.CodeHighlighter.com/<br />
<br />
--><span style="color: #0000FF; ">if</span><span style="color: #000000; ">&nbsp;test&nbsp;</span><span style="color: #800000; ">"</span><span style="color: #800000; ">$1</span><span style="color: #800000; ">"</span><span style="color: #000000; ">&nbsp;</span><span style="color: #000000; ">=</span><span style="color: #000000; ">&nbsp;pogge<br />
then<br />
&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #800000; ">"</span><span style="color: #800000; ">Do&nbsp;you&nbsp;Like&nbsp;Sacred?</span><span style="color: #800000; ">"</span><span style="color: #000000;"><br />
fi<br />
</span></div>
<div>&nbsp;很简单,但是你了解其中的机制吗?<br /> <br /> 1.在shell中每运行完一条命令,都会返回一个exit status值(有0和非0两种)<br /> 一般而言0表示运行成功,非0表示未成功运行<br /> 这个值存放在$?这个变量中;<br /> 你可以运行下面的命令试试:<br /><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #000000; ">ls<br />echo&nbsp;$?<br />ls&nbsp;</span><span style="color: #000000; ">0000</span><span style="color: #000000; "><br />echo&nbsp;$?<br />echo&nbsp;$?<br /></span></div><div>2.if是一个命令<br /> 当它后面的一条命令执行完毕后<br /> 它会查看$?的值(也就是刚执行完的命令的exit status值);<br /> 如果是0,则执行then语句段<br /> 否则跳过<br /> <br /> 3.test是一个命令<br /> 多数情况下它接收三个参数,上面的"$user", =, pogge分别是它的三个参数,<br /> 这正是"user", =, pogge 之间必须要用空格分开的原因<br /> test会把这三个参数组成表达式,然后如果表达式返回值是真,<br /> 那么test命令的exit status为0<br /> 否则test命令的exit status为非0<br /> 你可以运行下面的命令试试: </div><br /><div style="background-color: #eeeeee; font-size: 13px; border: 1px solid #cccccc; padding: 4px 5px 4px 4px; width: 98%;"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #000000; ">test&nbsp;pogge&nbsp;</span><span style="color: #000000; ">=</span><span style="color: #000000; ">&nbsp;pogge<br />echo&nbsp;$?<br />test&nbsp;pogge&nbsp;</span><span style="color: #000000; ">=</span><span style="color: #000000;">&nbsp;dynos<br />echo&nbsp;$?</span></div><div>综上,你完全可以写出并理解下面语句的含义:</div><br /><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #0000FF; ">if</span><span style="color: #000000; ">&nbsp;who&nbsp;</span><span style="color: #000000; ">|</span><span style="color: #000000; ">&nbsp;grep&nbsp;</span><span style="color: #800000; ">"</span><span style="color: #800000; ">pogge</span><span style="color: #800000; ">"</span><span style="color: #000000; ">&nbsp;</span><span style="color: #000000; ">&gt;</span><span style="color: #000000; ">&nbsp;</span><span style="color: #000000; ">/</span><span style="color: #000000; ">dev</span><span style="color: #000000; ">/</span><span style="color: #000000; ">null<br />then<br />&nbsp;&nbsp;echo&nbsp;</span><span style="color: #800000; ">"</span><span style="color: #800000; ">pogge&nbsp;logged</span><span style="color: #800000; ">"</span><span style="color: #000000; "><br />fi</span></div></div><img src ="http://www.blogjava.net/linuxmouse/aggbug/358595.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/linuxmouse/" target="_blank">Linuxmouse</a> 2011-09-14 12:53 <a href="http://www.blogjava.net/linuxmouse/archive/2011/09/14/358595.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>