Linux迷+Python粉 - 大学https://blog.pythonwood.com/2017-11-30T22:30:00+08:00笔记本系统转换Linux一个半月——xubuntu14.04截图纪念里程碑2014-07-05T23:30:00+08:002017-11-30T22:12:00+08:00pythonwoodtag:blog.pythonwood.com,2014-07-05:/2014/07/笔记本系统转换Linux一个半月——xubuntu14.04截图纪念里程碑/<h3 id="_1">前言<a class="headerlink" href="#_1" title="Permanent link">¶</a></h3>
<p>自学计算机技术,越到后面,越依赖ubuntu,以致于很多时候都是一开机就打开虚拟机上的ubuntu10.04,Linux已经变得越来越重要了。</p>
<h3 id="_2">操作<a class="headerlink" href="#_2" title="Permanent link">¶</a></h3>
<p>2014-04-17,ubuntu14.04(trusty),长期支持版(<span class="caps">LTS</span>=long term support),还记得那天也是我腾讯实行的2面。我知道等到时机了,果断装双系统 …</p><h3 id="_1">前言<a class="headerlink" href="#_1" title="Permanent link">¶</a></h3>
<p>自学计算机技术,越到后面,越依赖ubuntu,以致于很多时候都是一开机就打开虚拟机上的ubuntu10.04,Linux已经变得越来越重要了。</p>
<h3 id="_2">操作<a class="headerlink" href="#_2" title="Permanent link">¶</a></h3>
<p>2014-04-17,ubuntu14.04(trusty),长期支持版(<span class="caps">LTS</span>=long term support),还记得那天也是我腾讯实行的2面。我知道等到时机了,果断装双系统! 开始</p>
<p>用实验室那台ubuntu13.10直接升级,用了几个钟换来开机后一大堆的错误弹框,累觉不爱,说明直接升级是不行的,在此谨记!</p>
<p>很不喜欢ubuntu后面自己的桌面。拿实验室的继续重装ubuntu-gnome版,还能接受,但却有些太求炫不求实的感觉。</p>
<p>萌生转kubuntu,feroda, mint, centos等的想法,差点转了mint,唯一觉得debin->ubuntu->mint这样子的飘着很难让人放心,比如你相信一个人99%,但很难相信他的孙辈。</p>
<p>搜索良久,纠结良久,看到开源新闻消息说Linus受不了gnome3的卖炫而投向xfce阵型。我便也跟风转xubuntu,转完后大喜,因为超过我理想期望很多。</p>
<h3 id="xubuntu1404">xubuntu14.04优点<a class="headerlink" href="#xubuntu1404" title="Permanent link">¶</a></h3>
<p>一、Olivier Fourdan开发,一个运行在各类Unix下的轻量级桌面环境。</p>
<p>二、仿win风格的界面,对双系统的人很好</p>
<p>三、超省资源,开机后htop显示198M已用内存</p>
<p>四、32Linux内核系统识别了4G的3.97G,win7只识别2.95G,让我惊喜</p>
<h3 id="xubuntu1404_1">xubuntu14.04截图<a class="headerlink" href="#xubuntu1404_1" title="Permanent link">¶</a></h3>
<p>改成windows风格桌面很容易</p>
<p><img alt="xubuntu14.04截图" src="https://blog.pythonwood.com/uploads/2014/xubuntu14.04截图.jpg"></p>
<!--
文件管理器风格也是windows化的
terminal,python爬虫输出信息
-->
<p>更多截图http://www.douban.com/photos/album/132398060/</p>
<p><img alt="tu1" src="https://img1.doubanio.com/view/photo/m/public/p2185668349.jpg"></p>
<hr>
<p><img alt="tu2" src="https://img3.doubanio.com/view/photo/m/public/p2185668275.jpg"></p>
<hr>
<p><img alt="tu3" src="https://img3.doubanio.com/view/photo/m/public/p2185668295.jpg"></p>寒假挑战PythonTip(一人一python)总结——算法是程序的灵魂,程序员的心法2014-02-16T14:23:00+08:002017-11-30T22:12:00+08:00pythonwoodtag:blog.pythonwood.com,2014-02-16:/2014/02/寒假挑战PythonTip(一人一python)总结——算法是程序的灵魂,程序员的心法/<p>2014年2月中旬,我上升到挑战python英雄榜第3名。这是我寒假修炼算法的成果之一。来一下总结吧!</p>
<p>Linux的创始人Linus Torvalds在一次演讲中有一段涉及“什么才是优秀程序员”的话:</p>
<p><strong>“烂程序员关心的是代码。好程序员关心的是数据结构和它们之间的关系。”</strong></p>
<p>由这句话的启发开始,加上我越来越觉得自己编程能力不足,码代码经常要重构,逻辑思维不过细腻谨慎。正是过于关注代码,完成率所致。我已经学过C/C++/nasm/java …</p><p>2014年2月中旬,我上升到挑战python英雄榜第3名。这是我寒假修炼算法的成果之一。来一下总结吧!</p>
<p>Linux的创始人Linus Torvalds在一次演讲中有一段涉及“什么才是优秀程序员”的话:</p>
<p><strong>“烂程序员关心的是代码。好程序员关心的是数据结构和它们之间的关系。”</strong></p>
<p>由这句话的启发开始,加上我越来越觉得自己编程能力不足,码代码经常要重构,逻辑思维不过细腻谨慎。正是过于关注代码,完成率所致。我已经学过C/C++/nasm/java/python/html/js/jq/shell等等语言,对计算机世界的工作原理有比较好的认识,但代码能力一直上不去。我想算法,就是我的瓶颈。于是有了以下故事。</p>
<h3 id="_1">第一阶段<a class="headerlink" href="#_1" title="Permanent link">¶</a></h3>
<p>寒假开始,我便在项目工作之余扫pythontip上的题。十几天里,有时一天7、8道题,有时2、3题,我的排名慢慢从第N页到第4页到第2页,让后到第1页。</p>
<p>当我扫完101题后,我成功了42题,刚好排在第一页最后一名。然后我休息了一下,继续有成功几题。这大概就是我的无算法时代极限了。</p>
<h3 id="_2">第二阶段<a class="headerlink" href="#_2" title="Permanent link">¶</a></h3>
<p>我网搜博客,算法,学习排序。好来买了《编程珠玑》和《编程之美》,边看边攻克pyhtontip上的题目。</p>
<p>在PythonTip 上的一些水题这博客中学习了很多,尤其是看到问题一句话就解决时,恍然大悟。</p>
<p>1、有很多利用lambda, reduce, map, zip, 列表分片/解析, sum, max, min, divmod, round, hex/oct/bin; set,list,dict; 一句话解决的。这是我认为python强大原因,非常好用。</p>
<p>2、关于二进制‘1’的处理是非常妙的,这些题往往诠释了计算机较人类思维不同的特性,以及如何能让程序员思考得更“计算机”一些。在《编程之美》,上面提到的博客中都有提到。</p>
<p>3、独立思考,让后比较,我获得更多。在最大连续子序列,最大非连续子序列,最长回文子字符串中,我收获很经典的算法。同时还想出来与Manacher算法一拼的做法。</p>
<div class="highlight"><pre><span></span><span class="nv">L</span> <span class="o">=</span> <span class="s s-Atom">'#'</span><span class="p">.</span><span class="nf">join</span><span class="p">(</span><span class="nf">list</span><span class="p">(</span><span class="nv">L</span><span class="p">))</span> <span class="s s-Atom">#</span> <span class="s s-Atom">len</span> <span class="o">is</span> <span class="s s-Atom">odd</span> <span class="s s-Atom">now</span><span class="p">!</span>
<span class="s s-Atom">l</span> <span class="o">=</span> <span class="nf">len</span><span class="p">(</span><span class="nv">L</span><span class="p">)</span>
<span class="s s-Atom">o</span><span class="p">,</span><span class="s s-Atom">r</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span> <span class="s s-Atom">#</span> <span class="nf">圆心,半径</span><span class="p">(</span><span class="s s-Atom">不计圆心</span><span class="p">)</span>
<span class="s s-Atom">for</span> <span class="s s-Atom">i</span> <span class="s s-Atom">in</span> <span class="nf">range</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="s s-Atom">l</span><span class="p">)</span><span class="s s-Atom">:</span>
<span class="s s-Atom">if</span> <span class="s s-Atom">i</span><span class="o">+</span><span class="s s-Atom">r</span><span class="o"><</span><span class="s s-Atom">l</span> <span class="s s-Atom">and</span> <span class="nv">L</span><span class="p">[</span><span class="s s-Atom">i</span><span class="o">-</span><span class="nn">r</span><span class="p">:</span><span class="s s-Atom">i</span><span class="p">]</span> <span class="o">==</span> <span class="nv">L</span><span class="p">[</span><span class="s s-Atom">i</span><span class="o">+</span><span class="nn">r</span><span class="p">:</span><span class="nn">i</span><span class="p">:</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span><span class="s s-Atom">:</span> <span class="s s-Atom">#</span> <span class="s s-Atom">移到:最右方便来计算</span>
<span class="s s-Atom">o</span><span class="p">,</span><span class="s s-Atom">r</span><span class="o">=</span><span class="s s-Atom">i</span><span class="p">,</span><span class="s s-Atom">r</span>
<span class="s s-Atom">while</span> <span class="s s-Atom">i</span><span class="o">+</span><span class="s s-Atom">r</span><span class="o">+</span><span class="mi">1</span><span class="o"><</span><span class="s s-Atom">l</span> <span class="s s-Atom">and</span> <span class="nv">L</span><span class="p">[</span><span class="s s-Atom">i</span><span class="o">-</span><span class="s s-Atom">r</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="nv">L</span><span class="p">[</span><span class="s s-Atom">i</span><span class="o">+</span><span class="s s-Atom">r</span><span class="o">+</span><span class="mi">1</span><span class="p">]</span><span class="s s-Atom">:</span>
<span class="s s-Atom">r</span> <span class="s s-Atom">+=</span> <span class="mi">1</span>
<span class="s s-Atom">#</span> <span class="s s-Atom">print</span> <span class="nv">L</span><span class="p">[</span><span class="s s-Atom">o</span><span class="o">-</span><span class="nn">r</span><span class="p">:</span><span class="s s-Atom">o</span><span class="o">+</span><span class="s s-Atom">r</span><span class="o">+</span><span class="mi">1</span><span class="p">]</span>
<span class="nv">L1</span> <span class="o">=</span> <span class="nv">L</span><span class="p">[</span><span class="s s-Atom">o</span><span class="o">-</span><span class="nn">r</span><span class="p">:</span><span class="s s-Atom">o</span><span class="o">+</span><span class="s s-Atom">r</span><span class="o">+</span><span class="mi">1</span><span class="p">]</span>
<span class="s s-Atom">t1</span><span class="p">,</span><span class="s s-Atom">t2</span> <span class="o">=</span> <span class="nv">L1</span><span class="p">[</span><span class="s s-Atom">::</span><span class="mi">2</span><span class="p">],</span><span class="nv">L1</span><span class="p">[</span><span class="mi">1</span><span class="s s-Atom">::</span><span class="mi">2</span><span class="p">]</span>
<span class="s s-Atom">print</span> <span class="s s-Atom">t1</span> <span class="s s-Atom">if</span> <span class="nf">any</span><span class="p">(</span><span class="s s-Atom">i</span><span class="p">!</span><span class="s s-Atom">='#'</span> <span class="s s-Atom">for</span> <span class="s s-Atom">i</span> <span class="s s-Atom">in</span> <span class="s s-Atom">t1</span><span class="p">)</span> <span class="s s-Atom">else</span> <span class="s s-Atom">t2</span>
</pre></div>
<p>3月13日的 格式优化版:</p>
<div class="highlight"><pre><span></span><span class="nv">L</span> <span class="o">=</span> <span class="s s-Atom">'#'</span><span class="p">.</span><span class="nf">join</span><span class="p">(</span><span class="nv">L</span><span class="p">)</span>
<span class="nv">L</span> <span class="o">=</span> <span class="s s-Atom">'#'</span><span class="o">+</span><span class="nv">L</span><span class="s s-Atom">+'#'</span> <span class="s s-Atom">#</span> <span class="s s-Atom">因为这句,末尾print语句统一了。</span>
<span class="s s-Atom">o</span><span class="p">,</span><span class="s s-Atom">r</span> <span class="o">=</span> <span class="mi">0</span><span class="p">,</span><span class="mi">0</span>
<span class="s s-Atom">l</span> <span class="o">=</span> <span class="nf">len</span><span class="p">(</span><span class="nv">L</span><span class="p">)</span>
<span class="s s-Atom">for</span> <span class="s s-Atom">i</span> <span class="s s-Atom">in</span> <span class="nf">xrange</span><span class="p">(</span><span class="s s-Atom">l</span><span class="p">)</span><span class="s s-Atom">:</span>
<span class="s s-Atom">if</span> <span class="s s-Atom">i</span><span class="o">+</span><span class="s s-Atom">r</span> <span class="o">>=</span> <span class="nn">l</span><span class="p">:</span>
<span class="s s-Atom">break</span>
<span class="s s-Atom">if</span> <span class="nv">L</span><span class="p">[</span><span class="s s-Atom">i</span><span class="o">-</span><span class="nn">r</span><span class="p">:</span><span class="s s-Atom">i</span><span class="p">]</span><span class="o">==</span><span class="nv">L</span><span class="p">[</span><span class="s s-Atom">i</span><span class="o">+</span><span class="nn">r</span><span class="p">:</span><span class="nn">i</span><span class="p">:</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span><span class="s s-Atom">:</span>
<span class="s s-Atom">o</span> <span class="o">=</span> <span class="s s-Atom">i</span>
<span class="s s-Atom">j</span> <span class="o">=</span> <span class="s s-Atom">r</span><span class="o">+</span><span class="mi">1</span> <span class="s s-Atom">#</span> <span class="s s-Atom">尝试加一</span>
<span class="s s-Atom">while</span> <span class="s s-Atom">o</span><span class="o">-</span><span class="s s-Atom">j</span><span class="o">>=</span><span class="mi">0</span> <span class="s s-Atom">and</span> <span class="s s-Atom">o</span><span class="o">+</span><span class="s s-Atom">j</span><span class="o"><</span><span class="s s-Atom">l</span> <span class="s s-Atom">and</span> <span class="nv">L</span><span class="p">[</span><span class="s s-Atom">o</span><span class="o">-</span><span class="s s-Atom">j</span><span class="p">]</span> <span class="o">==</span> <span class="nv">L</span><span class="p">[</span><span class="s s-Atom">o</span><span class="o">+</span><span class="s s-Atom">j</span><span class="p">]</span><span class="s s-Atom">:</span>
<span class="s s-Atom">j</span> <span class="s s-Atom">+=</span> <span class="mi">1</span>
<span class="s s-Atom">r</span> <span class="o">=</span> <span class="s s-Atom">j</span><span class="o">-</span><span class="mi">1</span>
<span class="s s-Atom">print</span> <span class="nv">L</span><span class="p">[</span><span class="s s-Atom">o</span><span class="o">-</span><span class="s s-Atom">r</span><span class="o">+</span><span class="mi">1</span><span class="s s-Atom">:o</span><span class="o">+</span><span class="nn">r</span><span class="p">:</span><span class="mi">2</span><span class="p">]</span>
</pre></div>
<p>又经过10多天,我又扫完一遍题,这次我以72题的成绩排在GodIsCoding和<span class="caps">YOSHINO</span>之后第三名。</p>
<h3 id="_3">总结:<a class="headerlink" href="#_3" title="Permanent link">¶</a></h3>
<p>做完之后,我的感觉是,python是很美很简单语言,如其名。</p>
<h3 id="_4">生活题外话:<a class="headerlink" href="#_4" title="Permanent link">¶</a></h3>
<p>没能及时报考C语言二级,非常遗憾,英语六级不知道报呢还是不报好。</p>大二C++课程期末作业——一个小工程项目总结2013-07-31T08:30:00+08:002017-11-30T22:12:00+08:00pythonwoodtag:blog.pythonwood.com,2013-07-31:/2013/07/大二C++课程期末作业——一个小工程项目总结/<p>第一次独立完成的C++小项目,40小时 + 5小时Update + 8小时Linux移植。</p>
<h3 id="_1">过程:<a class="headerlink" href="#_1" title="Permanent link">¶</a></h3>
<p>过程非常认真,一个星期主要就是忙这个,为了完成某个部分,有时饭都推迟吃,连续对着电脑10几个小时很累,晚上写到很晚才睡,休息也不够,这让我明白到程序员是不好当的!</p>
<h3 id="_2">成果:<a class="headerlink" href="#_2" title="Permanent link">¶</a></h3>
<p><strong>最终版在Win7+<span class="caps">VS2005</span>、Ubuntu+G++环境都成功 …</strong></p><p>第一次独立完成的C++小项目,40小时 + 5小时Update + 8小时Linux移植。</p>
<h3 id="_1">过程:<a class="headerlink" href="#_1" title="Permanent link">¶</a></h3>
<p>过程非常认真,一个星期主要就是忙这个,为了完成某个部分,有时饭都推迟吃,连续对着电脑10几个小时很累,晚上写到很晚才睡,休息也不够,这让我明白到程序员是不好当的!</p>
<h3 id="_2">成果:<a class="headerlink" href="#_2" title="Permanent link">¶</a></h3>
<p><strong>最终版在Win7+<span class="caps">VS2005</span>、Ubuntu+G++环境都成功。</strong></p>
<h3 id="_3">环境工具的选择:<a class="headerlink" href="#_3" title="Permanent link">¶</a></h3>
<p><span class="caps">VS2010</span>随便写个程序在<span class="caps">XP</span>原生态下都不能运行!<span class="caps">VC6</span>太旧,<span class="caps">XP</span>下用得好。<span class="caps">VS2008</span>是Vista时代的魂魄。所以最好还是用<span class="caps">VS2005</span>。下载地址:Visual Studio 各版本下载合集vs2005下载vs2008下载vs2010下载vs2012下载</p>
<h3 id="_4">得益:<a class="headerlink" href="#_4" title="Permanent link">¶</a></h3>
<p>一开始将main分成四个独立子函数,用的是增量式开发,俗称打桩,用得比较好,好处是模块化。这一点非常有益。</p>
<p>记得刚开始学C语言的第21天,几天里,20个小时写出个蹩脚的图书馆综合系统。得益于这个经验,才令我相信我能完成。</p>
<p>《Accelerate C++》的确是非常适合学习C++的,以前看了不明白它的好,认真看才知妙!完全借用了它的字符图形函数处理类Picture。</p>
<h3 id="_5">改进:<a class="headerlink" href="#_5" title="Permanent link">¶</a></h3>
<p>要善用sprintf和sscanf:atoi、atof、itoa、itow函数是windows平台下实现字符串与数值相互转换的函数。Linux平台下请使用标准库中的sprintf与sscanf函数。</p>
<p>调试过程很大部分是在<span class="caps">UI</span>用户中,说明<span class="caps">UI</span>函数多,且易错。</p>
<p>房号设计02 - 23 ,0223 ,整数怎样表示,这些问题一直缠绕,一开始没解决好,就会影响全局。</p>
<h3 id="_6">备忘:<a class="headerlink" href="#_6" title="Permanent link">¶</a></h3>
<p>类的定义和实现在项目推进过程中不断修改,逐渐完善。</p>
<p>用户交互模块最大,ui()函数的ui.cpp文件有454行,<span class="caps">14KB</span>。有的模块文件只有几十行,这些开始时是没想到的。</p>
<p>什么是优雅,注重代码重用,函数最好小而精,一次只做一件事。也是Unix类系统的神髓。</p>
<p>老师对我的实验成果~~相当~~比较满意,给分也~~相对地~~高一点。感谢。</p>虚拟机系统正式转换——从windows到Linux-ubuntu新手2013-07-10T16:29:00+08:002017-11-30T22:30:00+08:00pythonwoodtag:blog.pythonwood.com,2013-07-10:/2013/07/虚拟机系统正式转换——从windows到Linux-ubuntu新手/<p>记录大二下学期转换ubuntu10.04的一些系统折腾</p>
<h3 id="_1">版本选择:<a class="headerlink" href="#_1" title="Permanent link">¶</a></h3>
<ol>
<li>
<p><strong>经多次实验,Ubuntu个人认为长期支持(<span class="caps">LTS</span>)版才值得装。</strong></p>
</li>
<li>
<p>VMware9中测试:Ubuntu10.04开机内存170M,Ubuntu12.04开机内存340M。</p>
</li>
<li>
<p>个人感觉Ubuntu12.04像win7华丽消耗大,Ubuntu10.04像<span class="caps">XP</span>,对程序员实在。</p>
</li>
<li>
<p>Ubuntu12.04的桌面切换真麻烦 …</p></li></ol><p>记录大二下学期转换ubuntu10.04的一些系统折腾</p>
<h3 id="_1">版本选择:<a class="headerlink" href="#_1" title="Permanent link">¶</a></h3>
<ol>
<li>
<p><strong>经多次实验,Ubuntu个人认为长期支持(<span class="caps">LTS</span>)版才值得装。</strong></p>
</li>
<li>
<p>VMware9中测试:Ubuntu10.04开机内存170M,Ubuntu12.04开机内存340M。</p>
</li>
<li>
<p>个人感觉Ubuntu12.04像win7华丽消耗大,Ubuntu10.04像<span class="caps">XP</span>,对程序员实在。</p>
</li>
<li>
<p>Ubuntu12.04的桌面切换真麻烦。</p>
</li>
</ol>
<p>我最后选择了VMware9+Ubuntu10.04。</p>
<h3 id="linux-ubuntuvmware">安装Linux-Ubuntu(VMware平台支持下):<a class="headerlink" href="#linux-ubuntuvmware" title="Permanent link">¶</a></h3>
<h4 id="_2">双系统形式:<a class="headerlink" href="#_2" title="Permanent link">¶</a></h4>
<p>wubi安装:不用分区,直接在某原分区建立文件来代表Ubuntu,应该是虚拟化技术。安全快捷,易卸载。</p>
<p>光盘安装:win7原来有4分区,安装Ubuntu后E盘少了7G,无其它变化,推测装在了E盘。</p>
<h4 id="_3">单系统:<a class="headerlink" href="#_3" title="Permanent link">¶</a></h4>
<p>安装后占3.6G左右,其中用于虚拟内存交换的空间2G,系统文件/bin/*等只占1G多。</p>
<h5 id="_4">安装过程的技巧:<a class="headerlink" href="#_4" title="Permanent link">¶</a></h5>
<p>安装过程所增加的用户只是桌面用户,非超级用户。安装后用sudo root passwd修改root密码。</p>
<p>计算机名和用户名最好3到6个字符就好了。</p>
<p>Ubuntu安装过程下载中文语言包时最好跳过,太慢了,装好后自己设置一个快的源,然后下载。</p>
<h3 id="_5">常用软件安装:<a class="headerlink" href="#_5" title="Permanent link">¶</a></h3>
<p>极点五笔,个人比较钟意。</p>
<p>Adobe Flash 为了网页(若安装gecko_mediaplayer,则不用)。</p>
<p><strong>Mplayer 相传宇宙最强播放器(然后最好gecko_mediaplayer,SMPlayer一起装)。</strong></p>
<p>wine 用于运行Windows程序。
aMule 电骡(官方中译),可选,个人测试不好。</p>
<p>build-essential 程序依赖库。</p>
<p>g++,nasm,emacs,open-ssh,vnc……</p>
<p><strong>gvim</strong></p>
<p>就我而言,我更喜欢gvim,即使用了3个月emacs了,但是还是义无反顾地转成vim党了。</p>
<p>gvim是编辑器之神,emacs是神一样的编辑器。前句强调gvim始终是一个编辑器,后句说明emacs可以做远超编辑器的事。</p>
<h3 id="-">使用-习惯:<a class="headerlink" href="#-" title="Permanent link">¶</a></h3>
<p>Ubuntu12.04开机都会打开终端(Terminal),在第二桌面。比较喜欢linux的多虚拟桌面功能。</p>
<p>firefox总是在第三桌面打开,影音在第四桌面。</p>
<p>将常打开的程序放在面板上。</p>
<h3 id="_6">终端:<a class="headerlink" href="#_6" title="Permanent link">¶</a></h3>
<p>输入密码不以星号表示,无显示,惯了就好。桌面窗口环境则由星号表示。</p>
<p>最常用的键:Tab;方向上;Ctrl+C; 补全,重复历史,强制终止。</p>
<p>最常用命令:ls;cat;history ; </p>
<p>最好用的符号:|;<;>; </p>
<p>Ctrl+A/D/L/R: 到行首/行尾/清屏/查找命令历史</p>
<h3 id="win7linux">Win7/Linux字符编码问题:<a class="headerlink" href="#win7linux" title="Permanent link">¶</a></h3>
<h4 id="win7linux_1">Win7/Linux编码差异:<a class="headerlink" href="#win7linux_1" title="Permanent link">¶</a></h4>
<p>win7的多字符实现:<span class="caps">GBK</span>,2字节;Unicode:unicode16,2字节。Linux的多字符实现:utf8,1-6字节;Unicode:unicode32,4字节。</p>
<h3 id="_7">换行符问题:<a class="headerlink" href="#_7" title="Permanent link">¶</a></h3>
<p>win7换行=\r\n 而Linux换行=\n;所以Linux文本在win7下用记事本打开都是一行的。转换很简单用fromdos / todos 命令就行。</p>
<p>win7下保存的文本文件复制到Linux下后,中文变成乱码。</p>
<p>===〉win7的字符是<span class="caps">GBK</span>,Linux的字符是<span class="caps">UTF8</span>,utf8在win7可以正常显示,所以建议用iconv命令转成<span class="caps">UTF8</span>,而不是将Linux默认的编码变成<span class="caps">GBK</span>来适应。</p>
<p>win7下保存的文本文件到Linux下后,双击提示运行。</p>
<p>===〉方法:chmod a-x <filename>;或者先在win7打包成zip文件,再复制,再解压,就可以彻底解决。这是个目前最好的通用方法。</p>
<h3 id="_8">感受<a class="headerlink" href="#_8" title="Permanent link">¶</a></h3>
<p>至今已经输入2000个命令。不知不觉习惯中。</p>
<div class="highlight"><pre><span></span>* | more # 分屏显示
iconv -f gbk -t utf8 sample_config.txt | fromdos > ../release/sample_config
cat -n ~/.bash_history | todos > _bash_history2013-07-10.txt
</pre></div>
<p><span class="caps">JNU</span> 2013-07-10 16:41:51 今天考完《Linux/Unix使用》。</p>