╃苍狼山庄╃╃苍狼山庄╃

Clang出品,
必属精品!

Linux下轻型文本编辑器Nano常用快捷键

安装
CentOS安装命令:

yum -y install nano


Debian/Ubuntu安装命令:

apt-get install -y nano


新建/打开文件

nano 路径+文件名


如果该文件存在,上面的命令将打开这个文件;如果文件不存在则将会创建一个新文件并打开。
Note:在Windows系统中,一个文件应当有后缀名,比如.txt,以供系统进行类型判断,不过Linux并不根据后缀名来判断类型。当然,写上后缀名也无妨,比如example也可以用example.txt。
光标控制
1、移动光标:使用用方向键移动。
2、选择文字:按住鼠标左键拖动。
3、复制、剪切和粘贴
复制一整行:Alt+6
剪切一整行:Ctrl+K
粘贴:Ctrl+U
如果需要复制/剪切多行或者一行中的一部分,先将光标移动到需要复制/剪切的文本的开头,按Ctrl+6(或者Alt+A)做标记,然后移动光标到待复制/剪切的文本末尾。这时选定的文本会反白,用Alt+6来复制,Ctrl+K来剪切。若在选择文本过程中要取消,只需要再按一次Ctrl+6。
搜索
按Ctrl+W,然后输入你要搜索的关键字,回车确定。这将会定位到第一个匹配的文本,接着可以用Alt+W来定位到下一个匹配的文本。
翻页
用Ctrl+Y到上一页,Ctrl+V到下一页
保存
使用Ctrl+O来保存所做的修改
退出
按Ctrl+X
如果你修改了文件,下面会询问你是否需要保存修改。输入Y确认保存,输入N不保存,按Ctrl+C取消返回。
如果输入了Y,下一步会让你输入想要保存的文件名。如果不需要修改文件名直接回车就行;若想要保存成别的名字(也就是另存为)则输入新名称然后确定。这个时候也可用Ctrl+C来取消返回。
获得帮助
进入nano界面后,下面有两行菜单,例如,“^G Get Help”。其意义如下:
^G意味着快捷键是Ctrl+G,“Get Help”当然是功能了。
根据这些提示就可以立刻开始使用nano了,也可以Ctrl+G看看帮助。
Note:nano中,黑底白字表示快捷键操作。其中“^”表示Ctrl键,则Ctrl+G就表示成“^G”。“M”表示 Alt键,则Alt+W表示为“M-W”。

Main nano help text

The nano editor is designed to emulate the functionality and ease-of-use of the UW Pico text
editor. There are four main sections of the editor. The top line shows the program version, the
current filename being edited, and whether or not the file has been modified. Next is the main
editor window showing the file being edited. The status line is the third line from the bottom
and shows important messages. The bottom two lines show the most commonly used shortcuts in the
editor.
either the Esc, Alt, or Meta key depending on your keyboard setup. Also, pressing Esc twice and
then typing a three-digit decimal number from 000 to 255 will enter the character with the
corresponding value. The following keystrokes are available in the main editor window.
Alternative keys are shown in parentheses:

^G (F1) Display this help text
^X (F2) Close the current file buffer / Exit from nano
^O (F3) Write the current file to disk
^J (F4) Justify the current paragraph

^R (F5) Insert another file into the current one
^W (F6) Search for a string or a regular expression
^Y (F7) Go to previous screen
^V (F8) Go to 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) Display the position of the cursor
^T (F12) Invoke the spell checker, if available

M-\ (M-|) Go to the first line of the file
M-/ (M-?) Go to the last line of the file

^_ (F13) (M-G) Go to line and column number
^\ (F14) (M-R) Replace a string or a regular expression
^^ (F15) (M-A) Mark text at the cursor position
M-W (F16) Repeat last search

M-^ (M-6) Copy the current line and store it in the cutbuffer
M-} Indent the current line
M-{ Unindent the current line
^F Go forward one character
^B Go back one character
^Space Go forward one word
M-Space Go back one word
^P Go to previous line
^N Go to next line

^A Go to beginning of current line
^E Go to end of current line
M-( (M-9) Go to beginning of paragraph; then of previous paragraph
M-) (M-0) Go just beyond end of paragraph; then of next paragraph
M-] Go to the matching bracket
M-- (M-_) Scroll up one line without scrolling the cursor
M-+ (M-=) Scroll down one line without scrolling the cursor
M-< (M-,) Switch to the previous file buffer
M-> (M-.) Switch to the next file buffer

M-V Insert the next keystroke verbatim
^I Insert a tab at the cursor position
^M Insert a newline at the cursor position
^D Delete the character under the cursor
^H Delete the character to the left of the cursor
M-T Cut from the cursor position to the end of the file
M-J Justify the entire file
M-D Count the number of words, lines, and characters
^L Refresh (redraw) the current screen
^Z Suspend the editor (if suspend is enabled)

(M-X) Help mode enable/disable
(M-C) Constant cursor position display enable/disable
(M-O) Use of one more line for editing enable/disable
(M-S) Smooth scrolling enable/disable
(M-P) Whitespace display enable/disable
(M-Y) Color syntax highlighting enable/disable
(M-H) Smart home key enable/disable
(M-I) Auto indent enable/disable
(M-K) Cut to end enable/disable
(M-L) Long line wrapping enable/disable
(M-Q) Conversion of typed tabs to spaces enable/disable
(M-B) Backup files enable/disable
(M-F) Multiple file buffers enable/disable
(M-M) Mouse support enable/disable
(M-N) No conversion from DOS/Mac format enable/disable
(M-Z) Suspension enable/disable
(M-$) Soft line wrapping enable/disable

本原创文章未经允许不得转载 | 当前页面:╃苍狼山庄╃ » Linux下轻型文本编辑器Nano常用快捷键

评论

文章评论已关闭!