<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Becomin&#039; Charles &#187; Linux</title>
	<atom:link href="http://sexywp.com/cata/something-about-daily-work/linux/feed" rel="self" type="application/rss+xml" />
	<link>http://sexywp.com</link>
	<description>Building another myself~~</description>
	<lastBuildDate>Fri, 27 Jan 2012 16:00:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>如何配置RHEL的iptables开放端口</title>
		<link>http://sexywp.com/%e5%a6%82%e4%bd%95%e9%85%8d%e7%bd%aerhel%e7%9a%84iptables%e5%bc%80%e6%94%be%e7%ab%af%e5%8f%a3.htm</link>
		<comments>http://sexywp.com/%e5%a6%82%e4%bd%95%e9%85%8d%e7%bd%aerhel%e7%9a%84iptables%e5%bc%80%e6%94%be%e7%ab%af%e5%8f%a3.htm#comments</comments>
		<pubDate>Sun, 02 Oct 2011 03:53:47 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[ftp]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[rhel]]></category>

		<guid isPermaLink="false">http://sexywp.com/?p=460</guid>
		<description><![CDATA[要给一个朋友的服务器上架设ftp，一看，这哥们的服务器装的是RHEL AS4，看到这个发行版的名字，我就发怵了，果不其然，么有包管理器，我简直寸步难行，什么软件都没法装，各种依赖，太难解决了！！

看了一下已经安装的软件列表，发现已经装了vsftpd，就用这个吧，man了半天，最后配好了，但是一连，发现死活连不上，百思不得其解，各种google，各种百度，也不知道过了多少天，才发现问题的症结在iptables，原来，要使用passive mode登陆ftp，必须开一个范围的端口，而系统默认的iptables规则，不允许对这些端口的访问，导致ftp连不上。怎么开放iptables的端口呢？又是各种google，各种百度，搜到一个iptables的tutorial，竟然有290页之厚，太难用了。

<span class="readmore"><a href="http://sexywp.com/%e5%a6%82%e4%bd%95%e9%85%8d%e7%bd%aerhel%e7%9a%84iptables%e5%bc%80%e6%94%be%e7%ab%af%e5%8f%a3.htm" title="如何配置RHEL的iptables开放端口">Keep Reading --- 568 words totally</a></span><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Flinux-commands-used-when-working.htm&from=http%3A%2F%2Fsexywp.com%2F%25E5%25A6%2582%25E4%25BD%2595%25E9%2585%258D%25E7%25BD%25AErhel%25E7%259A%2584iptables%25E5%25BC%2580%25E6%2594%25BE%25E7%25AB%25AF%25E5%258F%25A3.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">工作中常用的Linux命令集锦</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fmac-os-x-ssh-key-pair-login-linux.htm&from=http%3A%2F%2Fsexywp.com%2F%25E5%25A6%2582%25E4%25BD%2595%25E9%2585%258D%25E7%25BD%25AErhel%25E7%259A%2584iptables%25E5%25BC%2580%25E6%2594%25BE%25E7%25AB%25AF%25E5%258F%25A3.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Mac OS X上如何实现到Linux主机的ssh免登陆</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fuse-ftp-in-netbeans.htm&from=http%3A%2F%2Fsexywp.com%2F%25E5%25A6%2582%25E4%25BD%2595%25E9%2585%258D%25E7%25BD%25AErhel%25E7%259A%2584iptables%25E5%25BC%2580%25E6%2594%25BE%25E7%25AB%25AF%25E5%258F%25A3.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">[WP开发环境]在NetBeans中配置FTP</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Flet-php5-support-readline.htm&from=http%3A%2F%2Fsexywp.com%2F%25E5%25A6%2582%25E4%25BD%2595%25E9%2585%258D%25E7%25BD%25AErhel%25E7%259A%2584iptables%25E5%25BC%2580%25E6%2594%25BE%25E7%25AB%25AF%25E5%258F%25A3.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Dedian 5的PHP包缺少readline支持</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fwhy-python-code-mess.htm&from=http%3A%2F%2Fsexywp.com%2F%25E5%25A6%2582%25E4%25BD%2595%25E9%2585%258D%25E7%25BD%25AErhel%25E7%259A%2584iptables%25E5%25BC%2580%25E6%2594%25BE%25E7%25AB%25AF%25E5%258F%25A3.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">怎么觉得Python这么混乱呢</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>要给一个朋友的服务器上架设ftp，一看，这哥们的服务器装的是RHEL AS4，看到这个发行版的名字，我就发怵了，果不其然，么有包管理器，我简直寸步难行，什么软件都没法装，各种依赖，太难解决了！！</p>
<p>看了一下已经安装的软件列表，发现已经装了vsftpd，就用这个吧，man了半天，最后配好了，但是一连，发现死活连不上，百思不得其解，各种google，各种百度，也不知道过了多少天，才发现问题的症结在iptables，原来，要使用passive mode登陆ftp，必须开一个范围的端口，而系统默认的iptables规则，不允许对这些端口的访问，导致ftp连不上。怎么开放iptables的端口呢？又是各种google，各种百度，搜到一个iptables的tutorial，竟然有290页之厚，太难用了。</p>
<p>几经周折又找到了一个图形化系统界面可以配置防火墙规则的，system-config-securitylevel-tui，通过这个东西，很容易就可以开放一个端口，但是这个东西也有问题，我要开10000号段的端口100个，就麻烦了，虽然网上说，用格式形如10000-10100:tcp这样的写法可以开放一个系列的端口，但是实际上，这么写是不管事的，也不知道是不是软件的版本的问题。</p>
<p>最后，知道这个ui界面生成的规则被写到了/etc/sysconfig/iptables文件里面，然后又看了一下man，研究了一下如果手动配置规则的话，端口范围的写法（--dport 10000:10100），先用ui工具生成一条一个端口的规则，然后手动改文件，将端口改成范围，一重启，发现终于一切都按照预期的搞定了，真是累死我了。</p>
<p>在RHEL下面，启动，重启，关闭，查询iptables状态的方法：</p>
<p><a href="http://sexywp.com/tags/usage" class="st_tag internal_tag" rel="tag" title="标签 usage 下的日志">Usage</a>: /etc/init.d/<a href="http://sexywp.com/tags/iptables" class="st_tag internal_tag" rel="tag" title="标签 iptables 下的日志">iptables</a> {start|stop|restart|condrestart|status|panic|save}</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Flinux-commands-used-when-working.htm&from=http%3A%2F%2Fsexywp.com%2F%25E5%25A6%2582%25E4%25BD%2595%25E9%2585%258D%25E7%25BD%25AErhel%25E7%259A%2584iptables%25E5%25BC%2580%25E6%2594%25BE%25E7%25AB%25AF%25E5%258F%25A3.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">工作中常用的Linux命令集锦</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fmac-os-x-ssh-key-pair-login-linux.htm&from=http%3A%2F%2Fsexywp.com%2F%25E5%25A6%2582%25E4%25BD%2595%25E9%2585%258D%25E7%25BD%25AErhel%25E7%259A%2584iptables%25E5%25BC%2580%25E6%2594%25BE%25E7%25AB%25AF%25E5%258F%25A3.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Mac OS X上如何实现到Linux主机的ssh免登陆</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fuse-ftp-in-netbeans.htm&from=http%3A%2F%2Fsexywp.com%2F%25E5%25A6%2582%25E4%25BD%2595%25E9%2585%258D%25E7%25BD%25AErhel%25E7%259A%2584iptables%25E5%25BC%2580%25E6%2594%25BE%25E7%25AB%25AF%25E5%258F%25A3.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">[WP开发环境]在NetBeans中配置FTP</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Flet-php5-support-readline.htm&from=http%3A%2F%2Fsexywp.com%2F%25E5%25A6%2582%25E4%25BD%2595%25E9%2585%258D%25E7%25BD%25AErhel%25E7%259A%2584iptables%25E5%25BC%2580%25E6%2594%25BE%25E7%25AB%25AF%25E5%258F%25A3.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Dedian 5的PHP包缺少readline支持</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fwhy-python-code-mess.htm&from=http%3A%2F%2Fsexywp.com%2F%25E5%25A6%2582%25E4%25BD%2595%25E9%2585%258D%25E7%25BD%25AErhel%25E7%259A%2584iptables%25E5%25BC%2580%25E6%2594%25BE%25E7%25AB%25AF%25E5%258F%25A3.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">怎么觉得Python这么混乱呢</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
	标签：<a href="http://sexywp.com/tags/ftp" title="ftp" rel="tag">ftp</a>, <a href="http://sexywp.com/tags/iptables" title="iptables" rel="tag">iptables</a>, <a href="http://sexywp.com/tags/linux" title="Linux" rel="tag">Linux</a>, <a href="http://sexywp.com/tags/rhel" title="rhel" rel="tag">rhel</a><br />
]]></content:encoded>
			<wfw:commentRss>http://sexywp.com/%e5%a6%82%e4%bd%95%e9%85%8d%e7%bd%aerhel%e7%9a%84iptables%e5%bc%80%e6%94%be%e7%ab%af%e5%8f%a3.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mac OS X上如何实现到Linux主机的ssh免登陆</title>
		<link>http://sexywp.com/mac-os-x-ssh-key-pair-login-linux.htm</link>
		<comments>http://sexywp.com/mac-os-x-ssh-key-pair-login-linux.htm#comments</comments>
		<pubDate>Sun, 04 Sep 2011 03:53:53 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[工作相关]]></category>
		<category><![CDATA[DIY]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[usage]]></category>

		<guid isPermaLink="false">http://sexywp.com/?p=458</guid>
		<description><![CDATA[本文要讲的，就是如何简化从Mac登录Linux主机的操作步骤，提高效率。所谓的“免登陆”其实是不存在的，只是说，从验证密码的登录方式，改为公私钥对的登录验证方式。使用后者的方式，每次会由ssh客户端自动发送验证信息，所以就免去了人工输入密码，看起来好像“免登陆”一样。

关于这么做的原理，大家可以自己去Google，关键词是“非对称加密”，“RSA算法”，“基于ssh密钥对的自动登录”，等等，我就不多解释了。我直接说操作步骤吧：



<span class="readmore"><a href="http://sexywp.com/mac-os-x-ssh-key-pair-login-linux.htm" title="Mac OS X上如何实现到Linux主机的ssh免登陆">Keep Reading --- 810 words totally</a></span><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Flinux-commands-used-when-working.htm&from=http%3A%2F%2Fsexywp.com%2Fmac-os-x-ssh-key-pair-login-linux.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">工作中常用的Linux命令集锦</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fvim-tricks-collections.htm&from=http%3A%2F%2Fsexywp.com%2Fmac-os-x-ssh-key-pair-login-linux.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">VIM常用小窍门收集</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fword2007-doesnot-show-pics.htm&from=http%3A%2F%2Fsexywp.com%2Fmac-os-x-ssh-key-pair-login-linux.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">[Tips]Word2007中看不到图片</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fcustom-mac-os-x-terminal.htm&from=http%3A%2F%2Fsexywp.com%2Fmac-os-x-ssh-key-pair-login-linux.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">使Mac OS X的终端看起来更舒服</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Flet-php5-support-readline.htm&from=http%3A%2F%2Fsexywp.com%2Fmac-os-x-ssh-key-pair-login-linux.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Dedian 5的PHP包缺少readline支持</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>本文要讲的，就是如何简化从Mac登录Linux主机的操作步骤，提高效率。所谓的“免登陆”其实是不存在的，只是说，从验证密码的登录方式，改为公私钥对的登录验证方式。使用后者的方式，每次会由ssh客户端自动发送验证信息，所以就免去了人工输入密码，看起来好像“免登陆”一样。</p>
<p>关于这么做的原理，大家可以自己去Google，关键词是“非对称加密”，“RSA算法”，“基于ssh密钥对的自动登录”，等等，我就不多解释了。我直接说操作步骤吧：</p>
<ol>
<li>生成密钥对</li>
<li>用密码登录远程主机，将公钥拷贝过去</li>
<li>done</li>
</ol>
<p>怎么样，无敌简单吧？</p>
<h2>生成密钥对</h2>
<p>执行命令 <a href="http://sexywp.com/tags/ssh" class="st_tag internal_tag" rel="tag" title="标签 ssh 下的日志">ssh</a>-keygen -t rsa<br />
执行结果如下：</p>
<blockquote><p>
charles@mac:~ &gt; ssh-keygen -t rsa<br />
Generating public/private rsa key pair.<br />
Enter file in which to save the key (/Users/charles/.ssh/id_rsa):<br />
Created directory '/Users/charles/.ssh'.<br />
Enter passphrase (empty for no passphrase):<br />
Enter same passphrase again:<br />
Your identification has been saved in /Users/charles/.ssh/id_rsa.<br />
Your public key has been saved in /Users/charles/.ssh/id_rsa.pub.<br />
The key fingerprint is:<br />
c8:4b:85:87:90:7c:1a:67:b6:71:f5:51:0c:9d:a2:89 charles@TCMBP.local<br />
The key's randomart image is:<br />
+--[ RSA 2048]----+<br />
|   ...   .. o=.. |<br />
|    +.*o.  ...+  |<br />
|     Bo+o. o..   |<br />
|    ...+E o      |<br />
|      + S        |<br />
|     . .         |<br />
|      .          |<br />
|                 |<br />
|                 |<br />
+-----------------+
</p></blockquote>
<p>注意：提示enter passphrase的时候，不要输入，因为你本来就想少打一次密码的，这里如果设置了用密码保护私钥，那登录的时候还是要输密码，就白做了。</p>
<p>做完这个步骤后，cd ~/.ssh，你就可以看到你刚才生成的密钥对，id_rsa是私钥，id_rsa.pub是公钥。下一步，就是把公钥拷贝到目标主机上。</p>
<h2>将公钥拷贝到目标主机</h2>
<p>用ssh登录到目标主机，然后cd ~/.ssh目录，如果目录不存在，那么要自己创建mkdir -p ~/.ssh。你今后要用哪个帐户登录主机，就在哪个帐户的home目录下操作，如果要免登陆root，就要去/root下操作。使用~比较好，不用多想了。</p>
<p>有了.ssh目录后，进去，然后把id_rsa.pub传过去，可以用scp命令，这里要做的一个主要操作，就是将id_rsa.pub，的文件内容，写到一个叫authorized_keys的文件中去，如果目标主机的相应用户名下已经有了.ssh目录和authorized_keys文件，那你操作要小心一点，可能别人也做过免登陆的设置，这个时候你要小心不要把别人的设置给覆盖了。如果没有的话，就创建文件touch ~/.ssh/authorized_keys，然后执行cat id_rsa.pub >> authorized_keys，将你的公钥写入到authorized_keys中，公钥文件.pub里面只有一行信息，上面的命令相当于把那一行信息追加到authorized_keys文件最后一行。</p>
<p>如果.ssh目录是你主机刚刚创建的，那么可能还需要改变一下这个目录的权限，将权限放低，chmod -R 0600 ~/.ssh，到此，所有设置就算做完了，你可以退出登录，在自己的主机上试一下了，现在再敲入ssh命令后，不用密码就可以登录主机了。</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Flinux-commands-used-when-working.htm&from=http%3A%2F%2Fsexywp.com%2Fmac-os-x-ssh-key-pair-login-linux.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">工作中常用的Linux命令集锦</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fvim-tricks-collections.htm&from=http%3A%2F%2Fsexywp.com%2Fmac-os-x-ssh-key-pair-login-linux.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">VIM常用小窍门收集</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fword2007-doesnot-show-pics.htm&from=http%3A%2F%2Fsexywp.com%2Fmac-os-x-ssh-key-pair-login-linux.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">[Tips]Word2007中看不到图片</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fcustom-mac-os-x-terminal.htm&from=http%3A%2F%2Fsexywp.com%2Fmac-os-x-ssh-key-pair-login-linux.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">使Mac OS X的终端看起来更舒服</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Flet-php5-support-readline.htm&from=http%3A%2F%2Fsexywp.com%2Fmac-os-x-ssh-key-pair-login-linux.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Dedian 5的PHP包缺少readline支持</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
	标签：<a href="http://sexywp.com/tags/diy" title="DIY" rel="tag">DIY</a>, <a href="http://sexywp.com/tags/linux" title="Linux" rel="tag">Linux</a>, <a href="http://sexywp.com/tags/ssh" title="ssh" rel="tag">ssh</a>, <a href="http://sexywp.com/tags/tips" title="tips" rel="tag">tips</a>, <a href="http://sexywp.com/tags/usage" title="usage" rel="tag">usage</a><br />
]]></content:encoded>
			<wfw:commentRss>http://sexywp.com/mac-os-x-ssh-key-pair-login-linux.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VIM常用小窍门收集</title>
		<link>http://sexywp.com/vim-tricks-collections.htm</link>
		<comments>http://sexywp.com/vim-tricks-collections.htm#comments</comments>
		<pubDate>Tue, 14 Jun 2011 14:31:30 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[工作相关]]></category>
		<category><![CDATA[心得体会]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[tricks]]></category>
		<category><![CDATA[usage]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://sexywp.com/?p=440</guid>
		<description><![CDATA[vim应该是现在世界上最流行的编辑器，没有之一。就算你千般百般地不喜欢它，掌握它也成了一件必须的事情了。因为日后你如果做程序员，在非Win系列的服务器上搞开发，vim绝对是无法避免的。你日常能接触到的server，emacs可能没装，但是vi不可能没装，就这样。

特意开辟这个文章，用于收藏一些工作中常用的操作，主要有这么几个原则：



<span class="readmore"><a href="http://sexywp.com/vim-tricks-collections.htm" title="VIM常用小窍门收集">Keep Reading --- 615 words totally</a></span><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Flinux-commands-used-when-working.htm&from=http%3A%2F%2Fsexywp.com%2Fvim-tricks-collections.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">工作中常用的Linux命令集锦</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fthe-absolute-bare-minimum-vimrc.htm&from=http%3A%2F%2Fsexywp.com%2Fvim-tricks-collections.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Vim最低配置单</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fmac-os-x-ssh-key-pair-login-linux.htm&from=http%3A%2F%2Fsexywp.com%2Fvim-tricks-collections.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Mac OS X上如何实现到Linux主机的ssh免登陆</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fword2007-doesnot-show-pics.htm&from=http%3A%2F%2Fsexywp.com%2Fvim-tricks-collections.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">[Tips]Word2007中看不到图片</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fphp5-pass-param-by-ref.htm&from=http%3A%2F%2Fsexywp.com%2Fvim-tricks-collections.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【边学边用】PHP5函数参数的按引用传递</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>vim应该是现在世界上最流行的编辑器，没有之一。就算你千般百般地不喜欢它，掌握它也成了一件必须的事情了。因为日后你如果做程序员，在非Win系列的服务器上搞开发，vim绝对是无法避免的。你日常能接触到的server，emacs可能没装，但是vi不可能没装，就这样。</p>
<p>特意开辟这个文章，用于收藏一些工作中常用的操作，主要有这么几个原则：</p>
<ol>
<li>非常有用</li>
<li>不常用</li>
<li>每次用都想不起来应该怎么用</li>
</ol>
<p>不知道大家是不是经常跟我一样有这种感受呢，我会把我遇到的这类操作，都详细写在这里。</p>
<h2>将配置文件中的指定列前面加上注释符号</h2>
<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline">#fastcgi.conf</li>
<li>fastcgi_param&nbsp; GATEWAY_INTERFACE&nbsp; CGI/1.1;</li>
<li>fastcgi_param&nbsp; SERVER_SOFTWARE&nbsp; &nbsp; nginx;</li>
<li>fastcgi_param&nbsp; QUERY_STRING&nbsp; &nbsp; &nbsp; &nbsp;$query_string;</li>
<li>fastcgi_param&nbsp; REQUEST_METHOD&nbsp; &nbsp; &nbsp;$request_method;</li>
<li>fastcgi_param&nbsp; CONTENT_TYPE&nbsp; &nbsp; &nbsp; &nbsp;$content_type;</li>
<li>fastcgi_param&nbsp; CONTENT_LENGTH&nbsp; &nbsp; &nbsp;$content_length;</li>
<li>fastcgi_param&nbsp; SCRIPT_FILENAME&nbsp; &nbsp; $document_root$fastcgi_script_name;</li>
<li>fastcgi_param&nbsp; SCRIPT_NAME&nbsp; &nbsp; &nbsp; &nbsp; $fastcgi_script_name;</li>
<li>fastcgi_param&nbsp; REQUEST_URI&nbsp; &nbsp; &nbsp; &nbsp; $request_uri;</li>
<li>fastcgi_param&nbsp; DOCUMENT_URI&nbsp; &nbsp; &nbsp; &nbsp;$document_uri;</li>
<li>fastcgi_param&nbsp; DOCUMENT_ROOT&nbsp; &nbsp; &nbsp; $document_root;</li></ol></div>
<p>如上代码是一个很常见的配置文件，我现在要给第2-12行前面都加上一个#号，注释掉他们，在EmEditor里面这个事情无敌简单的，但是到了vi里面，你是不是总也想不起来应该怎么弄？</p>
<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline">:2,12s/^/#/g</li></ol></div>
<p>解释一下，【2,12】在vi中叫range，看帮助的时候，如果看到range，这就是一种写法，表明第2行到12行。<br />
还有一种写法：</p>
<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline">:s/^/#/g 11</li></ol></div>
<p>将光标移动到第二行，然后执行上面的命令，后面的【11】代表，执行这个命令，重复11次。这里一直没解释里面那个至关重要的乱码串，那个就是替换的命令了。下次再说。</p>
<h2>删除的时候使用f和t</h2>
<p>删除是vim里面非常常用的功能，一个一个字幕删除，用x，可以代替del用。整行删除，dd，应该都会了。删除一个单词，用dw。这些都是简单提一下，我主要想两个很好用的功能，就是f和t。</p>
<p>f的本意是行查找，fa，就是从光标当前位置开始，在本行中，找到第一个字母a，和d结合起来以后，就非常方便了，比如：</p>
<div class="hl-surround"><div class="hl-main"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li>&nbsp;<span style="color: Blue;">&lt;?php</span></li>
<li><span style="color: Gray;">&nbsp;</span><span style="color: Green;">function</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">test_php</span><span style="color: Olive;">(</span><span style="color: #00008b;">$a</span><span style="color: Gray;">,</span><span style="color: #00008b;">$b</span><span style="color: Gray;">,</span><span style="color: #00008b;">$c</span><span style="color: Olive;">)</span><span style="color: Gray;"> </span><span style="color: Olive;">{</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp;</span><span style="color: Green;">return</span><span style="color: Gray;">&nbsp;</span><span style="color: Green;">true</span><span style="color: Gray;">;</span></li>
<li><span style="color: Gray;">&nbsp;</span><span style="color: Olive;">}</span></li></ol></div></div>
<p>在这个代码里，你想删掉第一个参数，可以把光标放在(后面的第一个$上，然后按"df,"，就可以把$a连同后面的逗号都删掉，非常方便。当然了，你可以发挥一下，"d2f,"这个按键序列就是把$a和$b都删掉了，但是呢，用数字这种东西，在实际操作中，我感觉大脑经常反应不过来，需要思考，不实用。</p>
<p>在来说一下t，t这个东西，跟f非常像，区别就是t把找光标放到找到的那个字符前面一个位子，比如上面那个例子，我把光标放在第一个$上，然后按下"dt)"这个序列，可以把函数的3个参数都删掉，但是却不会删掉括号，非常舒服，在括号里删东西，我经常用这个功能。</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Flinux-commands-used-when-working.htm&from=http%3A%2F%2Fsexywp.com%2Fvim-tricks-collections.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">工作中常用的Linux命令集锦</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fthe-absolute-bare-minimum-vimrc.htm&from=http%3A%2F%2Fsexywp.com%2Fvim-tricks-collections.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Vim最低配置单</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fmac-os-x-ssh-key-pair-login-linux.htm&from=http%3A%2F%2Fsexywp.com%2Fvim-tricks-collections.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Mac OS X上如何实现到Linux主机的ssh免登陆</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fword2007-doesnot-show-pics.htm&from=http%3A%2F%2Fsexywp.com%2Fvim-tricks-collections.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">[Tips]Word2007中看不到图片</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fphp5-pass-param-by-ref.htm&from=http%3A%2F%2Fsexywp.com%2Fvim-tricks-collections.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【边学边用】PHP5函数参数的按引用传递</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
	标签：<a href="http://sexywp.com/tags/tips" title="tips" rel="tag">tips</a>, <a href="http://sexywp.com/tags/tricks" title="tricks" rel="tag">tricks</a>, <a href="http://sexywp.com/tags/usage" title="usage" rel="tag">usage</a>, <a href="http://sexywp.com/tags/vim" title="vim" rel="tag">vim</a><br />
]]></content:encoded>
			<wfw:commentRss>http://sexywp.com/vim-tricks-collections.htm/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>工作中常用的Linux命令集锦</title>
		<link>http://sexywp.com/linux-commands-used-when-working.htm</link>
		<comments>http://sexywp.com/linux-commands-used-when-working.htm#comments</comments>
		<pubDate>Tue, 12 Apr 2011 12:37:33 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[工作相关]]></category>
		<category><![CDATA[心得体会]]></category>
		<category><![CDATA[command]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[usage]]></category>

		<guid isPermaLink="false">http://sexywp.com/?p=419</guid>
		<description><![CDATA[tcpdump —— 打印出通过网口流入流出的数据内容，用于网络协议调试

tcpdump就是大家嘴里常说的抓包工具，在linux命令行下，使用tcpdump，可以查看服务器特定端口进出的数据包内容。

tcpdump -X -s0 -i any udp port 12009

<span class="readmore"><a href="http://sexywp.com/linux-commands-used-when-working.htm" title="工作中常用的Linux命令集锦">Keep Reading --- 1186 words totally</a></span><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fmac-os-x-ssh-key-pair-login-linux.htm&from=http%3A%2F%2Fsexywp.com%2Flinux-commands-used-when-working.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Mac OS X上如何实现到Linux主机的ssh免登陆</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fvim-tricks-collections.htm&from=http%3A%2F%2Fsexywp.com%2Flinux-commands-used-when-working.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">VIM常用小窍门收集</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fphp5-pass-param-by-ref.htm&from=http%3A%2F%2Fsexywp.com%2Flinux-commands-used-when-working.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【边学边用】PHP5函数参数的按引用传递</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fword2007-doesnot-show-pics.htm&from=http%3A%2F%2Fsexywp.com%2Flinux-commands-used-when-working.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">[Tips]Word2007中看不到图片</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fnetbeans-plugins-i-used.htm&from=http%3A%2F%2Fsexywp.com%2Flinux-commands-used-when-working.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">NetBeans 中我选用的插件</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<h3>tcpdump —— 打印出通过网口流入流出的数据内容，用于网络协议调试</h3>
<p>tcpdump就是大家嘴里常说的抓包工具，在linux命令行下，使用tcpdump，可以查看服务器特定端口进出的数据包内容。<br />
<code>tcpdump -X -s0 -i any udp port 12009</code><span id="more-419"></span><br />
上述命令是我在工作中常用的一组参数组合，其含义如下：</p>
<ul>
<li>-X 将每个包打印成16进制形式和ASCII形式，调试新协议的时候非常方便</li>
<li>-sN 每个包显示的（截断）字节数，N代表字节数，填0代表64K，为UDP包最大长度，实际实践中UDP包长1500字节左右，如果调试的协议只关心包头，一般查看前128个字节即可，可以视情况而选择。</li>
<li>-i 代表interface，可以认为是网卡，any代表任意，也可以填eth0，eth1，代表以太网口</li>
<li>udp port 12009是表达式，例子的含义就是UDP协议，12009端口。</li>
</ul>
<p><code>tcpdump [ -adeflnNOpqStvx ] [ -c 数量 ] [ -F 文件名 ][ -i 网络接口 ] [ -r 文件名] [ -s snaplen ][ -T 类型 ] [ -w 文件名 ] [表达式 ]</code></p>
<p>如上是tcpdump命令的完整格式，具体每个参数的含义，可以参看linux的man。</p>
<p>这里简单谈谈最后的那个“表达式”，这个表达式的写法是非常灵活的，使得tcpdump像一个可自由编程的调试工具一样，强大异常。这里可以把表达式理解成是一种编程语言的语句。</p>
<ol>
<li>表达式 = 语句 语句 语句 ……</li>
<li>语句 = 修饰符 | 修饰符 内容</li>
</ol>
<p>不知道我上面的描述方式，是不是说清楚了表达式的结构，表达式是一个又一个原语（primitives）组成的，每个原语又是由修饰符和数据组成。数据可以数字或者id或者ip或者range等。</p>
<p>修饰符有很多种：</p>
<ol>
<li>类型--可以是host（后面跟主机名），net（后面跟ip地址），port（和面跟端口号），如果不指定，默认是host</li>
<li>方向--可以是src，src or dst，src and dst，dst，主要是源端还是目的端，如果不指定，默认是src or dst</li>
<li>协议--就比较多了，常用的就udp和tcp，其他的可以看参考</li>
</ol>
<p>现在再来看看我给的例子，udp port 12009，表示使用UDP协议的，通过12009端口的（进入和出去的）包都显示出来。</p>
<p>tcpdump这个工具还是比较难以记住的，Charels觉得还是要注意理解这个命令的功能和原理，然后在用到的时候，才能快速的找到准确的用法。</p>
<h3>netstat —— 打印网络连接，路由表，网络数据统计等功能</h3>
<p>netstat是Linux服务器上最常用的命令之一，一般我总是用这个命令来诊断一些问题：mysql是否已经成功启动？web server是否已经成功启动？哪些进程在侦听哪些端口，建立了哪些连接？<br />
<code>netstat -npl</code><br />
这是我最常用的参数组合，n代表使用数字，哪个进程在哪个IP上侦听哪个端口，你看到的结果列表里，是192.168.26.128:3306这种形式的，这个例子里是mysql正常启动的状态，一般mysql启动后，会有一个进程侦听在3306端口上，如果不是用n参数，netstat会试图找出主机和程序的名字，会显示成localhost:mysql类似这样。<br />
p代表program，也即程序，到底是哪个程序在侦听端口呢？这个进程的id是多少？就是用这个参数来显示的。所以，np一般一起用，前面用n现实IP，后面用p显示程序的名字。<br />
l代表listen，代表让命令只列出正在侦听端口的进程，对于那些不活跃的则不显示，与l相对应的参数是a，代表all，表示列出所有的socket，不管是在侦听还是没在侦听的。<br />
其他的参数还有很多，比如i可以现实所有的网卡，s可以现实所有包的统计，但是因为使用场景较少，我就不介绍了，大家可以自己去看man，不爽看woman也行:)</p>
<h3>lsof —— 待续</h3>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fmac-os-x-ssh-key-pair-login-linux.htm&from=http%3A%2F%2Fsexywp.com%2Flinux-commands-used-when-working.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Mac OS X上如何实现到Linux主机的ssh免登陆</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fvim-tricks-collections.htm&from=http%3A%2F%2Fsexywp.com%2Flinux-commands-used-when-working.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">VIM常用小窍门收集</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fphp5-pass-param-by-ref.htm&from=http%3A%2F%2Fsexywp.com%2Flinux-commands-used-when-working.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【边学边用】PHP5函数参数的按引用传递</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fword2007-doesnot-show-pics.htm&from=http%3A%2F%2Fsexywp.com%2Flinux-commands-used-when-working.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">[Tips]Word2007中看不到图片</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fnetbeans-plugins-i-used.htm&from=http%3A%2F%2Fsexywp.com%2Flinux-commands-used-when-working.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">NetBeans 中我选用的插件</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
	标签：<a href="http://sexywp.com/tags/command" title="command" rel="tag">command</a>, <a href="http://sexywp.com/tags/linux" title="Linux" rel="tag">Linux</a>, <a href="http://sexywp.com/tags/tips" title="tips" rel="tag">tips</a>, <a href="http://sexywp.com/tags/usage" title="usage" rel="tag">usage</a><br />
]]></content:encoded>
			<wfw:commentRss>http://sexywp.com/linux-commands-used-when-working.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dedian 5的PHP包缺少readline支持</title>
		<link>http://sexywp.com/let-php5-support-readline.htm</link>
		<comments>http://sexywp.com/let-php5-support-readline.htm#comments</comments>
		<pubDate>Fri, 12 Nov 2010 06:33:40 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[工作相关]]></category>

		<guid isPermaLink="false">http://sexywp.com/?p=404</guid>
		<description><![CDATA[命令行下，PHP有一个很有趣的功能，就是interactive mode，在这种模式下，用户可以使用php shell，很自如的运行各种php函数。只要在shell下执行php -a命令即可。但是这个模式需要readline支持。

在Debian 5下，通过官方源使用apt安装的php5，不支持readline，所以，就无法使用interactive mode了。搜索了下，找到了解决办法。参见：http://www.dotdeb.org/instructions/ 这可能是一个组织，专门支持在Debian下搭建Web服务系统。

<span class="readmore"><a href="http://sexywp.com/let-php5-support-readline.htm" title="Dedian 5的PHP包缺少readline支持">Keep Reading --- 212 words totally</a></span><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fdeprecated-features-in-php-5-3.htm&from=http%3A%2F%2Fsexywp.com%2Flet-php5-support-readline.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PHP 5.3.x中弃用的特性 Deprecated</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fphp5-pass-param-by-ref.htm&from=http%3A%2F%2Fsexywp.com%2Flet-php5-support-readline.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【边学边用】PHP5函数参数的按引用传递</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Flinux-commands-used-when-working.htm&from=http%3A%2F%2Fsexywp.com%2Flet-php5-support-readline.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">工作中常用的Linux命令集锦</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fvideo-guide-to-use-yii-framework.htm&from=http%3A%2F%2Fsexywp.com%2Flet-php5-support-readline.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">视频教程：使用Yii框架开发Blog</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fphp-return.htm&from=http%3A%2F%2Fsexywp.com%2Flet-php5-support-readline.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">[Tips] PHP中return的用法</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>命令行下，PHP有一个很有趣的功能，就是interactive mode，在这种模式下，用户可以使用php shell，很自如的运行各种php函数。只要在shell下执行php -a命令即可。但是这个模式需要readline支持。</p>
<p>在Debian 5下，通过官方源使用apt安装的php5，不支持readline，所以，就无法使用interactive mode了。搜索了下，找到了解决办法。参见：http://www.dotdeb.org/instructions/ 这可能是一个组织，专门支持在Debian下搭建Web服务系统。</p>
<p>首先打开source.list，添加两个源：</p>
<p>deb http://packages.dotdeb.org stable all<br />
deb-src http://packages.dotdeb.org stable all</p>
<p>然后update，然后safe-upgrade，会发现跟web server相关的软件包都升级了，包括apache， <a href="http://sexywp.com/tags/php" class="st_tag internal_tag" rel="tag" title="标签 PHP 下的日志">php</a>，mysql等。升级完成后，再尝试php -a，哈哈，<a href="http://sexywp.com/tags/php" class="st_tag internal_tag" rel="tag" title="标签 PHP 下的日志">php</a> shell出来了！！</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fdeprecated-features-in-php-5-3.htm&from=http%3A%2F%2Fsexywp.com%2Flet-php5-support-readline.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PHP 5.3.x中弃用的特性 Deprecated</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fphp5-pass-param-by-ref.htm&from=http%3A%2F%2Fsexywp.com%2Flet-php5-support-readline.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【边学边用】PHP5函数参数的按引用传递</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Flinux-commands-used-when-working.htm&from=http%3A%2F%2Fsexywp.com%2Flet-php5-support-readline.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">工作中常用的Linux命令集锦</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fvideo-guide-to-use-yii-framework.htm&from=http%3A%2F%2Fsexywp.com%2Flet-php5-support-readline.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">视频教程：使用Yii框架开发Blog</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fphp-return.htm&from=http%3A%2F%2Fsexywp.com%2Flet-php5-support-readline.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">[Tips] PHP中return的用法</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>该日志未加标签。]]></content:encoded>
			<wfw:commentRss>http://sexywp.com/let-php5-support-readline.htm/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>如何在Debian上安装PHPUnit</title>
		<link>http://sexywp.com/how-to-install-phpunit-on-debian.htm</link>
		<comments>http://sexywp.com/how-to-install-phpunit-on-debian.htm#comments</comments>
		<pubDate>Wed, 10 Nov 2010 09:55:28 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[工作相关]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[phpunit]]></category>

		<guid isPermaLink="false">http://sexywp.com/?p=403</guid>
		<description><![CDATA[Debian上安装PHPUnit最方便的做法，就是使用apt-get或者aptitude，当然，如果你想安装最新版本的PHPUnit，那又另当别论了。

安装最新版本的PHPUnit，我推荐使用pear来安装，不过前提是首先要安装最新版本的pear，Debian源里的pear，版本低于1.8.1，不能安装最新版的PHPUnit。

好，下面的代码用来安装pear，然后是PHPUnit：

<span class="readmore"><a href="http://sexywp.com/how-to-install-phpunit-on-debian.htm" title="如何在Debian上安装PHPUnit">Keep Reading --- 206 words totally</a></span><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Flet-php5-support-readline.htm&from=http%3A%2F%2Fsexywp.com%2Fhow-to-install-phpunit-on-debian.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Dedian 5的PHP包缺少readline支持</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Flinux-commands-used-when-working.htm&from=http%3A%2F%2Fsexywp.com%2Fhow-to-install-phpunit-on-debian.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">工作中常用的Linux命令集锦</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fphp5-pass-param-by-ref.htm&from=http%3A%2F%2Fsexywp.com%2Fhow-to-install-phpunit-on-debian.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【边学边用】PHP5函数参数的按引用传递</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fmac-os-x-ssh-key-pair-login-linux.htm&from=http%3A%2F%2Fsexywp.com%2Fhow-to-install-phpunit-on-debian.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Mac OS X上如何实现到Linux主机的ssh免登陆</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fdeprecated-features-in-php-5-3.htm&from=http%3A%2F%2Fsexywp.com%2Fhow-to-install-phpunit-on-debian.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PHP 5.3.x中弃用的特性 Deprecated</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>Debian上安装PHPUnit最方便的做法，就是使用apt-get或者aptitude，当然，如果你想安装最新版本的PHPUnit，那又另当别论了。</p>
<p>安装最新版本的PHPUnit，我推荐使用pear来安装，不过前提是首先要安装最新版本的pear，Debian源里的pear，版本低于1.8.1，不能安装最新版的PHPUnit。</p>
<p>好，下面的代码用来安装pear，然后是PHPUnit：</p>
<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline"># 这里我试了wget是不行的，好像不支持管道，所以用curl</li>
<li>curl http://pear.php.net/go-pear | php</li>
<li># 安装pear可能让你指定目录，从后来我的安装结果来看，我推荐目录$prefix选 /usr/local</li>
<li># ……省略若干安装过程，接着安装PHPUnit</li>
<li>pear channel-discover pear.phpunit.de</li>
<li>pear channel-discover components.ez.no</li>
<li>pear channel-discover pear.symfony-project.com</li>
<li>pear install phpunit/PHPUnit</li></ol></div>
<p>好了，大功告成！</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Flet-php5-support-readline.htm&from=http%3A%2F%2Fsexywp.com%2Fhow-to-install-phpunit-on-debian.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Dedian 5的PHP包缺少readline支持</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Flinux-commands-used-when-working.htm&from=http%3A%2F%2Fsexywp.com%2Fhow-to-install-phpunit-on-debian.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">工作中常用的Linux命令集锦</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fphp5-pass-param-by-ref.htm&from=http%3A%2F%2Fsexywp.com%2Fhow-to-install-phpunit-on-debian.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【边学边用】PHP5函数参数的按引用传递</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fmac-os-x-ssh-key-pair-login-linux.htm&from=http%3A%2F%2Fsexywp.com%2Fhow-to-install-phpunit-on-debian.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Mac OS X上如何实现到Linux主机的ssh免登陆</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fdeprecated-features-in-php-5-3.htm&from=http%3A%2F%2Fsexywp.com%2Fhow-to-install-phpunit-on-debian.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PHP 5.3.x中弃用的特性 Deprecated</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
	标签：<a href="http://sexywp.com/tags/debian" title="debian" rel="tag">debian</a>, <a href="http://sexywp.com/tags/howto" title="howto" rel="tag">howto</a>, <a href="http://sexywp.com/tags/linux" title="Linux" rel="tag">Linux</a>, <a href="http://sexywp.com/tags/php" title="PHP" rel="tag">PHP</a>, <a href="http://sexywp.com/tags/phpunit" title="phpunit" rel="tag">phpunit</a><br />
]]></content:encoded>
			<wfw:commentRss>http://sexywp.com/how-to-install-phpunit-on-debian.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>显示彩色的manpages</title>
		<link>http://sexywp.com/show-colorful-manpages.htm</link>
		<comments>http://sexywp.com/show-colorful-manpages.htm#comments</comments>
		<pubDate>Sat, 06 Feb 2010 14:35:16 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[color]]></category>
		<category><![CDATA[man]]></category>
		<category><![CDATA[manpages]]></category>
		<category><![CDATA[usage]]></category>

		<guid isPermaLink="false">http://sexywp.com/?p=360</guid>
		<description><![CDATA[man是Linux下最最常用的命令之一，用来显示某个命令的手册。

一般在命令行下，manpages通过粗体和下划线来标记关键信息，有多种方法来使man命令显示彩色的manpages。

man是调用less来显示manpages的，可以更换这个程序，使用most来显示，这是一个方法。但是长期以来使用less，已经习惯，most又有一套操作方法，后来我又发现了一种方案，非常简单，只要通过在bashrc中设定环境变量，就可以高亮彩显manpages，非常方便。

<span class="readmore"><a href="http://sexywp.com/show-colorful-manpages.htm" title="显示彩色的manpages">Keep Reading --- 267 words totally</a></span><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fmac-os-x-ssh-key-pair-login-linux.htm&from=http%3A%2F%2Fsexywp.com%2Fshow-colorful-manpages.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Mac OS X上如何实现到Linux主机的ssh免登陆</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Flinux-commands-used-when-working.htm&from=http%3A%2F%2Fsexywp.com%2Fshow-colorful-manpages.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">工作中常用的Linux命令集锦</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Ftemplate-tags-usage.htm&from=http%3A%2F%2Fsexywp.com%2Fshow-colorful-manpages.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Template Tags（模板标签）使用指南</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fvim-tricks-collections.htm&from=http%3A%2F%2Fsexywp.com%2Fshow-colorful-manpages.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">VIM常用小窍门收集</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fleopard-admin.htm&from=http%3A%2F%2Fsexywp.com%2Fshow-colorful-manpages.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Leopard Admin</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>man是Linux下最最常用的命令之一，用来显示某个命令的手册。</p>
<p>一般在命令行下，manpages通过粗体和下划线来标记关键信息，有多种方法来使man命令显示彩色的manpages。</p>
<p>man是调用less来显示manpages的，可以更换这个程序，使用most来显示，这是一个方法。但是长期以来使用less，已经习惯，most又有一套操作方法，后来我又发现了一种方案，非常简单，只要通过在bashrc中设定环境变量，就可以高亮彩显manpages，非常方便。</p>
<p>设定方法如下，在.bashrc末尾添加如下几行：<br />
<code><br />
export LESS_TERMCAP_mb=$'\E[01;31m'<br />
export LESS_TERMCAP_md=$'\E[01;31m'<br />
export LESS_TERMCAP_me=$'\E[0m'<br />
export LESS_TERMCAP_se=$'\E[0m'<br />
export LESS_TERMCAP_so=$'\E[01;44;33m'<br />
export LESS_TERMCAP_ue=$'\E[0m'<br />
export LESS_TERMCAP_us=$'\E[01;32m'<br />
</code></p>
<p>如此，即可以为manpages添加红绿两色，虽然不多，但是远好过了单调的黑白页面。</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fmac-os-x-ssh-key-pair-login-linux.htm&from=http%3A%2F%2Fsexywp.com%2Fshow-colorful-manpages.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Mac OS X上如何实现到Linux主机的ssh免登陆</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Flinux-commands-used-when-working.htm&from=http%3A%2F%2Fsexywp.com%2Fshow-colorful-manpages.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">工作中常用的Linux命令集锦</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Ftemplate-tags-usage.htm&from=http%3A%2F%2Fsexywp.com%2Fshow-colorful-manpages.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Template Tags（模板标签）使用指南</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fvim-tricks-collections.htm&from=http%3A%2F%2Fsexywp.com%2Fshow-colorful-manpages.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">VIM常用小窍门收集</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fleopard-admin.htm&from=http%3A%2F%2Fsexywp.com%2Fshow-colorful-manpages.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Leopard Admin</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
	标签：<a href="http://sexywp.com/tags/color" title="color" rel="tag">color</a>, <a href="http://sexywp.com/tags/linux" title="Linux" rel="tag">Linux</a>, <a href="http://sexywp.com/tags/man" title="man" rel="tag">man</a>, <a href="http://sexywp.com/tags/manpages" title="manpages" rel="tag">manpages</a>, <a href="http://sexywp.com/tags/usage" title="usage" rel="tag">usage</a><br />
]]></content:encoded>
			<wfw:commentRss>http://sexywp.com/show-colorful-manpages.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

