《Linux-GNU nano編輯器》

官方地址

下載鏈接

說明使用

Linux GNU nano編輯器的使用
我們以後基本都需要編輯文件來實現不同的設置,那麼我們用什麼來設置配置文件呢,用編輯器,就好比windows下的記事本和寫字板,我們今天就來講一下debian的默認編輯器----nano

首先我們在網絡上看看有沒nano的資料
網絡上很少有nano的資料,那麼我就來 給大家講解一下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 interface
auto lo
iface lo inet loopback

#The primary network interface
auto eth0
iface eth0 inet static
address 192.168.254.20
netmask 255.255.255.0
network 192.168.254.0
broadcast 192.168.254.255
gateway 192.168.254.254
#dns-* options are implemented by the resolvconf package, if installed
dns-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 interface
auto lo
iface lo inet loopback

#The primary network interface
auto eth0
iface eth0 inet static
address 192.168.254.20
netmask 255.255.255.0
network 192.168.254.0
broadcast 192.168.254.255
gateway 192.168.254.254
#dns-* options are implemented by the resolvconf package, if installed
dns-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 http://debian.cn99.com/debian/ stable main
deb-src http://debian.cn99.com/debian/ stable main
deb http://security.debian.org/ stable/updates main contrib

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章