Linux / Unix ex command

Quick links

About ex
Syntax
Examples
Related commands
Linux / Unix main page

About ex

Line-editor mode of the vi text editor.

Syntax

ex [ -| -s ] [ -l ] [ -L ] [ -R ] [ -r [file ] ] [ -t tag ] [ -v ] [ -V ] [ -x ] [ -wn ] [ -C] [+command | -c command ] file

- | -sSuppress all interactive user feedback. This is useful when processing editor scripts.
-lSet up for editing LISP programs.
-LList the name of all files saved as the result of an editor or system crash.
-RReadonly mode; the readonly flag is set, preventing accidental overwriting of the file.
-r fileEdit file after an editor or system crash. (Recovers the version of file that was in the buffer when the crash occurred.)
-t tagEdit the file containing the tag and position the editor at its definition.
-vStart up in display editing state using vi . You can achieve the same effect by simply typing the vi command itself.
-VVerbose. When ex commands are read by means of standard input, the input will be echoed to standard error. This may be useful when processing ex commands within shell scripts.
-xEncryption option. Simulates the X command and prompts the user for a key. This key is used to encrypt and decrypt text using the algorithm of the crypt command. The X command makes an educated guess to determine whether text read in is encrypted or not. The temporary buffer file is encrypted also, using a transformed version of the key typed in for the -x option.
-wnSet the default window size to n. This is useful when using the editor over a slow speed line.
-CEncryption option. Same as the -x option, except simulates the C command. The C command is like the X command, except that all text read in is assumed to have been encrypted.
+command | -c commandBegin editing by executing the specified editor command (usually a search or positioning command).
fileA path name of a file to be edited.

Examples

ex myfile.txt - edits the file myfile.txt.

Related commands

ed
edit
grep
sed
sort
vi
vim