BCA / B.Tech 9 min read

The `ed` Line Editor in Linux

The `ed` Line Editor in Linux:


`ed` is a text editor in Unix and Unix-like operating systems known as a "line editor." It is designed for editing text files line by line. It is primarily used in environments where the entire file cannot be viewed at once, such as on old terminal systems with limited screen space. `ed` is powerful but simple, making it very useful for batch editing and scripting, although it is less popular today compared to advanced editors like Vim or Nano.

History: `ed` was developed by Ken Thompson in 1971 and was one of the first editors in the early Unix operating system.

How `ed` Works: `ed` is a non-interactive, line-based editor, meaning it works on one line at a time. It doesn't display the entire file on the screen; instead, the user interacts with it through commands to add, delete, change, and search for text.

Key Features:
  • Line Editing: Edits one line at a time using keyboard commands.
  • Command-Based Interface: The entire interface is based on commands.
  • Batch Processing: Suitable for batch editing and works easily with scripts.

Some Common Commands in `ed`:

  • Printing and Editing: `p` (print a line), `a` (append new lines), `d` (delete a line), `c` (change a line).
  • Search and Replace: `s/pattern/replacement/` (substitute), `g/pattern/s//replacement/` (global substitute).
  • File Interaction: `w` (write/save the file), `q` (quit the editor).

Advantages:
  • Lightweight and Fast: Runs on minimal resources.
  • Suitable for Scripting: Its command-based nature makes it ideal for batch processing.
  • Minimal User Interface: Fast for experienced users who know the commands.

Disadvantages:
  • Not User-Friendly: Can be difficult for beginners used to GUI editors.
  • Limited Visibility: Doesn't show the whole file at once, making navigation difficult in large files.
  • Not Suitable for Complex Tasks: Complicated editing operations can be cumbersome.

In this Chapter

The `ed` Line Editor in Linux
Distributed System in Operating System
Real-Time System in Operating System
System Calls in Operating System
System Programs in Operating System
Structure of an Operating System
Layered Design of an Operating System Structure
UNIX in Operating System
Virtual Machine in Operating System
Kernel-Based Operating System
Process Concept in Operating System
Interacting Processes in Operating System
Threads in Operating System
Fundamentals of Scheduling in Operating System
Scheduling Criteria in Operating System
Long, Medium, and Short-Term Scheduling
Scheduling Algorithms in Operating System
Structure of a Concurrent System
Critical Region in Operating System
Critical Section in Operating System
Inter-process Communication (IPC) in Operating System
Monitors in Operating System
Semaphores in Operating System
Semaphore Implementation & Uses in Operating System
Logical and Physical Address in Operating System
Swapping in Operating System
Contiguous Allocation in Operating System
Segmentation in Operating System
Paging in Operating System
Virtual Memory using Segmentation in Operating System
Interprocess Communication Protocol in Operating System
Network Operating System
Design Issues in Distributed File System
Network Structure in Operating System
Structure of a Distributed System
File System and Coordination in Operating System
History of Linux in Operating System
Linux Commands
Programmer Interface & File Manipulation in Linux
Process Control in Linux
Kernel & Signals in Linux
File System in Linux
Blocks and Inodes in Linux
System Editors in Linux
Character Transliteration in Linux
The `vi` Editor and Its Commands
Shell Scripting in Linux
Looping & Decision Making in Linux Shell Scripting
Variables & File Name Expansion in Linux
Arrays in Linux Shell Scripting
Subprograms (Functions) in Linux Shell Scripting
C Interface with Linux
Simple Shell Programs in Linux
BCA Part-1 | Operating Systems | Semester-I | MDSU Exam Paper 2023 (Held in 2024)
What is an Operating System (OS)
Operating System (OS) All Important Questions and Answers in English (MDSU)
BCA || Operating System 2025 Paper || MDSU Exam Paper
BCA | OS(Operating System) 2023 Paper | MDSU Exam Paper
Types of Operating Systems
Goals of an Operating System
Operations of an Operating System
Resource Allocation & Functions in an Operating System
Classes of Operating System
Batch Processing in Operating System
Multiprocessing in Operating System
Time-Sharing in Operating System