首页 >  帮助中心 > nano编辑器使用教程

nano编辑器使用教程

来源:原创 点击量(222) 发布时间:2013-06-22
<p>nano编辑器使用教程</p><p><br /></p><div style=&#34;font-family:verdana, arial, sans-serif;font-size:13px;line-height:20px;background-color:#ffffff;&#34;><p style=&#34;margin-top:0px;margin-bottom:1.8em;&#34;><br class=&#34;Apple-interchange-newline&#34; /><img class=&#34;alignnone size-full wp-image-1229&#34; title=&#34;gnu-nano-logo-150x150&#34; src=&#34;/static/ueditor/php/../../../upload_file/36501371876376.png&#34; width=&#34;150&#34; height=&#34;150&#34; /></p><p style=&#34;margin-top:0px;margin-bottom:1.8em;&#34;>使用Linux VPS会经常和编辑器打交道,一般常用的是vi和nano,虽然vi功能强大,但是相对新手来要稍微难上手,GNU nano是一个体积小巧而功能强大的文本编辑器。这里就简单说一下nano的使用方法。</p><h3>安装</h3><p style=&#34;margin-top:0px;margin-bottom:1.8em;&#34;>CentOS:执行yum -y install nano</p><p style=&#34;margin-top:0px;margin-bottom:1.8em;&#34;>Debian:执行apt-get install -y nano</p></div><div style=&#34;font-family:verdana, arial, sans-serif;font-size:13px;line-height:20px;background-color:#ffffff;&#34;><h3>新建/打开文件</h3><pre>nano 路径+文件名<span id=&#34;more-1228&#34;></span></pre><p style=&#34;margin-top:0px;margin-bottom:1.8em;&#34;>如果改文件存在,上面的命令将打开这个文件;如果文件不存在则将会创建一个新文件并打开。</p><blockquote><p style=&#34;margin-top:0px;margin-bottom:1.8em;&#34;>Note:在Windows系统中,一个文件应当有后缀名,比如.txt,以供系统进行类型判断,不过Linux并不根据 后缀名来判断类型。当然,写上后缀名也无妨,比如example也可以用example.txt。</p></blockquote><h3>光标控制</h3><p style=&#34;margin-top:0px;margin-bottom:1.8em;&#34;>移动光标:使用用方向键移动。</p><p style=&#34;margin-top:0px;margin-bottom:1.8em;&#34;>选择文字:按住鼠标左键拖到。</p><h3>复制、剪贴和粘贴</h3><p style=&#34;margin-top:0px;margin-bottom:1.8em;&#34;>复制一整行:Alt+6</p><p style=&#34;margin-top:0px;margin-bottom:1.8em;&#34;>剪贴一整行:Ctrl+K</p><p style=&#34;margin-top:0px;margin-bottom:1.8em;&#34;>粘贴:Ctrl+U</p><p style=&#34;margin-top:0px;margin-bottom:1.8em;&#34;>如果需要复制/剪贴多行或者一行中的一部分,先将光标移动到需要复制/剪贴的文本的开头,按Ctrl+6(或者Alt+A)做标记,然后移动光标到 待复制/剪贴的文本末尾。这时选定的文本会反白,用Alt+6来复制,Ctrl+K来剪贴。若在选择文本过程中要取消,只需要再按一次Ctrl+6。</p><h3>搜索</h3><p style=&#34;margin-top:0px;margin-bottom:1.8em;&#34;>按Ctrl+W,然后输入你要搜索的关键字,回车确定。这将会定位到第一个匹配的文本,接着可以用Alt+W来定位到下一个匹配的文本。</p><h3>翻页</h3><p style=&#34;margin-top:0px;margin-bottom:1.8em;&#34;>用Ctrl+Y到上一页,Ctrl+V到下一页</p><h3>保存</h3><p style=&#34;margin-top:0px;margin-bottom:1.8em;&#34;>使用Ctrl+O来保存所做的修改</p><h3>退出</h3><p style=&#34;margin-top:0px;margin-bottom:1.8em;&#34;>按Ctrl+X</p><p style=&#34;margin-top:0px;margin-bottom:1.8em;&#34;>如果你修改了文件,下面会询问你是否需要保存修改。输入Y确认保存,输入N不保存,按Ctrl+C取消返回。</p><p style=&#34;margin-top:0px;margin-bottom:1.8em;&#34;>如果输入了Y,下一步会让你输入想要保存的文件名。如果不需要修改文件名直接回车就行;若想要保存成别的名字(也就是另存为)则输入新名称然后确 定。这个时候也可用Ctrl+C来取消返回。</p><h3>获得帮助</h3><p style=&#34;margin-top:0px;margin-bottom:1.8em;&#34;>进入nano界面后,下面有两行菜单,例如,“^G Get Help”。其意义如下:</p><p style=&#34;margin-top:0px;margin-bottom:1.8em;&#34;>^G意味着快捷键是Ctrl+G,“Get Help”当然是功能了。</p><p style=&#34;margin-top:0px;margin-bottom:1.8em;&#34;>根据这些提示就可以立刻开始使用nano了,也可以Ctrl+G看看帮助。</p><blockquote><p style=&#34;margin-top:0px;margin-bottom:1.8em;&#34;>Note:nano中,黑底白字表示快捷键操作。其中“^”表示Ctrl键,则Ctrl+G就表示成“^G”。“M”表示 Alt键,则Alt+W表示为“M-W”。</p></blockquote></div><p><span style=&#34;color:#333333;font-family:楷体, 楷体_gb2312, simkai;font-size:12px;line-height:40px;background-color:#ffffff;&#34;>转载自:http://www.vpser.net/</span><br /></p>
  • 服务热线   13140588537