Linux nano文本编辑器

GNU nano 1.2.4,nano的版本 File: /etc/network/interfaces打开的文件的绝对地址

下面就是打开的文件的内容# This file describes the network interfaces available on your system# and how to activate them. For more information, see interfaces(5).

# The loopback network interfaceauto loiface lo inet loopback

# The primary network interfaceauto eth0iface eth0 inet staticaddress 192.168.254.20netmask 255.255.255.0network 192.168.254.0broadcast 192.168.254.255gateway 192.168.254.254# dns-* options are implemented by the resolvconf package, if installeddns-nameservers 202.103.0.117 202.103.24.68[ Read 17 lines ]^G Get Help ^O WriteOut ^R Read File ^Y Prev Page ^K Cut Text ^C Cur Pos^X Exit ^J Justify ^W Where Is ^V Next Page ^U UnCut Txt ^T To Spell

这些是帮助栏目,呵呵^G表示ctrl+g一起按,呵呵

^G Get Help表示同时按ctrl和G,就是调出帮助菜单

我们来试一下我按了一下就调出了帮助菜单了,我下面就直接把快捷键表给大家,大家试试吧

一直以来vi都被人们说是最强大的编辑器,但gentoo和debian选择nano做了默认的编辑器freebsd选择ee做了默认的编辑器,我相信在专业人士眼睛里面freebsd和redaht比较起来,RedHat基本没什么可以炫耀的,为什么他们不选择vi呢,因为vi操作比较复杂而所谓的简单编辑器nano就简单,非常容易上手,说是简单编辑器其实一点都不简单,只不过是nano谦虚一下罢了

这里声明一下^表示键盘上的ctrl键,上个只要是做过编程的朋友应该都清楚,^G表示同时按下ctrl和g(F1)表示按(F1)也是一样的 ,M-表示使用alt+后面的键

^G ==F1) Invoke the help menu调用帮助菜单

^X ==(F2) Close currently loaded file/Exit from nano退出

^O ==(F3) Write the current file to disk == ^O WriteOut保存然后回车就保存了

^J ==(F4) Justify the current paragraph调整当前段落(配置文件的不要用这东西,格式一下就出问题了哦)

^R ==(F5) Insert another file into the current one插入其他的文件到当前的文件,而且查找文件的时候支持tab

^W ==(F6) Search for text within the editor

查找^Y ==(F7) Move to the previous screen上一屏幕^V ==(F8) Move to the next screen下一屏幕^K ==(F9) Cut the current line and store it in the cutbuffer裁减当前一排并保存在缓冲区

^U ==(F10) Uncut from the cutbuffer into the current line将缓冲区的东西粘贴到此

^C ==(F11) Show the position of the cursor显示光标位置

^T ==(F12) Invoke the spell checker, if available

调用拼写检查程序

^P Move up one line

向上移动一行^N Move down one line

向下移动一

^F Move forward one character向前移动光标一格

^B Move back one character向后移动光标一格

^A Move to the beginning of the current line移动到当前行的开头

^E Move to the end of the current line移动到当前行的末尾

^L Refresh (redraw) the current screen刷新当前屏幕

^^ (M-A) Mark text at the current cursor location标记文本

^D Delete the character under the cursor

删除光标后一个字母^H Delete the character to the left of the cursor向左边删一个字母^I Insert a tab character插入一个tab值^\ (F14) (M-R) Replace text within the editor

查找并且替换^M Insert a carriage return at the cursor position插入一个回车^_ (F13) (M-G) Go to a specific line number

跳转到某行^Space Move forward one word

前进一个单词M-Space Move backward one word后退一个单词M-] Find other bracket搜索下一个括号

M-< Open previously loaded file打开先前加载的文件

M-> Open next loaded file

打开下一个加载的文件

M-C Constant cursor position enable/disable

M-I Auto indent enable/disable是否首行缩进

M-Z Suspend enable/disable是否悬挂

M-X Help mode enable/disable帮助模式

M-M Mouse support enable/disable

鼠标支持

M-Y Color syntax highlighting enable/disable语法加亮

这个就是退出了哦

好了nano 的编辑器就说这样多了然后我们来说一下基本的几个配置文件以及地方首先是打开命令行高效输入的位置看到了高级的命令行补全,连软件包的名字都不需要记了哦,呵呵,是不是很爽哦

