Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Usage of emacs and nano
06-07-2018, 11:51 AM (This post was last modified: 06-14-2018 02:30 PM by cchen.)
Post: #1
Usage of emacs and nano
When you don't have a graphical interface of text editor to use, you may need to use the emacs command to do editing. Here is a brief introduction to the usage of emacs

P1). start editing:
Code:
emacs [-nw] <file-path>
If the file doesn't exist, a new file is created. Notice that you must use the '-nw' option if you are not running on a x-server

P2). save changes:
ctl-x ctl-s

P3). quit editing:
ctl-x ctl-c

P4). search for some content:
Alt-x rgrep
*you can specify the directory and file to search in, not necessarily in one file that's opened currently
*if you don't need to edit anything, using "less" command with "/pattern" or "?pattern" may be better

Another common editor is nano. You can install nano by:
Code:
sudo yum install nano

The usage is:
P1). start editing:
Code:
nano filename

P2). quit editing:
Code:
ctl-x
press 'y' for saving changes, 'n' for not
press enter

You can also use your other preferred editors (vim, sublime) very conveniently:
vim: http://apetec.com/linux/installvim.htm
sublime: https://www.tecmint.com/install-sublime-...https://www.tecmint.com/install-sublime-text-editor

RR rayluk
Find all posts by this user
Quote this message in a reply
06-07-2018, 12:03 PM
Post: #2
RE: Usage of emacs
(06-07-2018 11:51 AM)cchen Wrote:  When you don't have a graphical interface of text editor to use, you may need to use the emacs command to do editing. Here is a brief introduction to the usage of emacs

P1). start editing:
Code:
emacs <file-path>
If the file doesn't exist, a new file is created

P2). save changes:
ctl-x ctl-s

P3). quit editing:
ctl-x ctl-c

RR rayluk

Good to me. I remember there is an -nw option for situations without x-server. I think most of the situations in our company are working without x-server. Please also add it.
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump: