Linux and Unix ex command

Quick links

About ex
Related commands
Linux and Unix main page

About ex

ex is a text editor, and the line-editor mode of vi.


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


-, -s Suppress all interactive user feedback. This is useful when processing editor scripts.
-l Set up for editing LISP programs.
-L List the name of all files saved as the result of an editor or system crash.
-R Readonly mode; the readonly flag is set, preventing accidental overwriting of the file.
-r file Edit file after an editor or system crash. (Recovers the version of file that was in the buffer when the crash occurred.)
-t tag Edit the file containing the tag and position the editor at its definition.
-v Start up in display editing state using vi. You can achieve the same effect by typing the vi command itself.
-V Verbose. 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.
-x Encryption 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.
-wn Set the default window size to n. This is useful when using the editor over a slow speed line.
-C Encryption 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 command Begin editing by executing the specified editor command (usually a search or positioning command).
file The name of a file to be edited.


ex myfile.txt

Edits the file myfile.txt.

Related commands

ed — A simple text editor.
edit — A text editor.
grep — Filter text which matches a regular expression.
sed — A utility for filtering and transforming text.
sort — Sort the lines in a text file.
vi — Text editor based on the visual mode of ex.
vim — An advanced version of vi.