怎么ls没颜色了,你们是不是在redhat里面看到过颜色啊,那我们来改看到了没,兰色是目录,白色是文件,绿色是可以运行的文件

cnrot:/# ll-bash: ll: command not found告诉我们ll没这个命令那我们来做一个自己定义的命令吧记住要注销才生效,不需要重新启动的哦看到了没看到了没,这是自己定义命令哦好了,我现在 给大家说几个文件的位置吧

怕大家找不到首先是网络配置文件/etc/network/interfaces

GNU nano 1.2.4 File: /etc/network/interfaces Modified

# This file describes the network interfaces available on your system# and how to activate them. For more information, see interfaces(5).

# The loopback network interfaceauto loiface lo inet loopback

# The primary network interfaceauto eth0iface eth0 inet staticaddress 192.168.254.20netmask 255.255.255.0network 192.168.254.0broadcast 192.168.254.255gateway 192.168.254.254# dns-* options are implemented by the resolvconf package, if installeddns-nameservers 202.103.0.117 202.103.24.68

安装源配置文件GNU nano 1.2.4 File: /etc/apt/sources.list

#deb file:///cdrom/ sarge main

deb cdrom:[Debian GNU/Linux 3.1 r0a _Sarge_ – Official i386 Binary-1 (20050607)$

deb stable maindeb-src stable main

deb stable/updates main contrib

拷贝、剪切以及粘贴:可以按住鼠标左键之后拉动鼠标将您需要复制的文本反白显示,然后将光标移动到想插入内容的地方,直接点鼠标右键,即可把刚才用鼠标选择的反白文本粘贴到该处。也可以先把在windows下的文本编辑器或者浏览器上的某些文本复制下来,然后切换到nano中,将光标移到想插入内容的地方,直接点鼠标右键,就可以将刚才复制在内存中的文本粘贴到该处。还可以将光标移动到需要复制(或者剪切)的文本的初始位置,然后按Ctrl+6(或者Alt+A)做下标记,再移动光标到需要复制、剪切的文本结束位置。将选定的文本反白显示,最后将光标移动到想插入内容的地方,按Alt+6来将刚才选择的内容复制到该位置(或者按Ctrl+K来剪切)。如果在选择文本的过程中想要取消掉刚才的选择,那么要再按一次Ctrl+6即可取消刚才的选择。另外可以使用Alt+6来复制一整行的内容到内存,然后将光标移动到您想插入内容的地方,,直接点鼠标右键即可完成粘贴。将Alt+6换成Ctrl+K,即可剪切。或者您也可用Ctrl+U来代替鼠标右键来完成粘贴。搜索:按下Ctrl+W,然后键入你要搜索的字符串,再按回车Enter就可以了。如果想再次搜索相同的字符串,可以直接按Alt+W即可。翻页:Ctrl+Y上翻页、Ctrl+V下翻页。保存与退出:如要保存修改,按Ctrl+O。退出,按Ctrl+X。这时如果在退出前没有保存所做的修改,将会提示你是否要保存。如果需要保存请按Y并回车Enter,不需要保存则按N然后回车Enter。当文件为新建文件时,选择保存将会让你确认要保存的文件名。帮助:按Ctrl+G可以查看nano的帮助文档。在nano帮助文档里,Ctrl键表示为^,Ctrl+W显示为^W。Alt键被表示为一个M,因此Alt+W显示为M-W。如果想调整nano设置,可以编辑/etc/nanorc 另外如果您的Linux版本里未自带nano的话,请用如下命令安装nano即可:rpm -Uvh nano-x.y.z-1.i386.rpm RedHat:dpkg -i nano_x.y.z-1.deb CentOS:yum -y install nanoDebian:apt-get install -y nano 也可以自己下载自己编译:tar -zxvf nano-x.y.z.tar.gz如果出现- z的错误信息gzip -dc nano-x.y.z.tar.gz | tar xvf – 如果需要运行配置选项:cd nano-x.y.z/./configuremakemake install

一个人目睹沿途的风景,拿着相机,拍下沿途上的风景,

Linux nano文本编辑器

相关文章:

你感兴趣的文章:

标签云: