Your company here — click to reach over 10,000 unique daily visitors

ed - Man Page

line-oriented text editor

Examples (TL;DR)


ed [options] [[+line] file]


GNU ed is a line-oriented text editor. It is used to create, display, modify and otherwise manipulate text files, both interactively and via shell scripts. A restricted version of ed, red, can only edit files in the current directory and cannot execute shell commands. Ed is the 'standard' text editor in the sense that it is the original editor for Unix, and thus widely available. For most purposes, however, it is superseded by full-screen editors such as GNU Emacs or GNU Moe.

The file name may be preceded by '+line', '+/RE', or '+?RE' to set the current line to the line number specified or to the first or last line matching the regular expression 'RE'.


-h,  --help

display this help and exit

-V,  --version

output version information and exit

-E,  --extended-regexp

use extended regular expressions

-G,  --traditional

run in compatibility mode

-l,  --loose-exit-status

exit with 0 status even if a command fails

-p,  --prompt=STRING

use STRING as an interactive prompt

-q,  --quiet,  --silent

suppress diagnostics written to stderr

-r,  --restricted

run in restricted mode

-s,  --script

suppress byte counts and '!' prompt

-v,  --verbose

be verbose; equivalent to the 'H' command


strip carriage returns at end of text lines


allow control characters 1-31 in file names

Start edit by reading in 'file' if given. If 'file' begins with a '!', read output of shell command.

Exit status: 0 for a normal exit, 1 for environmental problems (invalid command-line options, memory exhausted, command failed, etc), 2 for problems with the input file (file not found, buffer modified, I/O errors), 3 for an internal consistency error (e.g., bug) which caused ed to panic.

Reporting Bugs

Report bugs to bug-ed@gnu.org
Ed home page: http://www.gnu.org/software/ed/ed.html
General help using GNU software: http://www.gnu.org/gethelp

See Also

The full documentation for ed is maintained as a Texinfo manual.  If the info and ed programs are properly installed at your site, the command

info ed

should give you access to the complete manual.

Referenced By

alternatives(8), bfs(1), bmake(1), cdist-type__sensible_editor(7), dash(1), glimpse(1), glimpseindex(1), ksh93(1), mc(1), med(1), mksh(1), oksh(1), opax(1), patch(1), pick(1), rc(1), rdist(1), regex(7), sc(1), sed(1), spax(1), star(1), tcsh(1).

The man page red(1) is an alias of ed(1).

April 2024 GNU ed 1.20.2