English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The Linux ed command is a text editor used for text editing.
ed is the simplest text editing program in Linux, which can only edit one line at a time rather than operate in a full-screen mode.
The ed command is not a commonly used command; the vi command is generally used more often. However, the ed text editor is very useful for editing large files or for text editing in shell script programs.
ed [-][-Gs][-p<string>][--help][--version][file]
Parameters:
-G or--traditional Provides backward compatibility features.
-p<string> Specifies the prompt character for ed in command mode.
-s,-,--quiet or--silent Does not execute the check function when opening a file.
--help Displays help.
--version Displays version information.
This is a complete example analysis of the Linux ed command:
$ ed <- Activate ed command a<- Tell ed that I want to edit a new file My name is Titan.<- Enter the first line content And I love Perl very much.<- Enter the second line content .<- Return to the command line state of ed i<- Tell ed that I want to insert content before the last line I am 24- 24, .<- Return to the command line state of ed c<- Tell ed that I want to replace the last input content I am 24 years old.<- 24, 24 years old.”(note: here, the last input is replaced) .<- Return to the command line state of ed w readme.text<- Rename the file to 'readme.text' and save (note: if it is editing an existing file, just type 'w' is enough) q<- Completely exit the ed editor
The content of the file is:
$ cat readme.text My name is Titan. I am 24 years old. And I love Perl very much.