ex, edit -- invoke a text editor


ex [ -lLrR ] [ -C | -x ] [ -s | -v ] [ -c command ] [ +command ] [ -t tag ]
[ -w size ] [ file ... ]

edit [ -lLrR ] [ -C | -x ] [ -s | -v ] [ -c command ] [ +command ] [ -t tag ]
[ -w size ] [ file ... ]


The ex text editor is a superset of ed(C), with the most notable extension being a display editing facility. Display-based editing is the focus of the vi(C) family of editors. The commands ex, edit, vi, view, and vedit are all links to the same executable file.

ex takes the following options:

-c command
Execute the specified command at start up. Individual commands can be separated by vertical bar characters ``|''.

Equivalent to the -x option except that ex assumes files are encrypted.

Sets the showmatch and lisp options when editing LISP source files.

Lists the names of all files that may be recovered after an editor or system crash. Use the -r option to recover the files.

Recovers the last saved version of the named files after an editor or system crash.

Sets read-only mode; the files may be viewed but not altered.

Selects batch mode; suppresses prompts and some other messages, ignores the setting of the environment variables EXINIT and TERM, and overlooks the presence of any .exrc file. (See the section ``Environment variables''.)

-t tag
Edits the file containing the tag string and positions the editor at its definition; equivalent to an initial :t tag command. For a description of tags see ctags(C).

Invokes the vi visual editor.

-w size
Sets the default window size. This is useful for dialup sessions when a small window may be used.

Encrypt the file as it is being written. The file will require a corresponding key to be read. See crypt(C) for information about encryption.

edit is a variant of ex recommended for new or casual users who wish to use a command-oriented editor. It operates precisely as ex with the following options automatically set:




These options can be turned on or off using the set command.

Refer to the vi(C) manual page for a complete description of ex commands.

Environment variables

Sets a new horizontal screen size.

Defines a list of startup ex commands for the vi family of editors. If EXINIT is not set, commands in the file $HOME/.exrc (if present) are run. If this file or EXINIT sets the editor option exrc, commands in a .exrc file in the current directory will be run as well. An .exrc file will not be read unless you own it.

Sets a new vertical screen size.

Exit values

ex returns the following values:

successful completion

an error occurred


error messages

recover command

preserve command

describes capabilities of terminals

editor startup file

editor temporary

named buffer temporary

preservation directory

See also

awk(C), ctags(C), ed(C), grep(C), infocmp(ADM), regexp(M), sed(C), terminfo(F), terminfo(M), tic(C), vi(C)

Standards conformance

ex is conformant with:

ISO/IEC DIS 9945-2:1992, Information technology - Portable Operating System Interface (POSIX) - Part 2: Shell and Utilities (IEEE Std 1003.2-1992);
AT&T SVID Issue 2;
X/Open CAE Specification, Commands and Utilities, Issue 4, 1992. ex was developed at the University of California at Berkeley and is used with permission.

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003