<?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>wd and cc &#187; bash</title>
	<atom:link href="http://wdicc.com/tag/bash/feed/" rel="self" type="application/rss+xml" />
	<link>http://wdicc.com</link>
	<description>Happy every day...</description>
	<lastBuildDate>Mon, 06 Sep 2010 10:00:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>linux tuning</title>
		<link>http://wdicc.com/linux-tuning/</link>
		<comments>http://wdicc.com/linux-tuning/#comments</comments>
		<pubDate>Mon, 04 Jun 2007 01:47:22 +0000</pubDate>
		<dc:creator>wd</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Other]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[kernel]]></category>
		<category><![CDATA[tuning]]></category>

		<guid isPermaLink="false">http://blog.wdicc.com/wordpress/2007/06/04/337/</guid>
		<description><![CDATA[地址 http://www.enigma.id.au/linux_tuning.txt # Linux kernel tweaking for performance and security on a busy Linux # server with a decent amount of memory. # # This file should be saved as /etc/sysctl.conf # You can source it manually if your system ha... ]]></description>
			<content:encoded><![CDATA[<p><script type="text/javascript"><!--
google_ad_client = "pub-9015557074547192";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = "468x60_as";
google_ad_type = "image";
//2007-06-17: index
google_ad_channel = "2704127095";
google_color_border = "660000";
google_color_bg = "FFFFFF";
google_color_link = "CC0000";
google_color_text = "000000";
google_color_url = "0066CC";
//-->
</script>
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></-> <p>地址 <a href="http://www.enigma.id.au/linux_tuning.txt">http://www.enigma.id.au/linux_tuning.txt</a></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Linux kernel tweaking for performance and security on a busy Linux</span>
<span style="color: #666666; font-style: italic;"># server with a decent amount of memory.</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># This file should be saved as /etc/sysctl.conf</span>
<span style="color: #666666; font-style: italic;"># You can source it manually if your system has booted by using:</span>
<span style="color: #666666; font-style: italic;"># sysctl -e -p /etc/sysctl.conf</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># Paul Day, paul (at) bur.st</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># Last updated 02/03/05 and tested on 2.6.9</span>
<span style="color: #666666; font-style: italic;">#</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Increase RPC slots</span>
sunrpc.tcp_slot_table_entries = <span style="color: #000000;">32</span>
sunrpc.udp_slot_table_entries = <span style="color: #000000;">32</span>
<span style="color: #666666; font-style: italic;"># Increase size of RPC datagram queue length</span>
net.unix.max_dgram_qlen = <span style="color: #000000;">50</span>
<span style="color: #666666; font-style: italic;"># Log spoofed, source routed and redirects</span>
net.ipv4.conf.default.log_martians = <span style="color: #000000;">1</span>
<span style="color: #666666; font-style: italic;"># Don't accept source routes</span>
net.ipv4.conf.default.accept_source_route = <span style="color: #000000;">0</span>
<span style="color: #666666; font-style: italic;"># Don't send redirects</span>
net.ipv4.conf.default.send_redirects = <span style="color: #000000;">0</span>
<span style="color: #666666; font-style: italic;"># Source route verification on - incoming packets must match outgoing routing</span>
net.ipv4.conf.default.rp_filter = <span style="color: #000000;">1</span>
<span style="color: #666666; font-style: italic;"># Don't accept redirects</span>
net.ipv4.conf.default.accept_redirects = <span style="color: #000000;">0</span>
<span style="color: #666666; font-style: italic;"># Don't forward source routes</span>
net.ipv4.conf.default.mc_forwarding = <span style="color: #000000;">0</span>
<span style="color: #666666; font-style: italic;"># Disable forwarding </span>
net.ipv4.conf.default.forwarding = <span style="color: #000000;">0</span>
<span style="color: #666666; font-style: italic;"># Log spoofed, source routed and redirects</span>
net.ipv4.conf.all.log_martians = <span style="color: #000000;">1</span>
<span style="color: #666666; font-style: italic;"># Don't relay bootp</span>
net.ipv4.conf.all.bootp_relay = <span style="color: #000000;">0</span>
<span style="color: #666666; font-style: italic;"># Don't proxy arp for anyone</span>
net.ipv4.conf.all.proxy_arp = <span style="color: #000000;">0</span>
<span style="color: #666666; font-style: italic;"># Don't accept source route packets</span>
net.ipv4.conf.all.accept_source_route = <span style="color: #000000;">0</span>
<span style="color: #666666; font-style: italic;"># Don't send redirects</span>
net.ipv4.conf.all.send_redirects = <span style="color: #000000;">0</span>
<span style="color: #666666; font-style: italic;"># Source route verification on - incoming packets must match outgoing routing</span>
net.ipv4.conf.all.rp_filter = <span style="color: #000000;">1</span>
<span style="color: #666666; font-style: italic;"># Don't accept redirects</span>
net.ipv4.conf.all.accept_redirects = <span style="color: #000000;">0</span>
<span style="color: #666666; font-style: italic;"># Don't forward source routes</span>
net.ipv4.conf.all.mc_forwarding = <span style="color: #000000;">0</span>
<span style="color: #666666; font-style: italic;"># Don't enable forwarding</span>
net.ipv4.conf.all.forwarding = <span style="color: #000000;">0</span>
<span style="color: #666666; font-style: italic;"># Don't allow the arp table to become bigger than this</span>
net.ipv4.neigh.default.gc_thresh3 = <span style="color: #000000;">2048</span>
<span style="color: #666666; font-style: italic;"># Tell the gc when to become aggressive with arp table cleaning.</span>
<span style="color: #666666; font-style: italic;"># Adjust this based on size of the LAN. 256 is suitable for most</span>
net.ipv4.neigh.default.gc_thresh2 = <span style="color: #000000;">1024</span>
<span style="color: #666666; font-style: italic;"># Adjust where the gc will leave arp table alone - set to 32.</span>
net.ipv4.neigh.default.gc_thresh1 = <span style="color: #000000;">32</span>
<span style="color: #666666; font-style: italic;"># Adjust to arp table gc to clean-up more often</span>
net.ipv4.neigh.default.gc_interval = <span style="color: #000000;">30</span>
<span style="color: #666666; font-style: italic;"># Increase TCP</span>
net.ipv4.neigh.default.proxy_qlen = <span style="color: #000000;">96</span>
net.ipv4.neigh.default.unres_qlen = <span style="color: #000000;">6</span>
<span style="color: #666666; font-style: italic;"># Increase size of socket buffers</span>
net.ipv4.tcp_rmem = <span style="color: #000000;">4096</span>	<span style="color: #000000;">98304</span>	<span style="color: #000000;">349520</span>
net.ipv4.tcp_wmem = <span style="color: #000000;">4096</span>	<span style="color: #000000;">65535</span>	<span style="color: #000000;">262142</span>
net.ipv4.tcp_mem = <span style="color: #000000;">98304</span>	<span style="color: #000000;">262142</span>	<span style="color: #000000;">393216</span>
<span style="color: #666666; font-style: italic;"># Turn off sack</span>
net.ipv4.tcp_dsack = <span style="color: #000000;">0</span>
<span style="color: #666666; font-style: italic;"># Don't use ECN because too many sites have wacky routers that can't handle it`</span>
net.ipv4.tcp_ecn = <span style="color: #000000;">0</span>
net.ipv4.tcp_reordering = <span style="color: #000000;">3</span>
<span style="color: #666666; font-style: italic;"># Turn off sack/fack</span>
net.ipv4.tcp_fack = <span style="color: #000000;">0</span>
<span style="color: #666666; font-style: italic;"># Enable bad error message Protection</span>
net.ipv4.icmp_ignore_bogus_error_responses = <span style="color: #000000;">1</span>
<span style="color: #666666; font-style: italic;"># Ignore broadcasts pings, could become part of a Smurf</span>
net.ipv4.icmp_echo_ignore_broadcasts = <span style="color: #000000;">1</span>
<span style="color: #666666; font-style: italic;"># But don't ignore directed pings</span>
net.ipv4.icmp_echo_ignore_all = <span style="color: #000000;">0</span>
<span style="color: #666666; font-style: italic;"># Widen local port range</span>
net.ipv4.ip_local_port_range = <span style="color: #000000;">33000</span>	<span style="color: #000000;">60000</span>
<span style="color: #666666; font-style: italic;"># Bump up TCP socket queuer to help with syn floods</span>
net.ipv4.tcp_max_syn_backlog = <span style="color: #000000;">2048</span>
<span style="color: #666666; font-style: italic;"># Turn syn-cookie protection on</span>
net.ipv4.tcp_syncookies = <span style="color: #000000;">1</span>
<span style="color: #666666; font-style: italic;"># Drop it so lack of FIN times out quicker</span>
net.ipv4.tcp_fin_timeout = <span style="color: #000000;">30</span>
<span style="color: #666666; font-style: italic;"># How many times to retry killing an alive TCP connection</span>
net.ipv4.tcp_retries2 = <span style="color: #000000;">15</span>
net.ipv4.tcp_retries1 = <span style="color: #000000;">3</span>
<span style="color: #666666; font-style: italic;"># Enable a fix for RFC1337 - time-wait assassination hazards in TCP</span>
net.ipv4.tcp_rfc1337 = <span style="color: #000000;">1</span>
<span style="color: #666666; font-style: italic;"># Drop keep-alive time</span>
net.ipv4.tcp_keepalive_time = <span style="color: #000000;">3600</span>
<span style="color: #666666; font-style: italic;"># Set number of times to retry a SYN-ACK in a half-open new connections</span>
net.ipv4.tcp_synack_retries = <span style="color: #000000;">5</span>
<span style="color: #666666; font-style: italic;"># Set number of times to retry SYN in a new connection</span>
net.ipv4.tcp_syn_retries = <span style="color: #000000;">5</span>
<span style="color: #666666; font-style: italic;"># Turn off sack</span>
net.ipv4.tcp_sack = <span style="color: #000000;">0</span>
<span style="color: #666666; font-style: italic;"># Enable really big (&gt;65kB) TCP window scaling if we want it.</span>
net.ipv4.tcp_window_scaling = <span style="color: #000000;">1</span>
<span style="color: #666666; font-style: italic;"># Turn off timestamps</span>
<span style="color: #666666; font-style: italic;"># Turn this back on if you're on a gigabit or very busy network</span>
<span style="color: #666666; font-style: italic;"># Having it off is one less thing the IP stack needs to work on</span>
net.ipv4.tcp_timestamps = <span style="color: #000000;">0</span>
<span style="color: #666666; font-style: italic;"># Increase number of incoming connections backlog</span>
net.core.somaxconn = <span style="color: #000000;">512</span>
<span style="color: #666666; font-style: italic;"># Bump optmem_max up</span>
net.core.optmem_max = <span style="color: #000000;">20480</span>
<span style="color: #666666; font-style: italic;"># Increase number of incoming connections backlog</span>
net.core.netdev_max_backlog = <span style="color: #000000;">1024</span>
net.core.dev_weight = <span style="color: #000000;">64</span>
<span style="color: #666666; font-style: italic;"># Bump up default r/wmem to max</span>
net.core.rmem_default = <span style="color: #000000;">262141</span>
net.core.wmem_default = <span style="color: #000000;">262141</span>
<span style="color: #666666; font-style: italic;"># Bump up max r/wmem</span>
net.core.rmem_max = <span style="color: #000000;">262141</span>
net.core.wmem_max = <span style="color: #000000;">262141</span>
<span style="color: #666666; font-style: italic;"># Increase size of file handles and inode cache</span>
fs.file-max = <span style="color: #000000;">209708</span></pre></div></div>

<p class="poweredbyperformancing">Powered by <a href="http://scribefire.com/">ScribeFire</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://wdicc.com/linux-tuning/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>awk 数组的一个应用</title>
		<link>http://wdicc.com/awk-array/</link>
		<comments>http://wdicc.com/awk-array/#comments</comments>
		<pubDate>Thu, 17 May 2007 09:16:01 +0000</pubDate>
		<dc:creator>wd</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Other]]></category>
		<category><![CDATA[awk]]></category>
		<category><![CDATA[bash]]></category>

		<guid isPermaLink="false">http://blog.wdicc.com/wordpress/2007/05/17/331/</guid>
		<description><![CDATA[sed和awk这本书看了好久了，sed部分将就看完了，awk部分基本没怎么看。上次有人问起一个比较文件的问题，发现awk来解决非常的简单。 比较两个文件A、B，打印出包含在A中的，但是不包含在B中... ]]></description>
			<content:encoded><![CDATA[<p>sed和awk这本书看了好久了，sed部分将就看完了，awk部分基本没怎么看。上次有人问起一个比较文件的问题，发现awk来解决非常的简单。</p>
<p>比较两个文件A、B，打印出包含在A中的，但是不包含在B中的所有行。</p>
<p>根据题目要求，awk的解决方法如下:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'NR==FNR {a[$0]=1} NR&gt;FNR &amp;&amp; !a[$0] {print $0}'</span> B A</pre></div></div>

<p>里面NR表示行号，FNR表示当前文件中的行号。NR==FNR的时候，表示此时正在读取B文件，以B中的$0为索引，建立一个数组，并且都赋值为1。<br />
当NR>FNR 的时候，表示此时在读取A文件，如果a[$0]为1，那么就表示这个$0是在B里面也存在的，是吧？所以，如果要B里面不存在的，那么就得是a[$0]不为1的，就是没做过赋值的。所以了，就是这个了。</p>
<p>进阶一下，比较两个文件A、B，打印包含在A中第一列，但是不包含在B中第二列的整行。</p>
<p>类似的：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'NR==FNR {a[$2]=1} NR&gt;FNR &amp;&amp; !a[$1] {print}'</span> B A</pre></div></div>

<p>比较文件内容还可以用comm命令，还有人提出了grep命令，例如第一个问题：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-vwfB</span> A</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://wdicc.com/awk-array/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
