ex (text editor)

From Wikipedia, the free encyclopedia
  (Redirected from Ex (editor))
Jump to: navigation, search
Original author(s) Bill Joy
Initial release March 9, 1978; 37 years ago (1978-03-09) (as part of 1BSD)
Written in C
Operating system Unix
Type Text editor

ex, short for EXtended, is a line editor for Unix systems originally written by Bill Joy[1] in 1976, beginning with an earlier program written by Charles Haley.[2] Multiple implementations of the program exist; they are standardized by POSIX.[3]


The original Unix editor, distributed with the Bell Labs versions of the operating system in the 1970s, was the rather user-unfriendly ed. George Coulouris of Queen Mary College, London, which had installed Unix in 1973, developed an improved version called em that could take advantage of video terminals. While visiting Berkeley, Coulouris presented his program to Bill Joy, who modified it to be less demanding on the processor; Joy's version became ex[4] and got included in the Berkeley Software Distribution.

ex was eventually given a full-screen visual interface (adding to its command line oriented operation), thereby becoming the vi text editor. In recent times, ex is implemented as a personality of the vi program; most variants of vi still have an "ex mode", which is invoked using the command ex, or from within vi for one command by typing the : (colon) character. Although there is overlap between ex and vi functionality, some things can only be done with ex commands, so it remains useful when using vi.

Relation to vi[edit]

The core ex commands which relate to search and replace are essential to vi. For instance, the ex command :%s/XXX/YYY/g replaces every instance of XXX with YYY, and works in vi too. The % means every line in the file. The 'g' stands for global and means replace every instance on every line (if it was not specified, then only the first instance on each line would be replaced).


ex recognises the following switches:

  • - (obsolete) suppresses user-interactive feedback
  • -s (XPG4 only) suppresses user-interactive feedback
  • -l sets lisp editor option
  • -r recover specified files after a system crash
  • -R sets readonly
  • -t tag Edit the file containing the specified tag
  • -v invoke visual mode (vi)
  • -w set window size n
  • -x set encryption mode
  • -C encryption option
  • file specifies file to be edited

See also[edit]

External links[edit]


  1. ^ ex manual page
  2. ^ William N. Joy, Ex reference manual, November, 1977
  3. ^ ex – Commands & Utilities Reference, The Single UNIX® Specification, Issue 7 from The Open Group
  4. ^ Salus, Peter H. (2005). The Daemon, the Gnu and the Penguin. Groklaw.