<?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>Information Retrieval Blog &#187; Linux</title>
	<atom:link href="http://blog.zye.me/category/%e5%ad%a6%e6%9c%af%e7%a0%94%e7%a9%b6/linux/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.zye.me</link>
	<description>REAL TIME DATA PROCESSING, DISTRIBUTED COMPUTING, PATTERN DISCOVERY</description>
	<lastBuildDate>Tue, 31 Jan 2012 02:05:19 +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>Figure format conversion in Linux</title>
		<link>http://blog.zye.me/2010/02/55549.html</link>
		<comments>http://blog.zye.me/2010/02/55549.html#comments</comments>
		<pubDate>Mon, 22 Feb 2010 18:54:20 +0000</pubDate>
		<dc:creator>yezheng</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Figure]]></category>

		<guid isPermaLink="false">http://blog.so8848.com/?p=55549</guid>
		<description><![CDATA[EPS 2 PNG Manual conversion Open the file in the GIMP (make sure you have ghostscript installed! — Windows Ghostscript installation instructions) Enter 500 in the &#8220;resolution&#8221; input box You may need to uncheck &#8220;try bounding box&#8221;, since the bounding box sometimes cuts off part of the image. Enter large values for Height and Width if not using the bounding <a href='http://blog.zye.me/2010/02/55549.html'>[...]</a>]]></description>
			<content:encoded><![CDATA[<h2>EPS 2 PNG</h2>
<h4>Manual conversion</h4>
<ol>
<li>Open the file in the <a title="w:GIMP" href="http://en.wikipedia.org/wiki/GIMP">GIMP</a> (make sure you have <a title="w:ghostscript" href="http://en.wikipedia.org/wiki/ghostscript">ghostscript</a> installed! — <a rel="nofollow" href="http://www.kirchgessner.net/gimp.html#PSGS">Windows Ghostscript installation instructions</a>)
<ul>
<li>Enter 500 in the &#8220;resolution&#8221; input box</li>
<li>You may need to uncheck &#8220;try bounding box&#8221;, since the bounding box sometimes cuts off part of the image.
<ul>
<li>Enter large values for <em>Height</em> and <em>Width</em> if not using the bounding box</li>
</ul>
</li>
<li>Select color</li>
<li>Select strong anti-aliasing for both graphics and text</li>
</ul>
</li>
<li>Crop off extra whitespace (shift+C if you can&#8217;t find it in the toolbox)</li>
<li><em>Image</em> → <em>Transform</em> → Rotate 90 degrees clockwise</li>
<li><em>Filters</em> → <em>Blur</em> → <em><a title="w:Gaussian blurred" href="http://en.wikipedia.org/wiki/Gaussian_blurred">Gaussian blur</a></em> (No need to blur if you use strong anti-aliasing during conversion. No significant difference between end results.)
<ul>
<li>2.0 px</li>
</ul>
</li>
<li><em>Image</em> → <em>Scale Image&#8230;</em>
<ul>
<li>25%</li>
<li>Cubic interpolation</li>
</ul>
</li>
<li>You can view at normal size if you want by pressing 1, Ctrl+E</li>
<li>Save as <em>File_name.png</em></li>
</ol>
<ul>
<li><a rel="nofollow" href="http://docs.gimp.org/en/">The GIMP documentation</a></li>
</ul>
<h4>Command-line method</h4>
<p>Another route to convert a PS or EPS file (postscript) in png is to use <a title="ImageMagick" href="/wiki/ImageMagick">ImageMagick</a>, available on many <a title="Operating system" href="/wiki/Operating_system">operating systems</a>. A single command is needed:</p>
<pre>convert -density 300 file.ps file.png</pre>
<p>The <strong>density parameter is the output resolutio</strong>n, expressed in <a title="Dots per inch" href="/wiki/Dots_per_inch">dots per inch</a>. With the standard 5&#215;3.5in size of a gnuplot graph, this results in a 1500&#215;1050 pixels PNG image. ImageMagick automatically applies antialiasing, so no post-processing is needed, making this technique especially suited to batch processing. The following <a title="Makefile" href="/wiki/Makefile">Makefile</a> automatically compiles all gnuplot files in a directory to EPS figures, converts them to PNG and then clears the intermediate EPS files. It assumes that all gnuplot files have a &#8220;.plt&#8221; extension and that they produce an EPS file with the same name, and the &#8220;.eps&#8221; extension:</p>
<pre><span style="color: #808080;">GNUPLOT_FILES = $(wildcard *.plt)
# create the target file list by substituting the extensions of the plt files
FICHIERS_PNG = $(patsubst %.plt,%.png,  $(GNUPLOT_FILES))

all: $(FICHIERS_PNG)

%.eps: %.plt
	@ echo "compillation of "$&lt;
	@gnuplot $&lt;

%.png: %.eps
	@echo "conversion in png format"
	@convert -density 300 $&lt; $*.png
	@echo "end"</span></pre>
<pre><span style="color: #808080;">
</span></pre>
<pre><span style="color: #808080;"><strong>What is EPS file format?</strong>
</span></pre>
<p>Encapsulated PostScript (EPS) is a standard file format for importing and exporting PostScript files. It is usually a single page PostScript program that describes an illustration or an entire page. The purpose of an EPS file is to be included in other pages. Sometimes EPS files are called EPSF files. EPSF simply stands for Encapsulated PostScript Format.</p>
<p>An EPS file can contain any combination of text, graphics and images. Since it is actually a PostScript file, it is one of the most versatile file formats that are available. EPS-files usually contain a small preview image that is used to visualize the content of the file.</p>
<h2><span style="color: #000000;">See also: </span></h2>
<pre><span style="color: #808080;">   <a href="http://mintaka.sdsu.edu/GF/bibliog/latex/PSandPNG.html">http://mintaka.sdsu.edu/GF/bibliog/latex/PSandPNG.html</a></span></pre>
<pre>   <a href="http://electron.mit.edu/~gsteele/pdf/">http://electron.mit.edu/~gsteele/pdf/</a></pre>
<pre><span style="color: #808080;">
</span></pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.zye.me/2010/02/55549.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>命令行解压＆压缩 全集 &#8211;Linux</title>
		<link>http://blog.zye.me/2010/02/55539.html</link>
		<comments>http://blog.zye.me/2010/02/55539.html#comments</comments>
		<pubDate>Mon, 22 Feb 2010 17:25:35 +0000</pubDate>
		<dc:creator>yezheng</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[compress]]></category>

		<guid isPermaLink="false">http://blog.so8848.com/?p=55539</guid>
		<description><![CDATA[﻿﻿Commands for Compress and Decompress .tar 解包： tar xvf FileName.tar 打包：tar cvf FileName.tar DirName （注：tar是打包，不是压缩！） &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; .gz 解压1：gunzip FileName.gz 解压2：gzip -d FileName.gz 压缩：gzip FileName .tar.gz 解压：tar zxvf FileName.tar.gz 压缩：tar zcvf FileName.tar.gz DirName &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; .bz2 解压1：bzip2 -d FileName.bz2 解压2：bunzip2 FileName.bz2 压缩： bzip2 -z FileName .tar.bz2 解压：tar jxvf FileName.tar.bz2 压缩：tar jcvf FileName.tar.bz2 DirName &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; .bz 解压1：bzip2 -d <a href='http://blog.zye.me/2010/02/55539.html'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p><strong>﻿﻿Commands for Compress and Decompress</strong></p>
<div>
<h2><strong>.tar</strong></h2>
<div><strong> </strong><br />
解包： tar xvf FileName.tar<br />
打包：tar cvf FileName.tar DirName<br />
（注：tar是打包，不是压缩！）<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</div>
<h2>.gz</h2>
<div>解压1：gunzip FileName.gz<br />
解压2：gzip -d FileName.gz<br />
压缩：gzip FileName<br />
.tar.gz<br />
解压：tar zxvf FileName.tar.gz<br />
压缩：tar zcvf FileName.tar.gz DirName</div>
<div>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</div>
<h2>.bz2</h2>
<div>解压1：bzip2 -d FileName.bz2<br />
解压2：bunzip2 FileName.bz2<br />
压缩： bzip2 -z FileName<br />
.tar.bz2<br />
解压：tar jxvf FileName.tar.bz2<br />
压缩：tar jcvf FileName.tar.bz2 DirName</div>
<div>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</div>
<h2>.bz</h2>
<div>解压1：bzip2 -d FileName.bz<br />
解压2：bunzip2 FileName.bz<br />
压缩：未知<br />
.tar.bz<br />
解压：tar jxvf FileName.tar.bz<br />
压缩：未知<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</div>
<h2>.Z</h2>
<div>解压：uncompress FileName.Z<br />
压缩：compress FileName<br />
.tar.Z<br />
解压：tar Zxvf FileName.tar.Z<br />
压缩：tar Zcvf FileName.tar.Z DirName</div>
<div>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</div>
<h2>.tgz</h2>
<div>解压：tar zxvf FileName.tgz<br />
压缩：未知<br />
.tar.tgz<br />
解压：tar zxvf FileName.tar.tgz<br />
压缩：tar zcvf FileName.tar.tgz FileName<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</div>
<h2>.zip</h2>
<div>解压：unzip FileName.zip<br />
压缩：zip FileName.zip DirName</div>
<div><strong>compress a directory</strong></div>
<div>zip -r FileName.zip DirName<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</div>
<h2>.rar</h2>
<div>解压：rar a FileName.rar<br />
压缩：r ar e FileName.rar</div>
<div>rar请到：<a rel="nofollow" href="http://www.rarsoft.com/download.htm">http://www.rarsoft.com/download.htm</a> 下载！<br />
解压后请将rar_static拷贝到/usr/bin目录（其他由$PATH环境变量指定的目录也可以）：<br />
[root@www2 tmp]# cp rar_static /usr/bin/rar<br />
command: unrar<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</div>
<h2>.lha</h2>
<div>解压：lha -e FileName.lha<br />
压缩：lha -a FileName.lha FileName</div>
<div>lha请到：<a rel="nofollow" href="http://www.infor.kanazawa-it.ac.jp/.../lhaunix/">http://www.infor.kanazawa-it.ac.jp/&#8230;/lhaunix/</a>下载！<br />
&gt;解压后请将lha拷贝到/usr/bin目录（其他由$PATH环境变量指定的目录也可以）：<br />
[root@www2 tmp]# cp lha /usr/bin/<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</div>
<h2>.rpm</h2>
<div>解包：rpm2cpio FileName.rpm | cpio -div</div>
<div>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
.tar .tgz .tar.gz .tar.Z .tar.bz .tar.bz2 .zip .cpio .rpm .deb .slp .arj .rar .ace .lha .lzh<br />
.lzx .lzs .arc .sda .sfx .lnx .zoo .cab .kar .cpt .pit .sit .sea<br />
解压：sEx x FileName.*<br />
压缩：sEx a FileName.* FileName</div>
<div>sEx只是调用相关程序，本身并无压缩、解压功能，请注意！<br />
sEx请到： <a rel="nofollow" href="http://sourceforge.net/projects/sex">http://sourceforge.net/projects/sex</a>下载！<br />
解压后请将sEx拷贝到/usr/bin目录（其他由$PATH环境变量指定的目录也可以）：<br />
[root@www2 tmp]# cp sEx /usr/bin/</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.zye.me/2010/02/55539.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>backup and sync with lftp</title>
		<link>http://blog.zye.me/2010/02/55529.html</link>
		<comments>http://blog.zye.me/2010/02/55529.html#comments</comments>
		<pubDate>Sun, 21 Feb 2010 07:07:20 +0000</pubDate>
		<dc:creator>yezheng</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[lftp]]></category>
		<category><![CDATA[linuex]]></category>
		<category><![CDATA[sync]]></category>

		<guid isPermaLink="false">http://blog.so8848.com/?p=55529</guid>
		<description><![CDATA[lftp is an amazing  command line ftp tool, which lets you operate remote files just like in a local filesystem in a terminal (bash).  If you work a lot with command line, I bet you would like it.  A frequently used functionality with lftp is backup or sync a remote directory with a local one. Here <a href='http://blog.zye.me/2010/02/55529.html'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>lftp is an amazing  command line ftp tool, which lets you operate remote files just like in a local filesystem in a terminal (bash).  If you work a lot with command line, I bet you would like it.  A frequently used functionality with lftp is backup or sync a remote directory with a local one.</p>
<p>Here is simple synchronization script using lftp.</p>
<p>﻿﻿</p>
<div id="_mcePaste"><span style="color: #33cccc;">#/bin/bash</span></div>
<div id="_mcePaste"><span style="color: #33cccc;">lftp -u user,password publish.163.com &lt;&lt;EOF</span></div>
<div id="_mcePaste"><span style="color: #33cccc;">set ftp:ssl-allow no</span></div>
<div id="_mcePaste"><span style="color: #33cccc;">#a slash &#8220;/&#8221; in local dir is used to keep the dir structure</span></div>
<div><span style="color: #33cccc;">mirror   print/ ~/tmp_install/print/</span></div>
<div id="_mcePaste"><span style="color: #33cccc;">mirror -R  ~/tmp_install/print/ print/</span></div>
<div id="_mcePaste"><span style="color: #33cccc;">quit 0</span></div>
<div id="_mcePaste"><span style="color: #33cccc;">EOF</span></div>
<div>
<p><span style="color: #33cccc;"><span style="color: #000000; font-family: 'Lucida Grande', Verdana, Lucida, Helvetica, Arial, sans-serif; line-height: normal; font-size: 13px;"> </span></span></p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding: 0px;">To write the script, you need to know how to use lftp to connect to an <acronym style="cursor: help; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: #000000; padding: 0px; margin: 0px;" title="File Transfer Protocol">FTP</acronym> server and synchronize a remote directory with a local one. If your <acronym style="cursor: help; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: #000000; padding: 0px; margin: 0px;" title="File Transfer Protocol">FTP</acronym> server supports anonymous connections, you can connect to it using the simple command:</p>
<pre class="code" style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; font-size: 12px; color: #000000; overflow-x: auto; overflow-y: auto; background-color: #f7f9fa; padding: 0.5em; border: 1px dashed #8cacbb;">lftp ftpsite</pre>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding: 0px;">If the server requires a user name and password, the connection command would look like:</p>
<pre class="code" style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; font-size: 12px; color: #000000; overflow-x: auto; overflow-y: auto; background-color: #f7f9fa; padding: 0.5em; border: 1px dashed #8cacbb;">lftp -u username,password ftpsite.</pre>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding: 0px;">To synchronize a remote directory with a folder on your hard disk, lftp utilizes the <code style="font-size: 12px; padding: 0px; margin: 0px;">mirror</code> command. Used without switches, this command syncs the current local and remote directories. You can also specify explicitly the source and target directories:</p>
<pre class="code" style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; font-size: 12px; color: #000000; overflow-x: auto; overflow-y: auto; background-color: #f7f9fa; padding: 0.5em; border: 1px dashed #8cacbb;">mirror path/to/source_directory path/to/target_directory</pre>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding: 0px;">The <code style="font-size: 12px; padding: 0px; margin: 0px;">mirror</code> command offers a comprehensive set of switches, which you can use to control the synchronization process. For example, used with the <code style="font-size: 12px; padding: 0px; margin: 0px;">–delete</code> switch, the <code style="font-size: 12px; padding: 0px; margin: 0px;">mirror</code>command deletes the files in the local folder that are not present in the remote directory, while the <code style="font-size: 12px; padding: 0px; margin: 0px;">–only-newer</code> option forces lftp to download only newer files. Another handy switch is <code style="font-size: 12px; padding: 0px; margin: 0px;">–exclude</code>; it allows you to specify which files and directories to skip during synchronization. And if you prefer to keep an eye on the syncing process, you can use the <code style="font-size: 12px; padding: 0px; margin: 0px;">–verbose</code>switch.</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding: 0px;">Typing all those switches every time you want to synchronize two directories can be a bit of a bother. Fortunately, lftp understands complex commands that can perform several actions in one fell swoop. All you have to do is to use the <code style="font-size: 12px; padding: 0px; margin: 0px;">-e</code> switch, so lftp stays connected and runs the specified commands:</p>
<pre class="code" style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; font-size: 12px; color: #000000; overflow-x: auto; overflow-y: auto; background-color: #f7f9fa; padding: 0.5em; border: 1px dashed #8cacbb;">lftp -u username,password -e "mirror --delete --only-newer --verbose path/to/source_directory path/to/target_directory" ftpsite</pre>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding: 0px;">Using this command, lftp connects to the <acronym style="cursor: help; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: #000000; padding: 0px; margin: 0px;" title="File Transfer Protocol">FTP</acronym> server using the provided credentials, and then runs the command(s) in the quotes. You can save the entire command in a text file, then run it by pointing lftp to it using the <code style="font-size: 12px; padding: 0px; margin: 0px;">-f</code> switch:</p>
<pre class="code" style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; font-size: 12px; color: #000000; overflow-x: auto; overflow-y: auto; background-color: #f7f9fa; padding: 0.5em; border: 1px dashed #8cacbb;">lftp -f /home/user/ftpscript.txt</pre>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding: 0px;">lftp has a few other clever tricks up its sleeve. The <code style="font-size: 12px; padding: 0px; margin: 0px;">at</code> switch can come in handy when you want to run the backup at a specific time. The following command, for example, runs at midnight:</p>
<pre class="code" style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; font-size: 12px; color: #000000; overflow-x: auto; overflow-y: auto; background-color: #f7f9fa; padding: 0.5em; border: 1px dashed #8cacbb;">lftp at 00:00 -u username,password -e "mirror --delete --only-newer --verbose path/to/source_directory path/to/target_directory" ftpsite &amp;</pre>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding: 0px;">Notice the ampersand, which sends the command to the background so you don’t have to keep the terminal window open.</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding: 0px;">Now you know how to create local backup of files and directories stored on an <acronym style="cursor: help; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: #000000; padding: 0px; margin: 0px;" title="File Transfer Protocol">FTP</acronym> server. But how do you restore the data if disaster strikes? Quite easily, actually. All you have to do is to add the <code style="font-size: 12px; padding: 0px; margin: 0px;">–reverse</code> switch to the <code style="font-size: 12px; padding: 0px; margin: 0px;">mirror</code> command:</p>
<pre class="code" style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; font-size: 12px; color: #000000; overflow-x: auto; overflow-y: auto; background-color: #f7f9fa; padding: 0.5em; border: 1px dashed #8cacbb;">lftp -u username,password -e "mirror --reverse --delete --only-newer --verbose path/to/source_directory path/to/target_directory" ftpsite</pre>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding: 0px;">As the name suggests, the switch reverses the source and target directories, so lftp uploads files from the local directory to the remote <acronym style="cursor: help; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: #000000; padding: 0px; margin: 0px;" title="File Transfer Protocol">FTP</acronym> server.</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.zye.me/2010/02/55529.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>vi/vim command summary</title>
		<link>http://blog.zye.me/2009/11/55463.html</link>
		<comments>http://blog.zye.me/2009/11/55463.html#comments</comments>
		<pubDate>Sat, 28 Nov 2009 20:33:50 +0000</pubDate>
		<dc:creator>yezheng</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[vi]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://blog.so8848.com/?p=55463</guid>
		<description><![CDATA[vi/vim command summary The following tables contain all the basic vi commands. Starting vi Command Description vi file start at line 1 of file vi +n file start at line n of file vi + file start at last line of file vi +/pattern file start at pattern in file vi -r file recover file after a system crash Saving files and quitting vi Command Description :e file <a href='http://blog.zye.me/2009/11/55463.html'>[...]</a>]]></description>
			<content:encoded><![CDATA[<div><span></p>
<h1><span style="font-size: small;">vi/vim command summary</span></h1>
<p><span style="font-size: small;"><a name="0001"></a>The following tables contain all the basic <strong>vi</strong> commands.<br />
<a name="0002"></a></span><span style="font-size: small;"><strong>Starting vi</strong></span></p>
<table border="0">
<tbody>
<tr valign="top">
<th align="LEFT"><span style="font-size: small;">Command</span></th>
<th align="LEFT"><span style="font-size: small;">Description</span></th>
</tr>
<tr valign="top">
<td><span style="font-size: small;">vi <strong><em>file</em></strong></span></td>
<td><span style="font-size: small;">start at line 1 of <strong><em>file</em></strong></span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">vi +n <strong><em>file</em></strong></span></td>
<td><span style="font-size: small;">start at line <strong><em>n</em></strong> of <strong><em>file</em></strong></span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">vi + <strong><em>file</em></strong></span></td>
<td><span style="font-size: small;">start at last line of <strong><em>file</em></strong></span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">vi +/<strong><em>pattern</em></strong> <strong><em>file</em></strong></span></td>
<td><span style="font-size: small;">start at <strong><em>pattern</em></strong> in <strong><em>file</em></strong></span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">vi -r <strong><em>file</em></strong></span></td>
<td><span style="font-size: small;">recover <strong><em>file</em></strong> after a system crash</span></td>
</tr>
</tbody>
</table>
<p><a name="0003"></a><a name="0004"></a><a name="0005"></a></p>
<p><span style="font-size: small;"><strong>Saving files and quitting vi</strong></span></p>
<table border="0">
<tbody>
<tr valign="top">
<th align="LEFT"><span style="font-size: small;">Command</span></th>
<th align="LEFT"><span style="font-size: small;">Description</span></th>
</tr>
<tr valign="top">
<td><span style="font-size: small;">:e <strong><em>file</em></strong></span></td>
<td><span style="font-size: small;">edit <strong><em>file</em></strong> (save current file with <strong>:w</strong> first)</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">:w</span></td>
<td><span style="font-size: small;">save (write out) the file being edited</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">:w <strong><em>file</em></strong></span></td>
<td><span style="font-size: small;">save as <strong><em>file</em></strong></span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">:w! <strong><em>file</em></strong></span></td>
<td><span style="font-size: small;">save as an existing <strong><em>file</em></strong></span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">:q</span></td>
<td><span style="font-size: small;">quit <strong>vi</strong></span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">:wq</span></td>
<td><span style="font-size: small;">save the file and quit <strong>vi</strong></span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;"> <img src='http://blog.zye.me/wp-includes/images/smilies/icon_mad.gif' alt=':x' class='wp-smiley' /> </span></td>
<td><span style="font-size: small;">save the file if it has changed and quit <strong>vi</strong></span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">:q!</span></td>
<td><span style="font-size: small;">quit <strong>vi</strong> without saving changes</span></td>
</tr>
</tbody>
</table>
<p><a name="0006"></a></p>
<p><span style="font-size: small;"><strong>Moving the cursor</strong></span></p>
<table border="0">
<tbody>
<tr valign="top">
<th align="LEFT"><span style="font-size: small;">Keys pressed</span></th>
<th align="LEFT"><span style="font-size: small;">Effect</span></th>
</tr>
<tr valign="top">
<td><span style="font-size: small;">h</span></td>
<td><span style="font-size: small;">left one character</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">l or &lt;Space&gt;</span></td>
<td><span style="font-size: small;">right one character</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">k</span></td>
<td><span style="font-size: small;">up one line</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">j or &lt;Enter&gt;</span></td>
<td><span style="font-size: small;">down one line</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">b</span></td>
<td><span style="font-size: small;">left one word</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">w</span></td>
<td><span style="font-size: small;">right one word</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">(</span></td>
<td><span style="font-size: small;">start of sentence</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">)</span></td>
<td><span style="font-size: small;">end of sentence</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">{</span></td>
<td><span style="font-size: small;">start of paragraph</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">}</span></td>
<td><span style="font-size: small;">end of paragraph</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">1G</span></td>
<td><span style="font-size: small;">top of file</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;"><strong><em>n</em></strong>G</span></td>
<td><span style="font-size: small;">line <strong><em>n</em></strong></span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">G</span></td>
<td><span style="font-size: small;">end of file</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">&lt;Ctrl&gt;W</span></td>
<td><span style="font-size: small;">first character of insertion</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">&lt;Ctrl&gt;U</span></td>
<td><span style="font-size: small;">up ½ screen</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">&lt;Ctrl&gt;D</span></td>
<td><span style="font-size: small;">down ½ screen</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">&lt;Ctrl&gt;B</span></td>
<td><span style="font-size: small;">up one screen</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">&lt;Ctrl&gt;F</span></td>
<td><span style="font-size: small;">down one screen</span></td>
</tr>
</tbody>
</table>
<p><a name="0007"></a></p>
<p><span style="font-size: small;"><strong>Inserting text</strong></span></p>
<table border="0">
<tbody>
<tr valign="top">
<th align="LEFT"><span style="font-size: small;">Keys pressed</span></th>
<th align="LEFT"><span style="font-size: small;">Text inserted</span></th>
</tr>
<tr valign="top">
<td><span style="font-size: small;">a</span></td>
<td><span style="font-size: small;">after the cursor</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">A</span></td>
<td><span style="font-size: small;">after last character on the line</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">i</span></td>
<td><span style="font-size: small;">before the cursor</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">I</span></td>
<td><span style="font-size: small;">before first character on the line</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">o</span></td>
<td><span style="font-size: small;">open line below current line</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">O</span></td>
<td><span style="font-size: small;">open line above current line</span></td>
</tr>
</tbody>
</table>
<p><a name="0008"></a></p>
<p><span style="font-size: small;"><strong>Changing and replacing text</strong></span></p>
<table border="0">
<tbody>
<tr valign="top">
<th align="LEFT"><span style="font-size: small;">Keys pressed</span></th>
<th align="LEFT"><span style="font-size: small;">Text changed or replaced</span></th>
</tr>
<tr valign="top">
<td><span style="font-size: small;">cw</span></td>
<td><span style="font-size: small;">word</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">3cw</span></td>
<td><span style="font-size: small;">three words</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">cc</span></td>
<td><span style="font-size: small;">current line</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">5cc</span></td>
<td><span style="font-size: small;">five lines</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">r</span></td>
<td><span style="font-size: small;">current character only</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">R</span></td>
<td><span style="font-size: small;">current character and those to its right</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">s</span></td>
<td><span style="font-size: small;">current character</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">S</span></td>
<td><span style="font-size: small;">current line</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">~</span></td>
<td><span style="font-size: small;">switch between lowercase and uppercase</span></td>
</tr>
</tbody>
</table>
<p><a name="0009"></a></p>
<p><span style="font-size: small;"><strong>Deleting text</strong></span></p>
<table border="0">
<tbody>
<tr valign="top">
<th align="LEFT"><span style="font-size: small;">Keys pressed</span></th>
<th align="LEFT"><span style="font-size: small;">Text deleted</span></th>
</tr>
<tr valign="top">
<td><span style="font-size: small;">x</span></td>
<td><span style="font-size: small;">character under cursor</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">12x</span></td>
<td><span style="font-size: small;">12 characters</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">X</span></td>
<td><span style="font-size: small;">character to left of cursor</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">dw</span></td>
<td><span style="font-size: small;">word</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">3dw</span></td>
<td><span style="font-size: small;">three words</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">d0</span></td>
<td><span style="font-size: small;">to beginning of line</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">d$</span></td>
<td><span style="font-size: small;">to end of line</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">dd</span></td>
<td><span style="font-size: small;">current line</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">5dd</span></td>
<td><span style="font-size: small;">five lines</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">d{</span></td>
<td><span style="font-size: small;">to beginning of paragraph</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">d}</span></td>
<td><span style="font-size: small;">to end of paragraph</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">:1,. d</span></td>
<td><span style="font-size: small;">to beginning of file</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">:.,$ d</span></td>
<td><span style="font-size: small;">to end of file</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">:1,$ d</span></td>
<td><span style="font-size: small;">whole file</span></td>
</tr>
</tbody>
</table>
<p><a name="0010"></a><a name="0011"></a></p>
<p><span style="font-size: small;"><strong>Using markers and buffers</strong></span></p>
<table border="0">
<tbody>
<tr valign="top">
<th align="LEFT"><span style="font-size: small;">Command</span></th>
<th align="LEFT"><span style="font-size: small;">Description</span></th>
</tr>
<tr valign="top">
<td><span style="font-size: small;">mf</span></td>
<td><span style="font-size: small;">set marker named &#8220;f&#8221;</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">`f</span></td>
<td><span style="font-size: small;">go to marker &#8220;f&#8221;</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">´f</span></td>
<td><span style="font-size: small;">go to start of line containing marker &#8220;f&#8221;</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">&#8220;s12yy</span></td>
<td><span style="font-size: small;">copy 12 lines into buffer &#8220;s&#8221;</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">&#8220;ty}</span></td>
<td><span style="font-size: small;">copy text from cursor to end of paragraph into buffer &#8220;t&#8221;</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">&#8220;ly1G</span></td>
<td><span style="font-size: small;">copy text from cursor to top of file into buffer &#8220;l&#8221;</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">&#8220;kd`f</span></td>
<td><span style="font-size: small;">cut text from cursor up to marker &#8220;f&#8221; into buffer &#8220;k&#8221;</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">&#8220;kp</span></td>
<td><span style="font-size: small;">paste buffer &#8220;k&#8221; into text</span></td>
</tr>
</tbody>
</table>
<p><a name="0012"></a></p>
<p><span style="font-size: small;"><strong>Searching for text</strong></span></p>
<table border="0">
<tbody>
<tr valign="top">
<th align="LEFT"><span style="font-size: small;">Search</span></th>
<th align="LEFT"><span style="font-size: small;">Finds</span></th>
</tr>
<tr valign="top">
<td><span style="font-size: small;">/and</span></td>
<td><span style="font-size: small;">next occurrence of &#8220;and&#8221;, for example, &#8220;and&#8221;, &#8220;stand&#8221;, &#8220;grand&#8221;</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">?and</span></td>
<td><span style="font-size: small;">previous occurrence of &#8220;and&#8221;</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">/^The</span></td>
<td><span style="font-size: small;">next line that starts with &#8220;The&#8221;, for example, &#8220;The&#8221;, &#8220;Then&#8221;, &#8220;There&#8221;</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">/^The&gt;</span></td>
<td><span style="font-size: small;">next line that starts with the word &#8220;The&#8221;</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">/end$</span></td>
<td><span style="font-size: small;">next line that ends with &#8220;end&#8221;</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">/[bB]ox</span></td>
<td><span style="font-size: small;">next occurrence of &#8220;box&#8221; or &#8220;Box&#8221;</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">n</span></td>
<td><span style="font-size: small;">repeat the most recent search, in the same direction</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">N</span></td>
<td><span style="font-size: small;">repeat the most recent search, in the opposite direction</span></td>
</tr>
</tbody>
</table>
<p><a name="0013"></a></p>
<p><span style="font-size: small;"><strong>Searching for and replacing text</strong></span></p>
<table border="0">
<tbody>
<tr valign="top">
<th align="LEFT"><span style="font-size: small;">Command</span></th>
<th align="LEFT"><span style="font-size: small;">Description</span></th>
</tr>
<tr valign="top">
<td><span style="font-size: small;">:s/pear/peach/g</span></td>
<td><span style="font-size: small;">replace all occurrences of &#8220;pear&#8221; with &#8220;peach&#8221; on current line</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">:/orange/s//lemon/g</span></td>
<td><span style="font-size: small;">change all occurrences of &#8220;orange&#8221; into &#8220;lemon&#8221; on next line containing &#8220;orange&#8221;</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">:.,$/&lt;file/directory/g</span></td>
<td><span style="font-size: small;">replace all words starting with &#8220;file&#8221; by &#8220;directory&#8221; on every line from current line onward, for example, &#8220;filename&#8221; becomes &#8220;directoryname&#8221;</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">:g/one/s//1/g</span></td>
<td><span style="font-size: small;">replace every occurrence of &#8220;one&#8221; with 1, for example, &#8220;oneself&#8221; becomes &#8220;1self&#8221;, &#8220;someone&#8221; becomes &#8220;some1&#8221;</span></td>
</tr>
</tbody>
</table>
<p><a name="0014"></a></p>
<p><span style="font-size: small;"><strong>Matching patterns of text</strong></span></p>
<table border="0">
<tbody>
<tr valign="top">
<th align="LEFT"><span style="font-size: small;">Expression</span></th>
<th align="LEFT"><span style="font-size: small;">Matches</span></th>
</tr>
<tr valign="top">
<td><span style="font-size: small;">.</span></td>
<td><span style="font-size: small;">any single character</span></td>
</tr>
<tr valign="top">
<td><img src="graphics/lowast.gif" alt="*" /></td>
<td><span style="font-size: small;">zero or more of the previous expression</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">.<img src="graphics/lowast.gif" alt="*" /></span></td>
<td><span style="font-size: small;">zero or more arbitrary characters</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">&lt;</span></td>
<td><span style="font-size: small;">beginning of a word</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">&gt;</span></td>
<td><span style="font-size: small;">end of a word</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;"></span></td>
<td><span style="font-size: small;">quote a special character</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;"><img src="graphics/lowast.gif" alt="*" /></span></td>
<td><span style="font-size: small;">the character &#8220;<img src="graphics/lowast.gif" alt="*" />&#8221;</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">^</span></td>
<td><span style="font-size: small;">beginning of a line</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">$</span></td>
<td><span style="font-size: small;">end of a line</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">[<strong><em>set</em></strong>]</span></td>
<td><span style="font-size: small;">one character from a set of characters</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">[XYZ]</span></td>
<td><span style="font-size: small;">one of the characters &#8220;X&#8221;, &#8220;Y&#8221;, or &#8220;Z&#8221;</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">[[:upper:]][[:lower:]]*</span></td>
<td><span style="font-size: small;">one uppercase character followed by any number of lowercase characters</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">[^<strong><em>set</em></strong>]</span></td>
<td><span style="font-size: small;">one character not from a set of characters</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">[^XYZ[:digit:]]</span></td>
<td><span style="font-size: small;">any character except &#8220;X&#8221;, &#8220;Y&#8221;, &#8220;Z&#8221;, or a numeric digit</span></td>
</tr>
</tbody>
</table>
<p><span style="font-size: small;"><strong>Options to the :set command</strong></span></p>
<table border="0">
<tbody>
<tr valign="top">
<th align="LEFT"><span style="font-size: small;">Option</span></th>
<th align="LEFT"><span style="font-size: small;">Effect</span></th>
</tr>
<tr valign="top">
<td><span style="font-size: small;">all</span></td>
<td><span style="font-size: small;">list settings of all options</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">ignorecase</span></td>
<td><span style="font-size: small;">ignore case in searches</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">list</span></td>
<td><span style="font-size: small;">display &lt;Tab&gt; and end-of-line characters</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">mesg</span></td>
<td><span style="font-size: small;">display messages sent to your terminal</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">nowrapscan</span></td>
<td><span style="font-size: small;">prevent searches from wrapping round the end or beginning of a file</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">number</span></td>
<td><span style="font-size: small;">display line numbers</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">report=5</span></td>
<td><span style="font-size: small;">warn if five or more lines are changed by command</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">term=ansi</span></td>
<td><span style="font-size: small;">set terminal type to &#8220;ansi&#8221;</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">terse</span></td>
<td><span style="font-size: small;">shorten error messages</span></td>
</tr>
<tr valign="top">
<td><span style="font-size: small;">warn</span></td>
<td><span style="font-size: small;">display &#8220;[No write since last change]&#8221; on shell escape if file has not been saved</p>
<p></span></td>
</tr>
</tbody>
</table>
<p></span></div>
]]></content:encoded>
			<wfw:commentRss>http://blog.zye.me/2009/11/55463.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Download Whole Website or Directories by using wget in Linux</title>
		<link>http://blog.zye.me/2009/09/54411.html</link>
		<comments>http://blog.zye.me/2009/09/54411.html#comments</comments>
		<pubDate>Sat, 19 Sep 2009 18:43:41 +0000</pubDate>
		<dc:creator>yezheng</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[crawler]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[wget]]></category>

		<guid isPermaLink="false">http://blog.so8848.com/?p=54411</guid>
		<description><![CDATA[Download Whole Website or Directories by using wget in Linux You might have googled a software for downloading a specified website or directory on either Windows or Linux platform . Yes, a bunch of tools can do this for you. Actually, we can do this by using a simple command, wget, on Linux platform. It <a href='http://blog.zye.me/2009/09/54411.html'>[...]</a>]]></description>
			<content:encoded><![CDATA[<h1>Download Whole Website or Directories by using wget in Linux</h1>
<p>You might have googled a software for downloading a specified website or directory on either Windows or Linux platform . Yes, a bunch of tools can do this for you. Actually, we can do this by using a simple command, wget, on Linux platform. It is highly customizable, just a powerful crawler. You will find it fantastic and really cool. Let me just show you how!</p>
<p><strong>wget </strong></p>
<p><strong>&#8211;recursive </strong></p>
<p><strong>&#8211;no-clobber </strong></p>
<p><strong>&#8211;page-requisites </strong></p>
<p><strong>&#8211;html-extension </strong></p>
<p><strong>&#8211;convert-links </strong></p>
<p><strong>&#8211;restrict-file-names=windows </strong></p>
<p><strong>&#8211;domains techstroke.com </strong></p>
<p><strong>&#8211;no-parent </strong></p>
<p><strong>www.techstroke.com/Windows/</strong></p>
<p>The command above let you download the &#8220;windows&#8221; directory at the domain of &#8220;<strong>techstroke.com&#8221; </strong>recursively, starting from the url  <strong>www.techstroke.com/Windows/</strong></p>
<p>How do you like it? Hah, really cool?</p>
<p>Finally, let me explain a bit more about the parameters. Of course, you can refer to its documentation.</p>
<p><strong><span style="font-family: mceinline;"><span style="font-family: mceinline;">The options are:</span></span></strong></p>
<p><strong>–recursive: </strong>download the entire Web site.</p>
<p>–domains-techstroke.com: don’t follow links outside techstroke.com.</p>
<p>–no-parent: don’t follow links outside the directory /Windows/.</p>
<p>–page-requisites: get all the elements that compose the page (images, CSS and so on).</p>
<p>–html-extension: save files with the .html extension.</p>
<p>–convert-links: convert links so that they work locally, off-line.</p>
<p>–restrict-file-names=windows: modify filenames so that they will work in Windows as well.</p>
<p>–no-clobber: don’t overwrite any existing files (used in case the download is interrupted and</p>
<p>resumed).</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.zye.me/2009/09/54411.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to prevent SSH terminal timeout</title>
		<link>http://blog.zye.me/2009/08/53933.html</link>
		<comments>http://blog.zye.me/2009/08/53933.html#comments</comments>
		<pubDate>Fri, 07 Aug 2009 18:05:19 +0000</pubDate>
		<dc:creator>yezheng</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[SSH terminal]]></category>
		<category><![CDATA[timeout]]></category>

		<guid isPermaLink="false">http://blog.so8848.com/?p=53933</guid>
		<description><![CDATA[If you use ssh a lot, you may have noticed that your ssh session times out and you’re logged out every once in a while. Annoying isn’t it? Here I will tutor how to avoid ssh timeout. Read from remote host ocaoimh.ie: Connection reset by peer Connection to ocaoimh.ie closed. There’s a quick fix for <a href='http://blog.zye.me/2009/08/53933.html'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>If you use ssh a lot, you may have noticed that your ssh session times out and you’re logged out every once in a while. Annoying isn’t it? Here I will tutor how to avoid ssh timeout.</p>
<blockquote><p>Read from remote host ocaoimh.ie: Connection reset by peer<br />
Connection to ocaoimh.ie closed.</p></blockquote>
<p>There’s a quick fix for that. Actually, there are 2 ways to fix it. You only need to do one of them so choose whichever one is easiest for you. You’ll need root access, so for most people it’s probably safer to do the client fix rather than the server fix.</p>
<ul>
<li>On the server, login as root and edit /etc/ssh/sshd_config and add the line:<br />
<blockquote><p>ClientAliveInterval 60</p></blockquote>
<p>According to <code>man sshd_config</code>, this line,</p>
<blockquote><p>Sets a timeout interval in seconds after which if no data has been received from the client, sshd(8) will send a message through the encrypted channel to request a response from the client. The default is 0, indicating that these messages will not be sent to the client. This option applies to protocol version 2 only.</p></blockquote>
<p>Don’t forget to restart sshd on the server after you save the file.</li>
<li>The other way, and easier and safer way is for your desktop machine to send those keep alive messages. As root on your desktop (or client) machine, edit /etc/ssh/ssh_config and add the line:<br />
<blockquote><p>ServerAliveInterval 60</p></blockquote>
<p>That will send send a message to the server every 60 seconds, keeping the connection open. I prefer this way because I login to several machines every day, and I don’t have root access to all of them.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.zye.me/2009/08/53933.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SCP &#8211;copy among machines</title>
		<link>http://blog.zye.me/2009/08/53924.html</link>
		<comments>http://blog.zye.me/2009/08/53924.html#comments</comments>
		<pubDate>Fri, 07 Aug 2009 07:43:17 +0000</pubDate>
		<dc:creator>yezheng</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[SCP]]></category>

		<guid isPermaLink="false">http://blog.so8848.com/?p=53924</guid>
		<description><![CDATA[SCP The scp command allows you to copy files over ssh connections. This is pretty useful if you want to transport files between computers, for example to backup something. The scp command uses the ssh command and they are very much alike. However, there are some important differences. The scp command can be used in <a href='http://blog.zye.me/2009/08/53924.html'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p><strong>SCP</strong></p>
<p>The scp command allows you to copy files over ssh connections. This is pretty useful if you want to transport files between computers, for example to backup something. The scp command uses the ssh command and they are very much alike. However, there are some important differences.</p>
<p>The scp command can be used in three* ways: to copy from a (remote) server to your computer, to copy from your computer to a (remote) server, and to copy from a (remote) server to another (remote) server. In the third case, the data is transferred directly between the servers; your own computer will only tell the servers what to do. These options are very useful for a lot of things that require files to be transferred, so let&#8217;s have a look at the syntax of this command:</p>
<blockquote><p>[rechosen@localhost ~]$ scp examplefile yourusername@yourserver:/home/yourusername/</p></blockquote>
<p>Looks quite familiar, right? But there are differences. The command above will transfer the file &#8220;examplefile&#8221; to the directory &#8220;/home/yourusername/&#8221; at the server &#8220;yourserver&#8221;, trying to get ssh acces with the username &#8220;yourusername&#8221;. That&#8217;s quite a lot information, but scp really needs it all. Well, almost all of it. You could leave out the &#8220;yourusername@&#8221; in front of &#8220;yourserver&#8221;, but only if you want to login on the server with your current username on your own computer. Let&#8217;s have a closer look at the end of the command. There&#8217;s a colon over there, with a directory after it. Just like Linux&#8217;s normal cp command, scp will need to know both the source file(s) and the target directory (or file). For remote hosts, the file(s)/directory are given to the scp command is this way.</p>
<p>You can also copy a file (or multiple files) from the (remote) server to your own computer. Let&#8217;s have a look at an example of that:</p>
<blockquote><p>[rechosen@localhost ~]$ scp yourusername@yourserver:/home/yourusername/examplefile .</p></blockquote>
<p><em>Note: The dot at the end means the current local directory. This is a handy trick that can be used about everywhere in Linux. Besides a single dot, you can also type a double dot ( .. ), which is the parent directory of the current directory.</em></p>
<p>This will copy the file &#8220;/home/yourusername/examplefile&#8221; to the current directory on your own computer, provided that the username and password are correct and that the file actually exists.</p>
<p>You probably already guessed that the following command copies a file from a (remote) server to another (remote) server:</p>
<blockquote><p>[rechosen@localhost ~]$ scp yourusername@yourserver:/home/yourusername/examplefile yourusername2@yourserver2:/home/yourusername2/</p></blockquote>
<p>Please note that, to make the above command work, the servers <em>must</em> be able to reach each other, as the data will be transferred directly between them. If the servers somehow can&#8217;t reach each other (for example, if port 22 is not open on one of the sides) you won&#8217;t be able to copy anything. In that case, copy the files to your own computer first, then to the other host. Or make the servers able to reach each other (for example by opening the port).</p>
<p>Well, those are the main uses of scp. We&#8217;ll now go a bit more in-depth about the differences between ssh and scp.</p>
<p>*: <em>Actually you can also use it just like the normal cp command, withhout any ssh connections in it, but that&#8217;s quite useless. It requires you to type an extra &#8216;s&#8217; =).</em></p>
<p><strong>Specifying a port with scp</strong></p>
<p>The scp command acts a little different when it comes to ports. You&#8217;d expect that specifying a port should be done this way:</p>
<blockquote><p>[rechosen@localhost ~]$ scp -p yourport yourusername@yourserver:/home/yourusername/examplefile .</p></blockquote>
<p>However, that will not work. You will get an error message like this one:</p>
<blockquote><p>cp: cannot stat `yourport&#8217;: No such file or directory</p></blockquote>
<p>This is caused by the different architecture of scp. It aims to resemble cp, and cp also features the -p option. However, in cp terms it means &#8216;preserve&#8217;, and it causes the cp command to preserve things like ownership, permissions and creation dates. The scp command can also preserve things like that, and the -p option enables this feature. The port specification should be done with the -P option. Therefore, the following command will work:</p>
<blockquote><p>[rechosen@localhost ~]$ scp -P yourport yourusername@yourserver:/home/yourusername/examplefile .</p></blockquote>
<p>Also note that the -P option <em>must</em> be in front of the (remote) server. The ssh command will still work if you put -p yourport behind the host syntax, but scp won&#8217;t. Why? Because scp also supports copying between two servers and therefore needs to know <em>which</em> server the -P option applies to.</p>
<p><strong>Another difference between scp and ssh</strong></p>
<p>Unlike ssh, scp cannot be used to run a command on a (remote) server, as it already uses that feature of ssh to start the scp server on the host. The scp command does have an option that accepts a program (the -S option), but this program will then be used instead of ssh to establish the encrypted connection, and it will not be executed on the remote host.</p>
<p><strong>Tips &amp; Tricks with ssh and scp</strong></p>
<p>Quite a handy thing about scp is that it supports asterisks. You can copy all files in a remote directory in a way like this:</p>
<blockquote><p>[rechosen@localhost ~]$ scp yourusername@yourserver:/home/yourusername/* .</p></blockquote>
<p>And you can also just copy a whole directory by specifying the -r (recursive) option:</p>
<blockquote><p>[rechosen@localhost ~]$ scp -r yourusername@yourserver:/home/yourusername/ .</p></blockquote>
<p>Both of these also work when copying to a (remote) server or copying between a (remote) server and another (remote) server.</p>
<p>The ssh command can come in handy if you don&#8217;t know the exact location of the file you want to copy with scp. First, ssh to the (remote) server:</p>
<blockquote><p>[rechosen@localhost ~]$ ssh yourusername@yourserver</p></blockquote>
<p>Then browse to the right directory with cd. This is essential Linux terminal knowledge, so I won&#8217;t explain it here. When you&#8217;re in the right directory, you can get the full path with this command:</p>
<blockquote><p>[rechosen@localhost ~]$ pwd</p></blockquote>
<p><em>Note: pwd is an abbreviation of Print Working Directory, which is a useful way to remember the command.</em></p>
<p>You can then copy this output, leave the ssh shell by pressing Ctrl + D, and then paste the full directory path in your scp command. This saves a lot of remembering and typing!</p>
<p>You can also limit the bandwidth scp may use when copying. This is very useful if you&#8217;re wanting to copy a huge amount of data without suffering from slow internet for a long time. Limiting bandwidth is done this way:</p>
<blockquote><p>scp -l bandwidthlimit yourusername@yourserver:/home/yourusername/* .</p></blockquote>
<p>The bandwidth is specified in Kbit/sec. What does this mean? Eight bits is one byte. If you want to copy no faster than 10 Kbyte/sec, set the limit to 80. If you want to copy no faster than 80 Kbyte/sec, set the limit to 640. Get it? You should set the limit to eight times the maximum Kbyte/sec you want it to be. I&#8217;d recommend to set the -l option with all scp&#8217;ing you do on a connection that other people need to use, too. A big amount of copying can virtually block a whole 10 Mbit network if you&#8217;re using hubs.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.zye.me/2009/08/53924.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>vi, vim 显示行号或行数</title>
		<link>http://blog.zye.me/2009/07/53720.html</link>
		<comments>http://blog.zye.me/2009/07/53720.html#comments</comments>
		<pubDate>Fri, 31 Jul 2009 01:08:36 +0000</pubDate>
		<dc:creator>yezheng</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[vim]]></category>
		<category><![CDATA[命令模式]]></category>
		<category><![CDATA[行数]]></category>

		<guid isPermaLink="false">http://blog.so8848.com/?p=53720</guid>
		<description><![CDATA[在命令模式输入以下命令 1. 显示行号 :set number 2. 取消行号显示 :set nonumber 3. 跳到一特定行 （必须得在命令模式，好像必须每次都得先按Esc键） 回到第一行： G 跳到特定行如99行：  99G]]></description>
			<content:encoded><![CDATA[<p>在命令模式输入以下命令</p>
<p>1. 显示行号<br />
:set number<br />
2. 取消行号显示<br />
:set nonumber<br />
3. 跳到一特定行 （必须得在命令模式，好像必须<strong>每次都得先按Esc键</strong>）</p>
<p>回到第一行： G</p>
<p>跳到特定行如99行：  99G</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.zye.me/2009/07/53720.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ubuntu ftp server配置</title>
		<link>http://blog.zye.me/2009/06/53096.html</link>
		<comments>http://blog.zye.me/2009/06/53096.html#comments</comments>
		<pubDate>Fri, 26 Jun 2009 21:12:40 +0000</pubDate>
		<dc:creator>yezheng</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.so8848.com/?p=53096</guid>
		<description><![CDATA[vsftpd 启动 vsftpd problem &#8211; 500 OOPS: could not bind listening IPv4 socket sudo /etc/init.d/vsftpd sta sudo /etc/init.d/vsftpd stop 1）安装vsftpd sudo apt-get install vsftpd 2）设置 vsftpd.conf文件 注意：设置之前请备份！！ sudo cp /etc/vsftpd.conf /etc/vsftpd.conf.old .1.1、监听地址与控制端口 　　listen_address=ip address 此参数在VSFTPD使用单独(standalone)模式下有效。此参数定义了在主机的哪个IP地址上监听FTP请求，即在哪个IP地址上提供 FTP服务。对于只有一个IP地址的主机，不需要使用此参数。对于多址主机，不设置此参数，则监听所有IP地址。默认值为无。 listen_port=port_value 指定FTP服务器监听的端口号(控制端口)，默认值为21。此选项在standalone模式下生效。 5.1.2、FTP模式与数据端口 port_enable=YES&#124;NO 如果你要在数据连接时取消PORT模式时，设此选项为NO。默认值为YES。 connetc_from_port_20=YES&#124;NO 控制以PORT模式进行数据传输时是否使用20端口(ftp-data)。YES使用，NO不使用。默认值为NO，但RHL自带的vsftpd.conf文件中此参数设为YES。 ftp_data_port=port number 设定ftp数据传输端口(ftp-data)值。默认值为20。此参数用于PORT FTP模式。 port_promiscuous=YES&#124;NO 默认值为NO。为YES时，取消PORT安全检查。该检查确保外出的数据只能连接到客户端上。小心打开此选项。 pasv_enable=YES&#124;NO YES，允许数据传输时使用PASV模式。NO，不允许使用PASV模式。默认值为YES。 pasv_min_port=port number pasv_max_port=port number <a href='http://blog.zye.me/2009/06/53096.html'>[...]</a>]]></description>
			<content:encoded><![CDATA[<h1><strong>vsftpd 启动<br />
</strong></h1>
<p><strong>vsftpd problem &#8211; 500 OOPS: could not bind listening IPv4 socket</strong></p>
<p><strong></strong>sudo /etc/init.d/vsftpd sta</p>
<p>sudo /etc/init.d/vsftpd stop</p>
<div id="blog_text" class="cnt">
<div class="articleContent">
<h1>1）安装vsftpd</h1>
<p>sudo apt-get install vsftpd</p>
<h1>2）设置 vsftpd.conf文件</h1>
<p>注意：设置之前请备份！！</p>
<p>sudo cp /etc/vsftpd.conf /etc/vsftpd.conf.old</p>
<p>.1.1、监听地址与控制端口</p>
<p>　　listen_address=ip address<br />
此参数在VSFTPD使用单独(standalone)模式下有效。此参数定义了在主机的哪个IP地址上监听FTP请求，即在哪个IP地址上提供 FTP服务。对于只有一个IP地址的主机，不需要使用此参数。对于多址主机，不设置此参数，则监听所有IP地址。默认值为无。</p>
<p>listen_port=port_value<br />
指定FTP服务器监听的端口号(控制端口)，默认值为21。此选项在standalone模式下生效。</p>
<p>5.1.2、FTP模式与数据端口<br />
port_enable=YES|NO<br />
如果你要在数据连接时取消PORT模式时，设此选项为NO。默认值为YES。</p>
<p>connetc_from_port_20=YES|NO<br />
控制以PORT模式进行数据传输时是否使用20端口(ftp-data)。YES使用，NO不使用。默认值为NO，但RHL自带的vsftpd.conf文件中此参数设为YES。</p>
<p>ftp_data_port=port number<br />
设定ftp数据传输端口(ftp-data)值。默认值为20。此参数用于PORT FTP模式。</p>
<p>port_promiscuous=YES|NO<br />
默认值为NO。为YES时，取消PORT安全检查。该检查确保外出的数据只能连接到客户端上。小心打开此选项。</p>
<p>pasv_enable=YES|NO<br />
YES，允许数据传输时使用PASV模式。NO，不允许使用PASV模式。默认值为YES。</p>
<p>pasv_min_port=port number<br />
pasv_max_port=port number<br />
设定在PASV模式下，建立数据传输所可以使用port范围的下界和上界，0 表示任意。默认值为0。把端口范围设在比较高的一段范围内，比如50000-60000，将有助于安全性的提高。</p>
<p>pasv_promiscuous=YES|NO<br />
此选项激活时，将关闭PASV模式的安全检查。该检查确保数据连接和控制连接是来自同一个IP地址。小心打开此选项。此选项唯一合理的用法是存在于由安全隧道方案构成的组织中。默认值为NO。</p>
<p>pasv_address=<br />
此选项为一个数字IP地址，作为PASV命令的响应。默认值为none，即地址是从呼入的连接套接字(incoming connectd socket)中获取。</p>
<p>5.2.2 负载控制</p>
<p>max_clients=numerical value<br />
此参数在VSFTPD使用单独(standalone)模式下有效。此参数定义了FTP服务器最大的并发连接数，当超过此连接数时，服务器拒绝客户端连接。默认值为0，表示不限最大连接数。</p>
<p>max_per_ip=numerical value<br />
此参数在VSFTPD使用单独(standalone)模式下有效。此参数定义每个IP地址最大的并发连接数目。超过这个数目将会拒绝连接。此选项的设置将影响到象网际快车这类的多进程下载软件。默认值为0，表示不限制。</p>
<p>anon_max_rate=value<br />
设定匿名用户的最大数据传输速度value，以Bytes/s为单位。默认无。</p>
<p>local_max_rate=value<br />
设定用户的最大数据传输速度value，以Bytes/s为单位。默认无。此选项对所有的用户都生效。此外，也可以在用户个人配置文件中使用此选项，以指定特定用户可获得的最大数据传输速率。<br />
步骤如下：<br />
①在vsftpd.conf中指定用户个人配置文件所在的目录，如：<br />
user_config_dir=/etc/vsftpd/userconf<br />
②生成/etc/vsftpd/userconf目录。<br />
③用户个人配置文件是在该目录下，与特定用户同名的文件，如：<br />
/etc/vsftpd/userconf/xiaowang<br />
④在用户的个人配置文件中设置local_max_rate参数，如：<br />
local_max_rate=80000<br />
以上步骤设定FTP用户xiaowang的最大数据传输速度为80KBytes/s。</p>
<p>VSFTPD 对于速度控制的变化范围大概在80%到120%之间。比如我们限制最高速度为100KBytes/s，但实际的速度可能在80KBytes/s 到120KBytes/s 之间。当然，若是线路带宽不足时，速率自然会低于此限制。</p>
<p>5.3 用户选项</p>
<p>VSFTPD的用户分为三类：匿名用户、本地用户（local user）以及虚拟用户（guest）。</p>
<p>5.3.1、匿名用户</p>
<p>anonymous_enable=YES|NO<br />
控制是否允许匿名用户登录，YES允许，NO不允许，默认值为YES。</p>
<p>ftp_username=<br />
匿名用户所使用的系统用户名。默认下，此参数在配置文件中不出现，值为ftp。</p>
<p>no_anon_password=YES|NO<br />
控制匿名用户登入时是否需要密码，YES不需要，NO需要。默认值为NO。</p>
<p>deny_email_enable=YES|NO<br />
此参数默认值为NO。当值为YES时，拒绝使用banned_email_file参数指定文件中所列出的e-mail地址进行登录的匿名用户。即， 当匿名用户使用banned_email_file文件中所列出的e-mail进行登录时，被拒绝。显然，这对于阻击某些Dos攻击有效。当此参数生效 时，需追加banned_email_file参数</p>
<p>banned_email_file=/etc/vsftpd.banned_emails<br />
指定包含被拒绝的e-mail地址的文件，默认文件为/etc/vsftpd.banned_emails。</p>
<p>anon_root=<br />
设定匿名用户的根目录，即匿名用户登入后，被定位到此目录下。主配置文件中默认无此项，默认值为/var/ftp/。</p>
<p>anon_world_readable_only=YES|NO<br />
控制是否只允许匿名用户下载可阅读文档。YES，只允许匿名用户下载可阅读的文件。NO，允许匿名用户浏览整个服务器的文件系统。默认值为YES。</p>
<p>anon_upload_enable=YES|NO<br />
控制是否允许匿名用户上传文件，YES允许，NO不允许，默认是不设值，即为NO。除了这个参数外，匿名用户要能上传文件，还需要两个条件：一，write_enable参数为YES;二，在文件系统上，FTP匿名用户对某个目录有写权限。</p>
<p>anon_mkdir_write_enable=YES|NO<br />
控制是否允许匿名用户创建新目录，YES允许，NO不允许，默认是不设值，即为NO。当然在文件系统上，FTP匿名用户必需对新目录的上层目录拥有写权限。</p>
<p>anon_other_write_enable=YES|NO<br />
控制匿名用户是否拥有除了上传和新建目录之外的其他权限，如删除、更名等。YES拥有，NO不拥有，默认值为NO。</p>
<p>chown_uploads=YES|NO<br />
是否修改匿名用户所上传文件的所有权。YES，匿名用户所上传的文件的所有权将改为另外一个不同的用户所有，用户由chown_username参数指定。此选项默认值为NO。</p>
<p>chown_username=whoever<br />
指定拥有匿名用户上传文件所有权的用户。此参数与chown_uploads联用。不推荐使用root用户。</p>
<p>5.3.2、本地用户</p>
<p>在使用FTP服务的用户中，除了匿名用户外，还有一类在FTP服务器所属主机上拥有账号的用户。VSFTPD中称此类用户为本地用户（local users），等同于其他FTP服务器中的real用户</p>
<p>local_enable=YES|NO<br />
控制vsftpd所在的系统的用户是否可以登录vsftpd。默认值为YES。</p>
<p>local_root=<br />
定义所有本地用户的根目录。当本地用户登入时，将被更换到此目录下。默认值为无。</p>
<p>user_config_dir=<br />
定义用户个人配置文件所在的目录。用户的个人配置文件为该目录下的同名文件。个人配置文件的格式与vsftpd.conf格式相同。例如定义 user_config_dir=/etc/vsftpd/userconf，并且主机上有用户xiaowang,lisi，那我们可以在 user_config_dir的目录新增名为xiaowang、lisi的两个文件。当用户lisi 登入时，VSFTPD则会读取user_config_dir下lisi这个文件中的设定值，应用于用户lisi。默认值为无。</p>
<p>5.3.3、虚拟用户</p>
<p>guest_enable=YES|NO<br />
若是启动这项功能，所有的非匿名登入者都视为guest。默认值为关闭。</p>
<p>guest_username=<br />
定义VSFTPD的guest用户在系统中的用户名。默认值为ftp。</p>
<p>5.4、安全措施</p>
<p>5.4.1、用户登录控制</p>
<p>pam_service_name=vsftpd<br />
指出VSFTPD进行PAM认证时所使用的PAM配置文件名，默认值是vsftpd，默认PAM配置文件是/etc/pam.d/vsftpd。</p>
<p>/etc/vsftpd.ftpusers<br />
VSFTPD禁止列在此文件中的用户登录FTP服务器。这个机制是在/etc/pam.d/vsftpd中默认设置的。</p>
<p>userlist_enable=YES|NO<br />
此选项被激活后，VSFTPD将读取userlist_file参数所指定的文件中的用户列表。当列表中的用户登录FTP服务器时，该用户在提示输入 密码之前就被禁止了。即该用户名输入后，VSFTPD查到该用户名在列表，VSFTPD就直接禁止掉该用户，不会再进行询问密码等后续步聚。默认值为 NO。</p>
<p>userlist_file=/etc/vsftpd.user_list<br />
指出userlist_enable选项生效后，被读取的包含用户列表的文件。默认值是/etc/vsftpd.user_list。</p>
<p>userlist_deny=YES|NO<br />
决定禁止还是只允许由userlist_file指定文件中的用户登录FTP服务器。此选项在userlist_enable 选项启动后才生效。YES，默认值，禁止文件中的用户登录，同时也不向这些用户发出输入口令的提示。NO，只允许在文件中的用户登录FTP服务器。</p>
<p>tcp_wrappers=YES|NO<br />
在VSFTPD中使用TCP_Wrappers远程访问控制机制，默认值为YES。</p>
<p>5.4.2、目录访问控制</p>
<p>chroot_list_enable=YES|NO<br />
锁定某些用户在自家目录中。即当这些用户登录后，不可以转到系统的其他目录，只能在自家目录(及其子目录)下。具体的用户在chroot_list_file参数所指定的文件中列出。默认值为NO。</p>
<p>chroot_list_file=/etc/vsftpd/chroot_list<br />
指出被锁定在自家目录中的用户的列表文件。文件格式为一行一用户。通常该文件是/etc/vsftpd/chroot_list。此选项默认不设置。</p>
<p>chroot_local_users=YES|NO<br />
将本地用户锁定在自家目录中。当此项被激活时，chroot_list_enable和chroot_local_users参数的作用将发生变 化，chroot_list_file所指定文件中的用户将不被锁定在自家目录。本参数被激活后，可能带来安全上的冲突，特别是当用户拥有上传、 shell访问等权限时。因此，只有在确实了解的情况下，才可以打开此参数。默认值为NO。</p>
<p>passwd_chroot_enable<br />
当此选项激活时，与chroot_local_user选项配合，chroot()容器的位置可以在每个用户的基础上指定。每个用户的容器来源于/etc/passwd中每个用户的自家目录字段。默认值为NO。</p>
<p>5.4.3、文件好作控制</p>
<p>hide_ids=YES|NO<br />
是否隐藏文件的所有者和组信息。YES，当用户使用&#8221;ls -al&#8221;之类的指令时，在目录列表中所有文件的拥有者和组信息都显示为ftp。默认值为NO。</p>
<p>ls_recurse_enable=YES|NO<br />
YES，允许使用&#8221;ls -R&#8221; 指令。这个选项有一个小的安全风险，因为在一个大型FTP站点的根目录下使用&#8221;ls -R&#8221;会消耗大量系统资源。默认值为NO。</p>
<p>write_enable=YES|NO<br />
控制是否允许使用任何可以修改文件系统的FTP 的指令，比如STOR、DELE、RNFR、RNTO、MKD、RMD、APPE 以及SITE。默认值为NO，不过自带的简单配置文件中打开了该选项。</p>
<p>secure_chroot_dir=<br />
这选项指向一个空目录，并且ftp用户对此目录无写权限。当vsftpd不需要访问文件系统时，这个目录将被作为一个安全的容器，用户将被限制在此目录中。默认目录为/usr/share/empty。</p>
<p>5.4.4、新增文件权限设定</p>
<p>anon_umask=<br />
匿名用户新增文件的umask 数值。默认值为077。</p>
<p>file_open_mode=<br />
上传档案的权限，与chmod 所使用的数值相同。如果希望上传的文件可以执行，设此值为0777。默认值为0666。</p>
<p>local_umask=<br />
本地用户新增档案时的umask 数值。默认值为077。不过，其他大多数的FTP服务器都是使用022。如果您的用户希望的话，可以修改为022。在自带的配置文件中此项就设为了022。</p>
<p>5.5、提示信息</p>
<p>ftpd_banner=login banner string<br />
此参数定义了login banner string（登录欢迎语字符串）。用户可以自行修改。预设值为无。当ftpd_banner设置后，将取代系统原来的欢迎词。</p>
<p>banner_file=/directory/vsftpd_banner_file<br />
此项指定一个文本文件，当使用者登入时，会显示此该文件的内容，通常为欢迎话语或是说明。默认值为无。与ftpd_banner相 比，banner_file是文本文件的形式，而ftpd_banner是字串格式。banner_file选项将取代ftpd_banner选项。</p>
<p>dirmessage_enable=YES|MO<br />
控制是否启用目录提示信息功能。YES启用，NO不启用，默认值为YES。此功能启用后，当用户进入某一个目录时，会检查该目录下是否有message_file选项所指定的文档，若是有，则会出现此文档的内容，通常这个档案会放置欢迎话语，或是对该目录的说明。</p>
<p>message_file=<br />
此选项，仅在dirmessage_enable选项激活方生效。默认值为.message。</p>
<p>5.6、好志设置</p>
<p>xferlog_enable=YES|NO<br />
控制是否启用一个好志文件，用于详细记录上传和下载。该好志文件由xferlog_file选项指定。默认值为NO，但简单配置文件中激活此选项。</p>
<p>xferlog_file=<br />
这个选项设定记录传输好志的文件名。默认值为/var/log/vsftpd.log。</p>
<p>xferlog_std_format=YES|NO<br />
控制好志文件是否使用xferlog的标准格式，如同wu-ftpd一样。使用xferlog格式，可以重新使用已经存在的传输统计生成器。然而，默认的好志格式更为可读性。默认值为NO，但自带的配置文件中激活了此选项。</p>
<p>log_ftp_protocol=YES|NO<br />
当此选项激活后，所有的FTP请求和响应都被记录到好志中。提供此选项时，xferlog_std_format不能被激活。这个选项有助于调试。默认值为NO。</p>
<p>5.7、其他设置</p>
<p>setproctitle_enable=YES|NO<br />
YES，VSFTPD将在系统进程列表中显示每个会话(session)的状态。也就是说，进程报告将显示每个vsftpd会话在做什么(挂起、下载 等)，如用ps -ef|grep ftp。出于安全的目的，可以考虑将此选项关闭。NO，进程报告只显示一个vsftpd进程在运行。默认值为NO。</p>
<p>text_userdb_names=YES|No<br />
当使用者登入后使用ls -al 之类指令时，目录列表的用户和组信息域，默认是出现拥有者的UID，而不是该档案拥有者的名称。若是希望出现拥有者的名称，则将此功能开启。默认值为NO。</p>
<p>user_localtime=YES|NO<br />
默认为NO。YES，VSFTPD显示目录列表时使用你本地时区的时间。默认是显示GMT时间。同样，由ftp命令“MDTM”返回的时间值也受此选项影响。</p>
<p>check_shell=YES|NO<br />
此选项仅对不使用PAM方式的VSFTPD生效。当此选项关闭后，当本地用户登录时，VSFTPD不会检查/etc/shells文件以寻找一个有效的用户shell。默认为YES。</p>
<p>nopriv_user=<br />
指定一个用户，当VSFTPD不想要什么权限时，使用此用户身份。这用户最好是一个专用的用户，而不是用户nobody。在大多数的机器上，nobody用户被用于大量重要的事情。默认值为nobody。</p>
<p>pam_service_name=<br />
指明VSFTPD使用用PAM验证服务时的PAM配置文件名。默认值为ftp。</p>
<p>6、VSFTPD应用</p>
<p>本部分介绍VSFTPD的具体应用方法。</p>
<p>6.1、允许匿名用户上传文件<br />
在vsftpd.conf文件中修改或增加以下选项：<br />
write_enable=YES<br />
anon_world_readable_only=NO<br />
anon_upload_enable=YES<br />
anon_mkdir_write_enable=YES</p>
<p>然后创建供匿名用户上传文件的目录，并设定权限：<br />
# mkdir /var/ftp/incoming<br />
# chmod o+w /var/ftp/incoming<br />
由于匿名用户（ftp）上传文件，需要对incoming目录进行好作，而incoming为root所有，匿名用户（ftp）对于incoming来说是其他用户，所以要加入其他用户（o）的写权限。</p>
<p>6.2、限制用户在自家目录</p>
<p>在默认配置中，本地用户可以切换到自家目录以外的目录进行浏览，并在权限范围内进行上传和下载，这无疑是个不安全因素。<br />
我们可以设置chroot，让本地用户登录后只能访问自家目录，无法访问其他目录。相关的选项有三个：chroot_local_user、chroot_list_enable、chroot_list_file。限制用户在自家目录有两种做法：<br />
1、限制所有的本地用户在自家目录<br />
chroot_local_user=YES<br />
这种做法，可能会带来一些安全性上的冲突。参见前面的chroot_local_user选项描述。<br />
2、限制部分本地用户在自家目录<br />
chroot_local_user=NO<br />
chroot_list_enable=YES<br />
chroot_list_file=/etc/vsftpd.chroot_list<br />
在/etc/vsftpd.chroot_list文件中加入要限制的本地用户名。注意一个用户名一行。</p>
<p>6.3、配置高安全级别的匿名FTP服务器</p>
<p>VSFTPD自带的简单配置文件已经自称是偏执狂了，这里看看能否更加偏执一些，。有些选项默认已经采用安全性的设置，这里就不再写出了。</p>
<p>#只允许匿名访问，不允许本地用户访问<br />
anonymous_enable=YES<br />
local_enable=NO</p>
<p>#使用ftpd_banner取代VSFTPD默认的欢迎词，免得泄漏相关信息<br />
ftpd_banner=Welcome to this FTP Server<br />
#只让匿名用户浏览可阅读的文件，不可以浏览整个系统<br />
anon_world_readable_only=YES<br />
#隐藏文件的所有者和组信息，匿名用户看到的文件的所有者和组全变为ftp<br />
hide_ids=YES</p>
<p>#取消写权限<br />
write_enable=NO<br />
anon_upload_enable=NO<br />
anon_mkdir_write_enable=NO<br />
anon_other_write_enable=NO</p>
<p>#使用单独模式，并指定监听的IP地址<br />
listen_address=ip address<br />
#对连接进行控制，还有超时时间，那就根据具体情况再说了。<br />
connect_from_port_20=YES<br />
pasv_min_port=50000<br />
pasv_max_port=60000<br />
#控制并发数，限定每个IP地址的并发数，这个嘛，根据用户自已定了。<br />
max_clients=numerical value<br />
max_per_ip=numerical value<br />
#限定下载速度，具体限多大，就由用户自己定了，80KB/s，也很快了吧。<br />
anon_max_rate=80000</p>
<p>#启用详细的好志记录格式<br />
xferlog_enable=YES</p>
<p>6.4、基于IP地址的虚拟FTP服务器</p>
<p>假定服务器有两个IP地址，192.168.0.1和192.168.0.2。VSFTPD是建立在192.168.0.1上的，现在我们在192.168.0.2上再提供一个虚拟FTP服务器。如何在一台服务器上使用多个IP 地址，请参考相关文档。</p>
<p>1、创建虚拟FTP服务器的根目录。<br />
mkdir -p /var/ftp2/pub<br />
确保/var/ftp2和/var/ftp2/pub目录的拥有者和组均为root，掩码为755。</p>
<p>2、增加虚拟FTP服务器的匿名用户帐号。原先的FTP服务器使用系统用户ftp作为其匿名用户帐号。我们要增加一个ftp2用于虚拟FTP服务器。<br />
useradd -d /var/ftp2 -M ftp2</p>
<p>3、创建虚拟FTP服务器的配置文件。复制原来的vsftpd.conf作为虚拟FTP服务器的配置文件，并修改相关参数。<br />
cp /etc/vsftpd/vsftpd.conf /etc/vsftpd/vsftpd2.conf<br />
新添或修改以下参数：<br />
listen=YES<br />
listen_address=192.168.0.2<br />
ftp_username=ftp2</p>
<p>注：由于VSFTPD默认是监听所有的IP地址，当我们设定基于IP的虚拟FTP服务器时，为防止原来的FTP服务器与虚拟FTP服务器发生监听上的 冲突，原FTP服务器需要指定监听的IP地址。在这里，原来的配置文件中就要设置listen_address=192.168.0.1。</p>
<p>4、启动虚拟FTP服务器。</p>
<p>/etc/rc.d/init.d/vsftpd脚本在启动时，扫描/etc/vsftpd/目录下所有的*.conf文件，按照*.conf文件的先 后，依次启用vsftpd进程，每个vsftpd进程对应一个.conf文件。即，“ls /etc/vsftpd/”列表的次序与“ps -aux |grep vsftpd”中的顺序一样。当然了，“ps -aux | grep vsftpd”中也显示出vsftpd所使用的配置文件，从中也可以看哪个vsftpd进程对应哪个FTP服务器。如果没有列出配置文件，那就是默认的 vsftpd.conf，那么该进程也就是原来的FTP服务器进程。<br />
由于第3步中虚拟FTP服务器的配置文件被命名为vsftpd2.conf文件，所以我们可以用/etc/rc.d/init.d/vsftpd脚本同时启动或关闭原FTP服务器和新加的虚拟FTP服务器。<br />
以下命令单独启动虚拟FTP服务器：<br />
/usr/sbin/vsftpd /etc/vsftpd/vsftpd2.conf &amp;<br />
单独关闭虚拟FTP服务器，用“ps -aux | grep vsftpd”查出进程号，再用kill指令杀死虚拟FTP的进程。</p>
<p>6.4、基于IP地址的虚拟FTP服务器</p>
<p>　　假定服务器有两个IP地址，192.168.0.1和192.168.0.2。VSFTPD是建立在192.168.0.1上的，现在我</p>
<p>们在192.168.0.2上再提供一个虚拟FTP服务器。如何在一台服务器上使用多个IP 地址，请参考相关文档</p>
<p>。</p>
<p>　　1、创建虚拟FTP服务器的根目录。<br />
mkdir -p /var/ftp2/pub<br />
确保/var/ftp2和/var/ftp2/pub目录的拥有者和组均为root，掩码为755。</p>
<p>　　2、增加虚拟FTP服务器的匿名用户帐号。原先的FTP服务器使用系统用户ftp作为其匿名用户帐号。我</p>
<p>们要增加一个ftp2用于虚拟FTP服务器。<br />
useradd -d /var/ftp2 -M ftp2</p>
<p>　　3、创建虚拟FTP服务器的配置文件。复制原来的vsftpd.conf作为虚拟FTP服务器的配置文件，并修改</p>
<p>相关参数。<br />
cp /etc/vsftpd/vsftpd.conf /etc/vsftpd/vsftpd2.conf<br />
新添或修改以下参数：<br />
listen=YES<br />
listen_address=192.168.0.2<br />
ftp_username=ftp2</p>
<p>　　注：由于VSFTPD默认是监听所有的IP地址，当我们设定基于IP的虚拟FTP服务器时，为防止原来的FTP</p>
<p>服务器与虚拟FTP服务器发生监听上的冲突，原FTP服务器需要指定监听的IP地址。在这里，原来的配置文</p>
<p>件中就要设置listen_address=192.168.0.1。</p>
<p>　　4、启动虚拟FTP服务器。</p>
<p>　　/etc/rc.d/init.d/vsftpd脚本在启动时，扫描/etc/vsftpd/目录下所有的*.conf文件，按照*.conf</p>
<p>文件的先后，依次启用vsftpd进程，每个vsftpd进程对应一个.conf文件。即，“ls /etc/vsftpd/”列表</p>
<p>的次序与“ps -aux |grep vsftpd”中的顺序一样。当然了，“ps -aux | grep vsftpd”中也显示出</p>
<p>vsftpd所使用的配置文件，从中也可以看哪个vsftpd进程对应哪个FTP服务器。如果没有列出配置文件，</p>
<p>那就是默认的vsftpd.conf，那么该进程也就是原来的FTP服务器进程。<br />
由于第3步中虚拟FTP服务器的配置文件被命名为vsftpd2.conf文件，所以我们可以</p>
<p>用/etc/rc.d/init.d/vsftpd脚本同时启动或关闭原FTP服务器和新加的虚拟FTP服务器。<br />
以下命令单独启动虚拟FTP服务器：<br />
/usr/sbin/vsftpd /etc/vsftpd/vsftpd2.conf &amp;<br />
单独关闭虚拟FTP服务器，用“ps -aux | grep vsftpd”查出进程号，再用kill指令杀死虚拟FTP的</p>
<p>进程。</p></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.zye.me/2009/06/53096.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu Server 安装图形界面</title>
		<link>http://blog.zye.me/2009/06/52550.html</link>
		<comments>http://blog.zye.me/2009/06/52550.html#comments</comments>
		<pubDate>Sat, 13 Jun 2009 00:15:30 +0000</pubDate>
		<dc:creator>yezheng</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[图形界面]]></category>

		<guid isPermaLink="false">http://blog.so8848.com/?p=52550</guid>
		<description><![CDATA[Ubuntu Server 安装图形界面 1、安装 X 窗口系统：sudo apt-get install x-window-system-core 2、安装登录管理器：sudo apt-get install xdm/gdm/kdm[注]。最常见的图形化登录管理器包括 XDM、GDM、KDM，用户可根据自己的需要选择其中之一 3、 安装桌面环境或窗口管理器：sudo apt-get install ubuntu-desktop/kubuntu-desktop/xubuntu-desktop。这将分别安装 GNOME、KDE、XFCE 桌面环境。对于 GNOME、KDE、XFCE 这些桌面环境来说，为了获得更强的定制效果，也可仅安装最基本的组件，如：sudo apt-get install gnome-core/kde-core/xfce4。 如果不需要桌面环境，也可选择安装窗口管理器代替。那样的话，可以执行指令 sudo apt-get install fluxbox/icewm/enlightenment/fvwm]]></description>
			<content:encoded><![CDATA[<h4 id="subjcns!2FC6D3091545F119!174" class="beTitle">Ubuntu Server 安装图形界面</h4>
<p>1、安装 X 窗口系统：sudo apt-get install x-window-system-core</p>
<p>2、安装登录管理器：sudo apt-get install xdm/gdm/kdm[<a href="http://linuxtoy.org/archives/minimalist-install-of-ubuntu.html#comment" target="_blank">注</a>]。最常见的图形化登录管理器包括 XDM、GDM、KDM，用户可根据自己的需要选择其中之一</p>
<p>3、 安装桌面环境或窗口管理器：sudo apt-get install ubuntu-desktop/kubuntu-desktop/xubuntu-desktop。这将分别安装 GNOME、KDE、XFCE 桌面环境。对于 GNOME、KDE、XFCE 这些桌面环境来说，为了获得更强的定制效果，也可仅安装最基本的组件，如：sudo apt-get install gnome-core/kde-core/xfce4。</p>
<p>如果不需要桌面环境，也可选择安装窗口管理器代替。那样的话，可以执行指令 sudo apt-get install fluxbox/icewm/enlightenment/fvwm</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.zye.me/2009/06/52550.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

