EX(1) General Commands Manual EX(1)
ex, edit, e - line editor
ex [ - ] [ -lLrRsvVxC ] [ -t tag ] [ +c command | -c command ] file-
edit [ options ]
ex, a line editor, is the root of a family of editors that includes
edit, ex(1), and vi(1) (the display editor). In most cases vi is pre-
ferred for interactive use.
- | -s Suppress all interactive feedback to the user (useful for
processing ex scripts in shell files).
-l Set up for editing LISP programs.
-L List the names of all files saved as the result of an editor
or system crash.
-r Recover the indicated filenames after a system crash.
-R Read only. Do not overwrite the original file.
-v Start up in display editing state using vi. You can achieve
the same effect by simply typing the vi command itself.
-V Verbose. Any non-tty input will be echoed on standard error.
This may be useful when processing editor commands within
-x Prompt for a key to be used in encrypting the file being
edited. When used in conjunction with a pre-existing file,
ex will make an educated guess to determine whether or not
the input text file is already encrypted.
-C Encryption option; the same as the -x option, except that all
input text is assumed to have already been encrypted. This
guarantees decryption in the cases where the -x option incor-
rectly determines that the input file is not already
encrypted (this is extremely rare, and will only occur in
conjunction with the use of files containing non-ASCII text).
-t tag Edit the file containing the tag tag. A tags database must
first be created using the ctags(1) command.
Start the editing session by executing command.
The editor recognizes the environment variable EXINIT as a command (or
list of commands separated by | characters) to run when it starts up.
If this variable is undefined, the editor checks for startup commands
in the file $HOME/.exrc file, which you must own. However, if there is
a .exrc owned by you in the current directory, the editor takes its
startup commands from this file -- overriding both the file in your
home directory and the environment variable.
The environment variables LC_CTYPE, LANG, and LC_default control the
character classification throughout ex. On entry to ex, these environ-
ment variables are checked in the following order: LC_CTYPE, LANG, and
LC_default. When a valid value is found, remaining environment vari-
ables for character classification are ignored. For example, a new
setting for LANG does not override the current valid character classi-
fication rules of LC_CTYPE. When none of the values is valid, the
shell character classification defaults to the POSIX.1 "C" locale.
/etc/termcap describes capabilities of terminals
.exrc editor startup file for current directory
$HOME/.exrc user's editor startup file if ./.exrc is not found
/tmp/Exnnnnn editor temporary file
/tmp/Rxnnnnn file named buffer temporary
/var/preserve preservation directory
awk(1), ctags(1), ed(1), grep(1V), sed(1V), vi(1), locale(5), term-
cap(5), environ(5V), iso_8859_1(7)
The z command prints a number of logical rather than physical lines.
More than a screen full of output may result if long lines are present.
File input/output errors do not print a name if the command line `-'
option is used.
There is no easy way to do a single scan ignoring case.
The editor does not warn if text is placed in named buffers and not
used before exiting the editor.
Null characters are discarded in input files, and cannot appear in
With the modeline option in effect, the editor checks the first five
lines of the text file for commands of the form
if any are found, the editor executes them. This can result in unex-
pected behavior, and is not recommended in any case. In earlier
releases, modeline was in effect by default. Now it is not, but set-
ting it in the .exrc file or the EXINIT environment variable can still
produce untoward effects.
The encryption facilities of ex are not available on software shipped
outside the U.S.
18 December 1989 EX(1)