ubuntu edit text commands

Common console-based text editor are the following:

emacs            comprehensive GNU emacs  editing environment

nano               similar to the classic pico text editor, a built-in pine mail program

vim                an improved vi text editor

Note that not all text editors are based console, that supports the terminal. There are some text editors are designed to provide a graphical interface with menu bars, buttons, progress bars, etc. E.g:

gedit                a GUI text editor, Ubuntu installed by default

kate                a simple KDE text editor

kedit               Another simple KDE text editor

 

nano text editor usage

nano editor of the most simple and easy to use, and basically all of the Linux installed. So we first took off in terms of it. Open a nano editor can use the following commands:

nano file.txt

nano editor is very simple, you can easily use it without any additional knowledge. Here are some basic commands. ( ^ Control keys Control )

Cursor direction keys (upper / lower / left / Right), the PageUp / Page Down , or ^ y and ^ V .                     

Add character input at the cursor                      

Delete characters                       Delete key or the Backspace key

Exit                            ^ the X- (will be prompted to save changes)

Help                            ^ g

nano editor interface is as follows:


 

vi text editor usage

Basically every Linux / Unix systems are equipped with vi editor. Open a vi editor, use the command:

vi file.txt

vi编辑器的工作有插入(编辑)模式和浏览(命令)模式。当你最开始编辑时,你处于浏览模式,你可以使用箭头或者其他导航键在文本中导航。开始编辑时,键入i,插入文本,或者键入a,在末尾添加文本。当你编辑结束时,键入Esc退出插入/添加模式,进入浏览(命令)模式。键入命令时,首先键入冒号(:),后面紧跟命令,例如w命令去编辑文本,然后键入Enter

尽管vi编辑器支持非常复杂的操作并且有无数条命令,然而你可以仅用一些简单的命令就能完成工作,这些基本的vi命令主要有:

光标运动                        h,j , k, l (上///右)

删除字符                        x

删除行                          dd

模式退出                        Esc,Insert(或者i

退出编辑器                      q

强制退出不保存                q!

运行shell命令                 :sh(使用exit返回vi编辑器)

保存文件                        :w

文本查找                         /

使用vim tutor命令可以快速学习vi键盘命令的用法。这个教程不到30分钟,教给用户如何开启和关闭编辑器,导航文件,插入删除文本,查找,替换和插入操作。

VI(VIM)详细使用命令:

http://jingyan.baidu.com/article/9f63fb91c58387c8400f0eef.html

emacs文本编辑器的用法

Richard M. StallmanGNU emacs文本编辑器,和vi一样,被Ubuntu和几乎所有的Linux系统默认安装。和其他Unix/Linux文本编辑器不同的是,emacs并不仅仅是一个简单的文本编辑器。它是一个编辑环境,可以被用来编译运行程序,可以作为电子日记,约会簿和日历,可以用来编辑和发送邮件,阅读Usernet新闻,甚至玩游戏。emacs之所以具有这么强大的功能是因为它包含了一个内置的language interpreter,使用Elispemacs LISP)编程语言。emacs没有在Ubuntu中默认安装,可使用下列命令安装emacs

sudo apt-get install emacs

开启一个emacs编辑器可使用如下命令:

emacs file.txt

当你在X11中使用上述命令打开emacs时,这个编辑器并不出现在终端窗口中,而是以浮动窗口的形式出现。强制使emacs窗口显示在终端中而不是它自己的窗口,可以使用-nw参数,如以下命令:emacs -nw file.txt

emacs文本编辑器拥有大量的快捷键和命令,但是用户可以掌握这些命令的一个子集即可满足日常工作的需要。这些基本命令通常都需要按住Ctrl键,或者是先键入meta键(通常映射为Alt键)。下面是一些常用的命令。

动作                                  命令

终止                           Ctrl+g

光标左移                     Ctrl+b

光标下移                     Ctrl+n

光标右移                     Ctrl+f

光标上移                     Ctrl+p

删除字符                     Ctrl+d

删除行                        Ctrl+k

光标移到行首               Ctrl+a

光标移到行尾               Ctrl+e

帮助                          Ctrl+h

退出                          Ctrl+x,Ctrl+c

另存为                       Ctrl+x,Ctrl+w

保存文件                    Ctrl+x,Ctrl+s

后向检索                    Ctrl+r

前向检索                    Ctrl+s

入门训练                    Ctrl+h,t

撤销编辑                    Ctrl+x,u

学习使用emacs编辑器的一个优点是你可以在bashshell命令行中使用类似的快捷键,尽管你也可以将bash shell 命令行的快捷键和vi快捷键绑定。另外一个原因是emacs编辑器几乎被安装在所有的Unix/Linux系统中,以及苹果的MacOS X系统中。

 

参考链接:https://blog.csdn.net/qq_37497322/article/details/79823100

Guess you like

Origin www.cnblogs.com/jsdy/p/11829345.html