<?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>Leon&#039;s blog &#187; Linux</title>
	<atom:link href="http://www.leonzhang.com/tag/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.leonzhang.com</link>
	<description>关注: 开源&#38;互联网, GTD with open source and Web</description>
	<lastBuildDate>Mon, 30 Jan 2012 14:24:13 +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>PHP里的md5函数与linux的md5sum命令的区别</title>
		<link>http://www.leonzhang.com/2011/10/23/php-md5-vs-linux-md5sum/</link>
		<comments>http://www.leonzhang.com/2011/10/23/php-md5-vs-linux-md5sum/#comments</comments>
		<pubDate>Sun, 23 Oct 2011 06:17:13 +0000</pubDate>
		<dc:creator>leon</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[其他]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.leonzhang.com/?p=806</guid>
		<description><![CDATA[有好几次碰到使用Linux的md5sum命令产出的散列值,跟PHP的md5函数,或者MySQL的md5函数产生的不一样的问题. 通常比较懒,就没细想,直接使用PHP产生的算了;没想过难道算法还会有不同. 其实没有不同的算法,md5在哪里的计算方法只有一个.原因不过是因为使用md5sum时,有时候不小心会把换行符也作为计算的内容,结果实际上是散列的对象不同,自然结果也就不同了.而在Linux命令行状态下,我通常注意不到换行的存在. 以字符串&#8217;123&#8242;为例,PHP的计算结果是: 比如下列语句实际上是对”123\n”进行求散列,而不是对&#8217;123&#8242;求散列. 正确的写法应该是通过echo的&#8217;-n&#8217;选项,让echo不要输出换行符,这样结果就一样了.]]></description>
			<content:encoded><![CDATA[<p>有好几次碰到使用Linux的md5sum命令产出的散列值,跟PHP的md5函数,或者MySQL的md5函数产生的不一样的问题.<br />
通常比较懒,就没细想,直接使用PHP产生的算了;没想过难道算法还会有不同.</p>
<p>其实没有不同的算法,md5在哪里的计算方法只有一个.原因不过是因为使用md5sum时,有时候不小心会把换行符也作为计算的内容,结果实际上是散列的对象不同,自然结果也就不同了.而在Linux命令行状态下,我通常注意不到换行的存在.</p>
<p>以字符串&#8217;123&#8242;为例,PHP的计算结果是:</p>
<pre class="brush: bash; title: ; notranslate">
$ php -r 'echo md5(&quot;123&quot;);'
202cb962ac59075b964b07152d234b70
</pre>
<p>比如下列语句实际上是对”123\n”进行求散列,而不是对&#8217;123&#8242;求散列.</p>
<pre class="brush: bash; title: ; notranslate">
$ echo '123' | md5sum
ba1f2511fc30423bdbb183fe33f3dd0f
</pre>
<p>正确的写法应该是通过echo的&#8217;-n&#8217;选项,让echo不要输出换行符,这样结果就一样了.</p>
<pre class="brush: bash; title: ; notranslate">
$ echo -n '123' | md5sum
202cb962ac59075b964b07152d234b70
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.leonzhang.com/2011/10/23/php-md5-vs-linux-md5sum/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux系统在虚拟机里的时区问题</title>
		<link>http://www.leonzhang.com/2010/07/13/debian-timezone-under-virtualbox/</link>
		<comments>http://www.leonzhang.com/2010/07/13/debian-timezone-under-virtualbox/#comments</comments>
		<pubDate>Mon, 12 Jul 2010 16:04:11 +0000</pubDate>
		<dc:creator>leon</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[VirtualBox]]></category>

		<guid isPermaLink="false">http://www.leonzhang.com/?p=557</guid>
		<description><![CDATA[缺省情况下Debian的时间是根据系统时间设置成UTC时间的，然后再根据用户的时区设置做相应的调整。这通常没有问题，但是当我通过VirtualBox来在虚拟机里运行Linux的时候，问题来了。 因为VirtualBox是根据它的宿主操作系统来设置虚拟机的系统时间的，而这并不是Debian想要的UTC时间，除非你正好在0时区。这时Debian再根据用户时区设置调整时区，时区相当于被被处理了两次。这是我就不知道被从东8区扔到什么地方去了。 修正办法是不让Debian再做用户时区调整，直接使用系统时间就可以了。这时候我们需要把/etc/default/rcS文件里的”UTC=yes”改成”UTC=no”。保存，重启，OK。不知道这样有没有别的什么副作用，先用着看吧。]]></description>
			<content:encoded><![CDATA[<p>缺省情况下Debian的时间是根据系统时间设置成UTC时间的，然后再根据用户的时区设置做相应的调整。这通常没有问题，但是当我通过VirtualBox来在虚拟机里运行Linux的时候，问题来了。</p>
<p>因为VirtualBox是根据它的宿主操作系统来设置虚拟机的系统时间的，而这并不是Debian想要的UTC时间，除非你正好在0时区。这时Debian再根据用户时区设置调整时区，时区相当于被被处理了两次。这是我就不知道被从东8区扔到什么地方去了。</p>
<p>修正办法是不让Debian再做用户时区调整，直接使用系统时间就可以了。这时候我们需要把/etc/default/rcS文件里的”UTC=yes”改成”UTC=no”。保存，重启，OK。不知道这样有没有别的什么副作用，先用着看吧。 </p>
]]></content:encoded>
			<wfw:commentRss>http://www.leonzhang.com/2010/07/13/debian-timezone-under-virtualbox/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>vim下按Ctrl+S造成程序“僵死”</title>
		<link>http://www.leonzhang.com/2010/06/09/vim_hangu_by_ctrl_s/</link>
		<comments>http://www.leonzhang.com/2010/06/09/vim_hangu_by_ctrl_s/#comments</comments>
		<pubDate>Wed, 09 Jun 2010 10:38:13 +0000</pubDate>
		<dc:creator>leon</dc:creator>
				<category><![CDATA[IT与互联网]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://www.leonzhang.com/?p=507</guid>
		<description><![CDATA[我在使用vim的时候，偶尔会碰到vim莫名其妙的僵在那里。在界面上输入什么都没有反应。甚至Ctrl+C、Ctrl+D也没有反应。 由于不是经常发生，也就没在意。每次很麻烦的关掉putty的窗口，重新再打开putty。今天发生了好几次，很是郁闷。就想看看究竟是怎么回事，结果发现每次按下Ctrl+S就会出现这个问题。 由于以前碰到过vim有些扩展有问题，这次就也怀疑是vim扩展的问题。结果删除了所有扩展和.vimrc文件，问题依旧。通过putty登录到别的系统，也是一样的问题。直接在ubuntu的命令行，按下Ctrl+S，问题也一样！ 奥，原来是Linux的一个快捷键呀，干什么用的？ 原来Ctrl+S在Linux里，是锁定屏幕的快捷键。如果要解锁，按下Ctrl+Q就可以了。 好吧，接受教训吧。以后碰到问题要勤快点，越早解决越少麻烦。 现在让我记牢点这两个组合键Ctrl+S和Ctrl+Q。]]></description>
			<content:encoded><![CDATA[<p>我在使用vim的时候，偶尔会碰到vim莫名其妙的僵在那里。在界面上输入什么都没有反应。甚至Ctrl+C、Ctrl+D也没有反应。</p>
<p>由于不是经常发生，也就没在意。每次很麻烦的关掉putty的窗口，重新再打开putty。今天发生了好几次，很是郁闷。就想看看究竟是怎么回事，结果发现每次按下Ctrl+S就会出现这个问题。</p>
<p>由于以前碰到过vim有些扩展有问题，这次就也怀疑是vim扩展的问题。结果删除了所有扩展和.vimrc文件，问题依旧。通过putty登录到别的系统，也是一样的问题。直接在ubuntu的命令行，按下Ctrl+S，问题也一样！</p>
<p>奥，原来是Linux的一个快捷键呀，干什么用的？</p>
<p>原来Ctrl+S在Linux里，是锁定屏幕的快捷键。如果要解锁，按下Ctrl+Q就可以了。</p>
<p>好吧，接受教训吧。以后碰到问题要勤快点，越早解决越少麻烦。<br />
现在让我记牢点这两个组合键<strong>Ctrl+S</strong>和<strong>Ctrl+Q</strong>。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.leonzhang.com/2010/06/09/vim_hangu_by_ctrl_s/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux下如何拷贝整个目录下的所有文件</title>
		<link>http://www.leonzhang.com/2010/02/03/how_to_copy_folder_in_linux/</link>
		<comments>http://www.leonzhang.com/2010/02/03/how_to_copy_folder_in_linux/#comments</comments>
		<pubDate>Wed, 03 Feb 2010 05:52:50 +0000</pubDate>
		<dc:creator>leon</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[copy]]></category>
		<category><![CDATA[file]]></category>

		<guid isPermaLink="false">http://www.leonzhang.com/?p=454</guid>
		<description><![CDATA[如何在Linux下拷贝一个目录呢？这好像是再如意不过的问题了。 比如要把/home/usera拷贝到/mnt/temp，我首先想到的就是 cp -R /home/usera/* /mnt/temp 但是这样有一个问题，/home/usera下的隐藏文件都不会被拷贝，子目录下的隐藏文件倒是会的。 那如何才是正确的方法呢？有人说用-a选项，有人说用find加管道。 其实没这么复杂，Google了之后，学了一招。原来只有用“.”当前目录代替“*”就好了。 cp -R /home/usera/. /mnt/temp]]></description>
			<content:encoded><![CDATA[<p>如何在Linux下拷贝一个目录呢？这好像是再如意不过的问题了。<br />
比如要把/home/usera拷贝到/mnt/temp，我首先想到的就是<br />
<code><br />
cp -R /home/usera/* /mnt/temp<br />
</code><br />
但是这样有一个问题，/home/usera下的隐藏文件都不会被拷贝，子目录下的隐藏文件倒是会的。</p>
<p>那如何才是正确的方法呢？有人说用-a选项，有人说用find加管道。<br />
其实没这么复杂，Google了之后，学了一招。原来只有用“.”当前目录代替“*”就好了。<br />
<code><br />
cp -R /home/usera/. /mnt/temp<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.leonzhang.com/2010/02/03/how_to_copy_folder_in_linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>cheat &amp; ztd</title>
		<link>http://www.leonzhang.com/2009/10/29/cheat/</link>
		<comments>http://www.leonzhang.com/2009/10/29/cheat/#comments</comments>
		<pubDate>Thu, 29 Oct 2009 14:20:16 +0000</pubDate>
		<dc:creator>leon</dc:creator>
				<category><![CDATA[GTD & ZTD]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[cheat_sheets]]></category>
		<category><![CDATA[GTD]]></category>
		<category><![CDATA[ZTD]]></category>
		<category><![CDATA[时间管理]]></category>

		<guid isPermaLink="false">http://www.leonzhang.com/?p=308</guid>
		<description><![CDATA[cheat sheets 是个不错的网站，在通过gem在命令行下能显示常见工具的cheat sheet。下面是ZTD的sheet的输出结果。 $cheat ztd ztd: &#160;&#160;Zen Things Done (ZTD) &#160;&#160;aka &#34;Minimal ZTD: The Simplest System Possible&#34; &#160;&#160;For more info see &#160;&#160;http://zenhabits.net/2007/04/minimal-ztd-the-simplest-system-possible/ &#160;&#160; &#160;&#160;The Four Habits &#160;&#160;&#8212;&#8212;&#8212;&#8212;- &#160;&#160;1. Collect &#160;&#160;&#160;&#160;*&#160;Write down any tasks, ideas, projects, or other information that pop into &#160;&#160;&#160;&#160;your head. &#160;&#160;&#160;&#160;*&#160;Get it out of your head and onto paper. &#160;&#160; &#160;&#160;2. [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://cheat.errtheblog.com/">cheat sheets</a> 是个不错的网站，在通过gem在命令行下能显示常见工具的cheat sheet。下面是ZTD的sheet的输出结果。</p>
<div style="background-color:#000000;color:#ffffff">
<font face="monospace"><br />
$cheat ztd<br />
ztd:<br />
&nbsp;&nbsp;Zen Things Done (ZTD)<br />
&nbsp;&nbsp;aka <font color="#00ff00">&quot;Minimal ZTD: The Simplest System Possible&quot;</font><br />
&nbsp;&nbsp;For more info see <br />
&nbsp;&nbsp;<a href="http://zenhabits">http://zenhabits</a><font color="#ffff00">.net</font>/2007/04/minimal-ztd-the-simplest-system-possible/<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;The Four Habits<br />
&nbsp;&nbsp;&#8212;&#8212;&#8212;&#8212;-<br />
&nbsp;&nbsp;1. Collect<br />
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ff40ff">*</font>&nbsp;Write down any tasks, ideas, projects, or other information that pop into<br />
&nbsp;&nbsp;&nbsp;&nbsp;your head.<br />
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ff40ff">*</font>&nbsp;Get it out of your head and onto paper.<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;2. Process<br />
&nbsp;&nbsp; <font color="#ff40ff">*</font>&nbsp;Make quick decisions on things in your inbox, do <font color="#00ffff">not</font>&nbsp;put them off.<br />
&nbsp;&nbsp; <font color="#ff40ff">*</font>&nbsp;Do it!, Trash it, Delegate it, File it (someday/maybe), calendar for later<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;3. Plan<br />
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ff40ff">*</font>&nbsp;&nbsp;Each day, create a list of 1-3 Most Important Tasks (your Big Rocks for<br />
&nbsp;&nbsp;&nbsp;&nbsp;the day) and be sure to accomplish them.<br />
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ff40ff">*</font>&nbsp;Do your MITs early in the day to <font color="#00ffff">get</font>&nbsp;them out of the way and enjoy the<br />
&nbsp;&nbsp;&nbsp;&nbsp;rest of the day.<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;4. Do<br />
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ff40ff">*</font>&nbsp;One task at a time, without distractions.<br />
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ff40ff">*</font>&nbsp;This <font color="#00ffff">is</font>&nbsp;<font color="#00ffff">one</font>&nbsp;of the most important habits in ZTD: Select a task (preferably<br />
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#00ffff">one</font>&nbsp;of your MITs) and <font color="#00ffff">focus</font>&nbsp;on it to the exclusion of all else.<br />
</font>
</div>
<ul>
<li>install cheat in debiean/squeeze</li>
<ul>
<li>apt-get install rubygems</li>
<li>ln -s /usr/bin/ruby1.8 /usr/bin/ruby</li>
<li>gem install cheat</li>
<li>ln -s /var/lib/gems/1.8/gems/cheat-1.2.1/bin/cheat /usr/bin/cheat</li>
</ul>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.leonzhang.com/2009/10/29/cheat/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: basic
Database Caching 1/30 queries in 0.019 seconds using disk: basic
Object Caching 529/592 objects using disk: basic
Content Delivery Network via N/A

Served from: www.leonzhang.com @ 2012-02-10 17:23:36 -->
