<?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>Lost HIT - Zealot&#039;s Blog &#187; linux</title>
	<atom:link href="http://blog.losthit.com/archives/tag/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.losthit.com</link>
	<description>关注 linux/c/c++/python/web开发,互联网数据抓取与挖掘</description>
	<lastBuildDate>Tue, 31 Jan 2012 09:27:29 +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>如何创建动态MOTD</title>
		<link>http://blog.losthit.com/archives/how-to-create-dynamic-motd/</link>
		<comments>http://blog.losthit.com/archives/how-to-create-dynamic-motd/#comments</comments>
		<pubDate>Sat, 10 Sep 2011 06:53:52 +0000</pubDate>
		<dc:creator>Zealot</dc:creator>
				<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[MacOS]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[motd]]></category>

		<guid isPermaLink="false">http://blog.losthit.com/?p=389</guid>
		<description><![CDATA[刚到淘宝时发现很多服务器登陆后都会显示一段AsciiArt的信息，觉得很好玩，也稍微有点用。如果你关心具体是什么，可以发送简历到jinxi.kj@taobao.com：）
本文主要介绍如何创建该信息，即MOTD... ]]></description>
			<content:encoded><![CDATA[<h2>背景介绍</h2>
<p>刚到淘宝时发现很多服务器登陆后都会显示一段AsciiArt的信息，觉得很好玩，也稍微有点用。如果你关心具体是什么，可以发送简历到jinxi.kj@taobao.com：）</p>
<h2>如何显示静态MOTD</h2>
<p>以上是背景，上网搜了一下，找到了相关的资料。其实很简单，只要修改了/etc/motd文件，登陆时就会被显示出来。如果需要增加颜色的话，可以参照这里的方法：<a href="http://www.linuxjournal.com/article/8603" target="_blank">“So You Like Color&#8211;The Mysterious ^[[ Characters"</a> (http://www.linuxjournal.com/article/8603)。在vim中输入Ctrl+V后再按ESC，接下来写上颜色代码就行。有玩过term bbs的话应该会很熟悉。</p>
<h2>如何显示动态MOTD</h2>
<p>设置好/etc/motd后，马上就发现了一个问题，这是个静态的内容，自然就不能显示动态的信息。比如ip地址、硬盘占用、进程数等，除此之外，也没人喜欢部署多台机器时手动在motd中设置机器相关的参数，比如CPU、core数等。于是我就找到了这篇Blog: "<a href="http://parkersamp.com/2010/10/howto-creating-a-dynamic-motd-in-linux/" target="_blank">HOWTO: Creating a Dynamic MOTD in Linux</a>" (http://parkersamp.com/2010/10/howto-creating-a-dynamic-motd-in-linux/)。</p>
<p>具体方法很简单，编写一个脚本显示动态的motd，然后添加到/etc/profile中执行就行了。当然还需要禁用/etc/motd的显示。</p>
<h2>如何禁用静态MOTD</h2>
<p>修改: /etc/ssh/sshd_config<br />
PrintMotd no<br />
然后重启sshd: /etc/init.d/sshd restart or service sshd restart<br />
更多信息参考上面提到的Blog。当然，最简单最暴力的方法是把/etc/motd文件中内容清空。</p>
<h2>如何安装动态MOTD脚本</h2>
<p>1. 将动态MOTD脚本放到某个目录下，比如/usr/local/bin/dynmotd。<br />
2. 将脚本添加到/etc/profile中<br />
修改: /etc/profile<br />
/usr/local/bin/dynmotd</p>
<h2>我自定义的Python脚本</h2>
<p>由于前面我找到的Blog中使用的脚本是shell导致不方便修改，而且部分信息还是写死的；另一方面，Mac下面不能完全兼容。所以我自己用Python实现了一个类似的脚本，支持MacOS与Linux。考虑到不想把这个简单脚本搞得太复杂，所以没有用到兼容性、全面性更好地psutil。有兴趣的可以自己试试。</p>
<p>脚本可以到这里获取: <a href="https://github.com/chzealot/tools/tree/master/python/dynmotd" target="_blank">https://github.com/chzealot/tools/tree/master/python/dynmotd</a></p>
<h2>显示效果</h2>
<div id="attachment_395" class="wp-caption alignleft" style="width: 661px"><a href="http://blog.losthit.com/wp-content/uploads/2011/09/darwin.jpg"><img class="size-full wp-image-395 " title="MacOS(Darwin)下的显示效果" src="http://blog.losthit.com/wp-content/uploads/2011/09/darwin.jpg" alt="MacOS(Darwin)下的显示效果" width="651" height="440" /></a><p class="wp-caption-text">MacOS(Darwin)下的显示效果</p></div>
<div id="attachment_398" class="wp-caption alignleft" style="width: 656px"><a href="http://blog.losthit.com/wp-content/uploads/2011/09/linux.jpg"><img class="size-full wp-image-398 " title="Linux下的显示效果" src="http://blog.losthit.com/wp-content/uploads/2011/09/linux.jpg" alt="Linux下的显示效果" width="646" height="464" /></a><p class="wp-caption-text">Linux下的显示效果</p></div>
]]></content:encoded>
			<wfw:commentRss>http://blog.losthit.com/archives/how-to-create-dynamic-motd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>R61在linux/debian下安装madwifi无线驱动</title>
		<link>http://blog.losthit.com/archives/tp-r61i-madwifi-wireless-in-debian-linux/</link>
		<comments>http://blog.losthit.com/archives/tp-r61i-madwifi-wireless-in-debian-linux/#comments</comments>
		<pubDate>Mon, 05 Apr 2010 16:06:07 +0000</pubDate>
		<dc:creator>Zealot</dc:creator>
				<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ath5k]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[madwifi]]></category>
		<category><![CDATA[wireless]]></category>

		<guid isPermaLink="false">http://blog.losthit.com/?p=313</guid>
		<description><![CDATA[本文记录Thinkpad R61i在debian lenny下安装madwifi驱动程序，替代ath5k，实现无线上网。 主要参考：http://forum.ubuntu.org.cn/viewtopic.php?f=116&#38;t=169205。 仅作为tp安装linux的备忘，欢迎评论。 1. 下载 Download ... ]]></description>
			<content:encoded><![CDATA[<p>本文记录Thinkpad R61i在debian lenny下安装madwifi驱动程序，替代ath5k，实现无线上网。<br />
主要参考：http://forum.ubuntu.org.cn/viewtopic.php?f=116&amp;t=169205。<br />
仅作为tp安装linux的备忘，欢迎评论。</p>
<pre>
1. 下载
   Download the latest madwifi snapshot. // Google it

2. 解压
   $ tar zxvf madwifi-hal-0.10.5.6-current.tar.gz

3. 编译安装madwifi // 首先通过apt安装编译环境
   $ sudo aptitude install build-essential linux-headers-$(uname -r)
   $ make
   $ sudo make install

4. 安装module
   $ sudo modprobe ath_pci

5. 使网卡每次开机时都加载, make it load every time you boot
   $ sudo vi /etc/modules
   添加一行，如下
     ath_pci

6. 重新启动机器
   $ sudo reboot

注释 &#038;&#038; 备忘
1. 为保证生效，重启前确认已屏蔽ath5k（默认驱动程序有可能是这个）
   检查是否已安装ath5k
   $ lsmod |grep ath5k
   有，则添加到blacklist
   $ cat /etc/modprobe.d/blacklist.conf
     blacklist ath5k
2. 确认安装驱动是否成功
   $ lsmod | grep ath_pci
     ath_pci               201176  0
     wlan                  193392  5 wlan_wep,wlan_scan_sta,ath_rate_sample,ath_pci
     ath_hal               300768  3 ath_rate_sample,ath_pci
3. 硬件型号查看
   $ lspci |grep Ethernet
     00:19.0 Ethernet controller: Intel Corporation 82566MM Gigabit Network Connection (rev 03)
     03:00.0 Ethernet controller: Atheros Communications Inc. AR242x 802.11abg Wireless PCI Express Adapter (rev 01)
4. ath5k是madwifi替代品，除非ath5k下无法连接无线，不建议使用madwifi
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.losthit.com/archives/tp-r61i-madwifi-wireless-in-debian-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux/Debian字体去掉锯齿的方法</title>
		<link>http://blog.losthit.com/archives/linux-debian-antialias/</link>
		<comments>http://blog.losthit.com/archives/linux-debian-antialias/#comments</comments>
		<pubDate>Wed, 21 Oct 2009 05:46:24 +0000</pubDate>
		<dc:creator>Zealot</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[antialias]]></category>
		<category><![CDATA[antialiasing]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[fonts]]></category>
		<category><![CDATA[openbox]]></category>
		<category><![CDATA[反锯齿]]></category>
		<category><![CDATA[字体]]></category>
		<category><![CDATA[清晰]]></category>

		<guid isPermaLink="false">http://blog.losthit.com/?p=131</guid>
		<description><![CDATA[Linux/Debian字体去掉锯齿的方法 在台式机上装了个Debian，但不知道怎么设置字体清晰，网上找了很多方法，都不好使，一直都很模 糊地讲究着。不过把字号稍微设置大点就不模糊了，浏览网页和... ]]></description>
			<content:encoded><![CDATA[<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">
<p>Linux/Debian字体去掉锯齿的方法</p></div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">在台式机上装了个Debian，但不知道怎么设置字体清晰，网上找了很多方法，都不好使，一直都很模</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">糊地讲究着。不过把字号稍微设置大点就不模糊了，浏览网页和用terminal都没问题，只是菜单栏地</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">址栏什么的基本看不清楚。</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">今天突然上网搜了一下，看到这个词antialias，突然想起来我没改过这个。赶紧看看~/.fonts.conf</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">。果然，里面antialias设为false，这个应该是反锯齿选项，设为true：</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">&lt;edit mode=”assign” name=”antialias” &gt;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">&lt;bool&gt;true&lt;/bool&gt;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">&lt;/edit&gt;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">然后ctrl+alt+backspace重启x，菜单栏小字体都清晰了，Great，哈哈:-)</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">上两张图</div>
<p>在台式机上装了个Debian，但不知道怎么设置字体清晰，网上找了很多方法，都不好使，一直都很模</p>
<p>糊地将就着。不过把字号稍微设置大点就不模糊了，浏览网页和用terminal都没问题，只是菜单栏地</p>
<p>址栏什么的基本看不清楚。</p>
<p>今天突然上网搜了一下，看到这个词antialias，突然想起来我没改过这个。赶紧看看~/.fonts.conf</p>
<p>。果然，里面antialias设为false，这个应该是反锯齿选项，设为true：</p>
<p>&lt;edit mode=”assign” name=”antialias” &gt;</p>
<p>&lt;bool&gt;true&lt;/bool&gt;</p>
<p>&lt;/edit&gt;</p>
<p>然后ctrl+alt+backspace重启x，菜单栏小字体都清晰了，Great，哈哈:-)</p>
<p>上几张图看看</p>
<p>1. 桌面的菜单 &#8211; 有锯齿，很模糊</p>
<div id="attachment_132" class="wp-caption alignnone" style="width: 558px"><a href="http://blog.losthit.com/wp-content/uploads/2009/10/menu-turn-off-antialias.png"><img class="size-full wp-image-132 " title="menu turn off antialias" src="http://blog.losthit.com/wp-content/uploads/2009/10/menu-turn-off-antialias.png" alt="menu turn off antialias" width="548" height="436" /></a><p class="wp-caption-text">menu turn off antialias</p></div>
<p>2. 再看看打开反锯齿功能后的菜单</p>
<div id="attachment_133" class="wp-caption alignnone" style="width: 574px"><a href="http://blog.losthit.com/wp-content/uploads/2009/10/menu-turn-on-antialias.png"><img class="size-full wp-image-133 " title="menu turn on antialias" src="http://blog.losthit.com/wp-content/uploads/2009/10/menu-turn-on-antialias.png" alt="开启反锯齿效果的菜单" width="564" height="427" /></a><p class="wp-caption-text">开启反锯齿效果的菜单</p></div>
<p>3. firefox：取消反锯齿的firefox看小字体的文字没法用，大字体还好，每次都得ctrl++来放大字体</p>
<div id="attachment_134" class="wp-caption alignnone" style="width: 1002px"><a href="http://blog.losthit.com/wp-content/uploads/2009/10/firefox-turn-off-antialias.png"><img class="size-full wp-image-134 " title="firefox turn off antialias" src="http://blog.losthit.com/wp-content/uploads/2009/10/firefox-turn-off-antialias.png" alt="取消反锯齿的firefox，太模糊了" width="992" height="715" /></a><p class="wp-caption-text">取消反锯齿的firefox，太模糊了</p></div>
<p>4. 在看一下开启反锯齿效果后的firefox</p>
<div id="attachment_135" class="wp-caption alignnone" style="width: 1002px"><a href="http://blog.losthit.com/wp-content/uploads/2009/10/firefox-turn-on-antialias.png"><img class="size-full wp-image-135 " title="firefox, turn on antialias" src="http://blog.losthit.com/wp-content/uploads/2009/10/firefox-turn-on-antialias.png" alt="开启反锯齿效果后的firefox" width="992" height="717" /></a><p class="wp-caption-text">开启反锯齿效果后的firefox</p></div>
]]></content:encoded>
			<wfw:commentRss>http://blog.losthit.com/archives/linux-debian-antialias/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>解决apt-get中依赖的库无法安装的问题</title>
		<link>http://blog.losthit.com/archives/apt-get-depends-purge-remove/</link>
		<comments>http://blog.losthit.com/archives/apt-get-depends-purge-remove/#comments</comments>
		<pubDate>Tue, 28 Apr 2009 11:11:06 +0000</pubDate>
		<dc:creator>Zealot</dc:creator>
				<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[apt-get]]></category>
		<category><![CDATA[remove]]></category>
		<category><![CDATA[vim]]></category>
		<category><![CDATA[vim-full]]></category>

		<guid isPermaLink="false">http://zealot.hitidea.org/?p=85</guid>
		<description><![CDATA[今天apt-get install vim-full的时候，出现了错误，详见后面。原因不清楚，估计是sun-java5-jre这个包相关的东西出了问题，彻底清除了试试：sudo apt-get --purge remove sun-java5-jre，然后重新装上。。
再来s... ]]></description>
			<content:encoded><![CDATA[<p>今天apt-get install vim-full的时候，出现了错误，详见后面。原因不清楚，估计是sun-java5-jre这个包相关的东西出了问题，彻底清除了试试：sudo apt-get &#8211;purge remove sun-java5-jre，然后重新装上。。<br />
再来sudo apt-get install vim-full，OK。</p>
<p>Reading package lists&#8230;<br />
Building dependency tree&#8230;<br />
You might want to run `apt-get -f install&#8217; to correct these:<br />
The following packages have unmet dependencies:<br />
sun-java5-jre: Depends: sun-java5-bin (= 1.5.0-14-1etch1) but it is not going to be installed or<br />
ia32-sun-java5-bin (= 1.5.0-14-1etch1) but it is not installable<br />
vim-full: Depends: vim-gui-common (= 1:7.0-122+1etch5) but it is not going to be installed<br />
Depends: vim-common (= 1:7.0-122+1etch5) but 1:7.0-122+1etch3 is to be installed<br />
Depends: vim-runtime (= 1:7.0-122+1etch5) but 1:7.0-122+1etch3 is to be installed<br />
Depends: libart-2.0-2 (&gt;= 2.3.16) but it is not going to be installed<br />
Depends: libatk1.0-0 (&gt;= 1.12.2) but it is not going to be installed<br />
Depends: libbonobo2-0 (&gt;= 2.13.0) but it is not going to be installed<br />
Depends: libbonoboui2-0 (&gt;= 2.5.4) but it is not going to be installed<br />
Depends: libcairo2 (&gt;= 1.2.4) but it is not going to be installed<br />
Depends: libgconf2-4 (&gt;= 2.13.5) but it is not going to be installed<br />
Depends: libglib2.0-0 (&gt;= 2.12.0) but it is not going to be installed<br />
Depends: libgnome-keyring0 (&gt;= 0.6.0) but it is not going to be installed<br />
Depends: libgnome2-0 (&gt;= 2.14.1) but it is not going to be installed<br />
Depends: libgnomecanvas2-0 (&gt;= 2.11.1) but it is not going to be installed<br />
Depends: libgnomeui-0 (&gt;= 2.13.0) but it is not going to be installed<br />
Depends: libgnomevfs2-0 (&gt;= 2.13.92) but it is not going to be installed<br />
Depends: libgtk2.0-0 (&gt;= 2.8.0) but it is not going to be installed<br />
Depends: liborbit2 (&gt;= 1:2.14.1) but it is not going to be installed<br />
Depends: libpango1.0-0 (&gt;= 1.14.8) but it is not going to be installed<br />
Depends: libperl5.8 (&gt;= 5.8.8) but it is not going to be installed<br />
Depends: libruby1.8 (&gt;= 1.8.5) but it is not going to be installed<br />
Depends: libxcursor1 (&gt; 1.1.2) but it is not going to be installed<br />
Depends: libxfixes3 (&gt;= 1:4.0.1) but it is not going to be installed<br />
Depends: libxi6 but it is not going to be installed<br />
Depends: libxinerama1 but it is not going to be installed<br />
Depends: libxrandr2 but it is not going to be installed<br />
Depends: libxrender1 but it is not going to be installed<br />
Depends: tcl8.4 (&gt;= 8.4.5) but it is not going to be installed</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.losthit.com/archives/apt-get-depends-purge-remove/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux 入门：阅读man手册</title>
		<link>http://blog.losthit.com/archives/linux-%e5%85%a5%e9%97%a8%ef%bc%9a%e9%98%85%e8%af%bbman%e6%89%8b%e5%86%8c/</link>
		<comments>http://blog.losthit.com/archives/linux-%e5%85%a5%e9%97%a8%ef%bc%9a%e9%98%85%e8%af%bbman%e6%89%8b%e5%86%8c/#comments</comments>
		<pubDate>Thu, 30 Oct 2008 20:55:15 +0000</pubDate>
		<dc:creator>Zealot</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[man]]></category>
		<category><![CDATA[page]]></category>
		<category><![CDATA[手册]]></category>
		<category><![CDATA[阅读]]></category>

		<guid isPermaLink="false">http://losthit.com/?p=33</guid>
		<description><![CDATA[From ： http://www.fire3.cn/2008/08/03/linux-howto-read-man-page.html     搜索和打印介绍不错：）     1 什么是man手册     首先，man是manual的简称，中文说法可以是手册。     在Linux世界中，许多新手请教... ]]></description>
			<content:encoded><![CDATA[<p><span style="font-size:10pt">From ： <a href="http://www.fire3.cn/2008/08/03/linux-howto-read-man-page.html">http://www.fire3.cn/2008/08/03/linux-howto-read-man-page.html</a><br />
</span></p>
<p> <br />
 </p>
<p><span style="font-size:10pt">搜索和打印介绍不错：）<br />
</span></p>
<p> <br />
 </p>
<p><span style="font-size:10pt">1 什么是man手册<br />
</span></p>
<p> <br />
 </p>
<p><span style="font-size:10pt">首先，man是manual的简称，中文说法可以是手册。<br />
</span></p>
<p> <br />
 </p>
<p><span style="font-size:10pt">在Linux世界中，许多新手请教某条命令的用法时， 好多不耐心的老手通常会用一条命令来回答这位无助的新手，而这条命令通常<br />
</span></p>
<p><span style="font-size:10pt">就是man开头。无助的新手敲上这条命令一看究竟，在终端上顿时显示出来了一屏幕的英文，<br />
</span></p>
<p><span style="font-size:10pt">老手的意思是，自己看看手册吗，可是看手册也是有学问的，无助的新手甚<br />
</span></p>
<p><span style="font-size:10pt">至不知道怎么退出这条命令呢。下面我们就来讲解一下看man手册的学问。<br />
</span></p>
<p><span style="font-size:10pt">2 从man手册中获取有用的信息<br />
</span></p>
<p> <br />
 </p>
<p><span style="font-size:10pt">我们先以mkdir命令来解释读man手册的一些入门知识。<br />
</span></p>
<p> <br />
 </p>
<p><span style="font-size:10pt">MKDIR(1)     User Commands              MKDIR(1)<br />
</span></p>
<p> <br />
 </p>
<p><span style="font-size:10pt">NAME<br />
</span></p>
<p><span style="font-size:10pt"> mkdir &#8211; make directories<br />
</span></p>
<p> <br />
 </p>
<p><span style="font-size:10pt">SYNOPSIS<br />
</span></p>
<p><span style="font-size:10pt"> mkdir [OPTION] DIRECTORY&#8230;<br />
</span></p>
<p> <br />
 </p>
<p><span style="font-size:10pt">DESCRIPTION<br />
</span></p>
<p><span style="font-size:10pt"> Create the DIRECTORY(ies), if they do not already exist.<br />
</span></p>
<p> <br />
 </p>
<p><span style="font-size:10pt"> Mandatory arguments to long options are mandatory for short options too.<br />
</span></p>
<p> <br />
 </p>
<p><span style="font-size:10pt"> -m, &#8211;mode=MODE<br />
</span></p>
<p><span style="font-size:10pt"> set file mode (as in chmod), not a=rwx &#8211; umask<br />
</span></p>
<p> <br />
 </p>
<p><span style="font-size:10pt"> -p, &#8211;parents<br />
</span></p>
<p><span style="font-size:10pt"> no error if existing, make parent directories as needed<br />
</span></p>
<p> <br />
 </p>
<p><span style="font-size:10pt"> -v, &#8211;verbose<br />
</span></p>
<p><span style="font-size:10pt"> print a message for each created directory<br />
</span></p>
<p> <br />
 </p>
<p><span style="font-size:10pt"> -Z, &#8211;context=CTX<br />
</span></p>
<p><span style="font-size:10pt"> set the SELinux security context of each created directory to CTX<br />
</span></p>
<p> <br />
 </p>
<p><span style="font-size:10pt"> &#8211;help display this help and exit<br />
</span></p>
<p> <br />
 </p>
<p><span style="font-size:10pt"> &#8211;version<br />
</span></p>
<p><span style="font-size:10pt"> output version information and exit<br />
</span></p>
<p> <br />
 </p>
<p><span style="font-size:10pt">AUTHOR<br />
</span></p>
<p><span style="font-size:10pt"> Written by David MacKenzie.<br />
</span></p>
<p> <br />
 </p>
<p><span style="font-size:10pt">REPORTING BUGS<br />
</span></p>
<p><span style="font-size:10pt"> Report bugs to &lt;bug-coreutils@gnu.org&gt;.<br />
</span></p>
<p> <br />
 </p>
<p><span style="font-size:10pt">COPYRIGHT<br />
</span></p>
<p><span style="font-size:10pt"> Copyright (C) 2008 Free Software Foundation, Inc.  License GPLv3+: GNU GPL version 3 or later &lt;<a href="http://gnu.org/licenses/gpl.html">http://gnu.org/licenses/gpl.html</a>&gt;<br />
</span></p>
<p> <br />
 </p>
<p><span style="font-size:10pt"> This is free software: you are free to change and redistribute it.  There is NO WARRANTY, to the extent permitted by law.<br />
</span></p>
<p> <br />
 </p>
<p><span style="font-size:10pt">SEE ALSO<br />
</span></p>
<p> <br />
 </p>
<p><span style="font-size:10pt"> mkdir(2)<br />
</span></p>
<p> <br />
 </p>
<p><span style="font-size:10pt"> The  full documentation for mkdir is maintained as a Texinfo manual.  If the info and mkdir programs are properly installed at your site, the com-<br />
</span></p>
<p> <br />
 </p>
<p><span style="font-size:10pt"> mand<br />
</span></p>
<p> <br />
 </p>
<p><span style="font-size:10pt"> info coreutils &#8216;mkdir invocation&#8217;<br />
</span></p>
<p> <br />
 </p>
<p><span style="font-size:10pt"> should give you access to the complete manual.<br />
</span></p>
<p> <br />
 </p>
<p><span style="font-size:10pt">首先第一行 MKDIR(1)，显然，MKDIR是命令的大写，那么为什么有个(1)呢，那是因为man手册页有如下的规定：<br />
</span></p>
<p><span style="font-size:10pt">Section         名称         说明<br />
</span></p>
<p><span style="font-size:10pt">l         本地文档         与本特定系统有关的<br />
</span></p>
<p><span style="font-size:10pt">1         用户命令         可由任何人启动的<br />
</span></p>
<p><span style="font-size:10pt">2         系统调用         即由内核提供的函数<br />
</span></p>
<p><span style="font-size:10pt">3         例程         即库函数<br />
</span></p>
<p><span style="font-size:10pt">4         设备         即/dev目录下的特殊文件<br />
</span></p>
<p><span style="font-size:10pt">5         文件格式描述         例如/etc/passwd<br />
</span></p>
<p><span style="font-size:10pt">6         游戏         不用解释啦<br />
</span></p>
<p><span style="font-size:10pt">7         杂项         例如宏命令包、惯例等<br />
</span></p>
<p><span style="font-size:10pt">8         系统管理员工具         只能由root启动<br />
</span></p>
<p><span style="font-size:10pt">9         其他（Linux特定的）         用来存放内核例行程序的文档<br />
</span></p>
<p><span style="font-size:10pt">n         新文档         可能要移到更适合的领域<br />
</span></p>
<p><span style="font-size:10pt">o         老文档         可能会在一段期限内保留<br />
</span></p>
<p> <br />
 </p>
<p><span style="font-size:10pt">MKDIR(1)表示该命令属于Section 1，为用户命令，类似的man<br />
</span></p>
<p><span style="font-size:10pt">apt-get会看到APT-GET(8)，表示apt-get命令为系统管理工具。<br />
</span></p>
<p> <br />
 </p>
<p><span style="font-size:10pt">“NAME”部分是该命令的名字和简单的解释，显然，在命令行中要执行该命令要使用到它的名称。<br />
</span></p>
<p> <br />
 </p>
<p><span style="font-size:10pt">“SNOPSIS”是摘要部分，简要解释该命令如何使用，比如mkdir的摘要：<br />
</span></p>
<p><span style="font-size:10pt">mkdir [OPTION] DIRECTORY…，读到这里便需要讲解一下了：<br />
</span></p>
<p> <br />
 </p>
<p><span style="font-size:10pt">“OPTIONS”左右有”["和"]“，表示这些参数并不必须，但是可以使用。对应的DIRECTORY两边没有”[]“，就是必须要加的参数了。<br />
</span></p>
<p><span style="font-size:10pt">另外，它们后面都有”…” ，表示这些参数可以重复使用多次。至于OPTIONS具体怎么用，就要看DESCRIPTION部分了。下面举几个简单的例子，并配合例子解释：<br />
</span></p>
<p><span style="font-size:10pt">用法         解释<br />
</span></p>
<p><span style="font-size:10pt">mkdir tmp         创建 tmp 目录<br />
</span></p>
<p><span style="font-size:10pt">mkdir –mode=a+w tmp         创建一个模式为”a+w”的tmp目录，–mode是长参数，用法是–mode=MODE，在DESCRIPTION里说明<br />
</span></p>
<p><span style="font-size:10pt">mkdir -m a+w tmp         创建一个模式为”a+w”的tmp目录，-m 是短参数，不用加 = 号，效果等同 –mode=MODE<br />
</span></p>
<p><span style="font-size:10pt">mkdir -mv a+w tmp         创建一个模式为”a+w”的tmp目录，同时显示信息，verbose模式，-mv可以一起用<br />
</span></p>
<p><span style="font-size:10pt">mkdir -v -m a+w tmp         创建一个模式为”a+w”的tmp目录，同时显示信息，verbose模式，-v后面接一个空格再用-m<br />
</span></p>
<p><span style="font-size:10pt">3 man手册页的操作<br />
</span></p>
<p><span style="font-size:10pt">3.1 退出man<br />
</span></p>
<p> <br />
 </p>
<p><span style="font-size:10pt">最简单，按下”q”键<br />
</span></p>
<p><span style="font-size:10pt">3.2 查找<br />
</span></p>
<p> <br />
 </p>
<p><span style="font-size:10pt">如果你知道要打开的手册页，在man命令打开的手册页中可以用<br />
</span></p>
<p><span style="font-size:10pt">“/” 键进行正则表达式的搜索。<br />
</span></p>
<p> <br />
 </p>
<p><span style="font-size:10pt">如果不知道所要打开的手册页名称，可以用 “man<br />
</span></p>
<p><span style="font-size:10pt">-k”命令搜索相关的手册页，比如：<br />
</span></p>
<p> <br />
 </p>
<p><span style="font-size:10pt">man -k postscript<br />
</span></p>
<p> <br />
 </p>
<p><span style="font-size:10pt">会给出一堆关于”postscript”的相关命令页。<br />
</span></p>
<p><span style="font-size:10pt">3.3 打印<br />
</span></p>
<p> <br />
 </p>
<p><span style="font-size:10pt">最简单的办法，以mkdir为例：<br />
</span></p>
<p> <br />
 </p>
<p><span style="font-size:10pt">man -t mkdir &gt; mkdir_man.ps<br />
</span></p>
<p> <br />
 </p>
<p><span style="font-size:10pt">可以直接打印ps，打算发给别人打印的话，转换成pdf也比较方便：<br />
</span></p>
<p> <br />
 </p>
<p><span style="font-size:10pt">ps2pdf mkdir_man.ps mkdir_man.pdf<br />
</span></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.losthit.com/archives/linux-%e5%85%a5%e9%97%a8%ef%bc%9a%e9%98%85%e8%af%bbman%e6%89%8b%e5%86%8c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Squid安装、配置和使用</title>
		<link>http://blog.losthit.com/archives/squid_info/</link>
		<comments>http://blog.losthit.com/archives/squid_info/#comments</comments>
		<pubDate>Wed, 08 Oct 2008 15:39:53 +0000</pubDate>
		<dc:creator>Zealot</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[squid]]></category>
		<category><![CDATA[安装]]></category>
		<category><![CDATA[配置]]></category>

		<guid isPermaLink="false">http://losthit.com/2008/10/08/squid%e5%ae%89%e8%a3%85%e3%80%81%e9%85%8d%e7%bd%ae%e5%92%8c%e4%bd%bf%e7%94%a8/</guid>
		<description><![CDATA[获取Squid Squid主页：http://www.squid-cache.org/ 。下载源码。 将源码解压缩到某个目录，这里我在/tmp目录解压缩：tar zxvf squid-3.0.STABLE9.tar.gz ./configure &#8211;prefix=/usr/local/squid。其他各种选项可以参考... ]]></description>
			<content:encoded><![CDATA[<ul>
<li>
<div><span style="font-size:10pt"><br />
获取Squid<br />
</span></div>
<ul>
<li><span style="font-size:10pt">Squid主页：<a href="http://www.squid-cache.org/">http://www.squid-cache.org/</a> 。下载源码。<br />
</span></li>
<li><span style="font-size:10pt">将源码解压缩到某个目录，这里我在/tmp目录解压缩：tar zxvf squid-3.0.STABLE9.tar.gz<br />
</span></li>
<li><span style="font-size:10pt">./configure &#8211;prefix=/usr/local/squid。其他各种选项可以参考：<a href="http://blog.s135.com/book/squid/chap03.html">http://blog.s135.com/book/squid/chap03.html</a><br />
</span></li>
<li><span style="font-size:10pt">make all<br />
</span></li>
<li><span style="font-size:10pt">make install<br />
</span></li>
</ul>
</li>
<li><span style="font-size:10pt">编译安装<br />
</span></li>
<li><span style="font-size:10pt">快速配置<br />
</span></li>
<li><span style="font-size:10pt">运行Squid<br />
</span></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.losthit.com/archives/squid_info/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>chmod 命令</title>
		<link>http://blog.losthit.com/archives/chmod-usage-2/</link>
		<comments>http://blog.losthit.com/archives/chmod-usage-2/#comments</comments>
		<pubDate>Wed, 06 Aug 2008 08:39:10 +0000</pubDate>
		<dc:creator>Zealot</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[chmod]]></category>
		<category><![CDATA[使用]]></category>
		<category><![CDATA[命令]]></category>

		<guid isPermaLink="false">http://losthit.com/?p=20</guid>
		<description><![CDATA[这个命令用的比较多了，作用很简单：改变文件的权限 平时主要能涉及到的就读写执行三种权限了，分别对应rwx 主要形式用的比较多的就是:”chmod 三个数字表示权限 文件” 和 “chomd a+x 文件... ]]></description>
			<content:encoded><![CDATA[<p>这个命令用的比较多了，作用很简单：改变文件的权限</p>
<p>平时主要能涉及到的就读写执行三种权限了，分别对应rwx</p>
<p>主要形式用的比较多的就是:”chmod 三个数字表示权限 文件” 和 “chomd a+x 文件”，其中a表示所有用户，还有u，g，加好增加相应权限，减号相反。目录的执行权限定义不一样。</p>
<p>详细介绍如下：</p>
<p><a href="http://blog.csdn.net/chenshaoying/archive/2008/08/04/2767064.aspx" target="_blank">http://blog.csdn.net/chenshaoying/archive/2008/08/04/2767064.aspx</a></p>
<p>chmod用于改变文件或目录的访问权限。用户用它控制文件或目录的访问权限。该命令有两种用法。一种是包含字母和操作符表达式的文字设定法；另一种是包含数字的数字设定法。</p>
<h4>1. 文字设定法</h4>
<pre>语法：chmod [who] [+ | - | =] [mode] 文件名</pre>
<p>命令中各选项的含义为：</p>
<pre>操作对象who可是下述字母中的任一个或者它们的组合：
　　u 表示“用户（user）”，即文件或目录的所有者。
　　g 表示“同组（group）用户”，即与文件属主有相同组ID的所有用户。
　　o 表示“其他（others）用户”。
　　a 表示“所有（all）用户”。它是系统默认值。
操作符号可以是：
　　+ 添加某个权限。
　　- 取消某个权限。
　　= 赋予给定权限并取消其他所有权限（如果有的话）。
设置 mode 所表示的权限可用下述字母的任意组合：
　　r 可读。
　　w 可写。
  　x 可执行。
　　X 只有目标文件对某些用户是可执行的或该目标文件是目录时才追加x 属性。
　　s 在文件执行时把进程的属主或组ID置为该文件的文件属主。
      方式“u＋s”设置文件的用户ID位，“g＋s”设置组ID位。
　　t 保存程序的文本到交换设备上。
　　u 与文件属主拥有一样的权限。
　　g 与和文件属主同组的用户拥有一样的权限。
　　o 与其他用户拥有一样的权限。
文件名：以空格分开的要改变权限的文件列表，支持通配符。</pre>
<p>在一个命令行中可给出多个权限方式，其间用逗号隔开。例如：</p>
<pre>chmod g+r，o+r example  % 使同组和其他用户对文件example 有读权限。</pre>
<h4>2. 数字设定法</h4>
<p>我们必须首先了解用数字表示的属性的含义：0表示没有权限，1表示可执行权限， 2表示可写权限，4表示可读权限，然后将其相加。所以数字属性的格式应为3个从0到7的八进制数，其顺序是（u）（g）（o）。</p>
<p>例如，如果想让某个文件的属主有“读/写”二种权限，需要把4（可读）+2（可写）＝6（读/写）。</p>
<p>数字设定法的一般形式为：</p>
<pre>语法：chmod [mode] 文件名</pre>
<p><strong>指令实例：</strong></p>
<pre>chmod a+x sort
% 即设定文件sort的属性为：
　文件属主（u） 增加执行权限
　与文件属主同组用户（g） 增加执行权限
　其他用户（o） 增加执行权限

chmod ug+w，o-x text
% 即设定文件text的属性为：
　文件属主（u） 增加写权限
　与文件属主同组用户（g） 增加写权限
　其他用户（o） 删除执行权限

chmod u+s a.out
% 假设执行chmod后a.out的权限为（可以用ls – l a.out命令来看）：
　–rws--x--x 1 inin users 7192 Nov 4 14:22 a.out
　并且这个执行文件要用到一个文本文件shiyan1.c，其文件存取权限为“–rw-------”，
  即该文件只有其属主具有读写权限。
　  当其他用户执行a.out这个程序时，他的身份因这个程序暂时变成inin（由于chmod
  命令中使用了s选项），所以他就能够读取shiyan1.c这个文件（虽然这个文件被设定为
  其他人不具备任何权限），这就是s的功能。
　　因此，在整个系统中特别是root本身，最好不要过多的设置这种类型的文件（除非
  必要）这样可以保障系统的安全，避免因为某些程序的bug而使系统遭到入侵。

chmod a–x mm.txt
chmod –x mm.txt
chmod ugo–x mm.txt
% 以上这三个命令都是将文件mm.txt的执行权限删除，它设定的对象为所有使用者。

$ chmod 644 mm.txt
% 即设定文件mm.txt的属性为：-rw-r--r--
　文件属主（u）inin 拥有读、写权限
　与文件属主同组人用户（g） 拥有读权限
　其他人（o） 拥有读权限

chmod 750 wch.txt
% 即设定wchtxt这个文件的属性为：-rwxr-x---
　文件主本人（u）inin 可读/可写/可执行权
　与文件主同组人（g） 可读/可执行权
　其他人（o） 没有任何权限</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.losthit.com/archives/chmod-usage-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

