Ex (text editor) explained

ex
Author:Bill Joy
Released: (as part of 1BSD)
Programming Language:C
Operating System:Unix
Platform:Cross-platform
Genre:Text editor

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

History

The original Unix editor ed was distributed with the Bell Labs versions of the operating system in the 1970s. George Coulouris of Queen Mary College, London, which had installed Unix in 1973, developed an improved version called em in 1975 that could take advantage of video terminals.[5] 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[6] 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

The core ex commands which relate to search and replace are essential to vi. For instance, the ex command replaces every instance of with, 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).

Command-line invocation

Synopsis

ex [-rR] [-s|-v] [-c ''command''] [-t ''tagstring''] [-w ''size''] [''file''...]

Options

-r : recover specified files after a system crash
  • -R : sets readonly
  • -s : (XPG4 only) suppresses user-interactive feedback
  • -v : invoke visual mode (vi)
  • -c command : Execute command on first buffer loaded from file. May be used up to ten times.
  • -t tagstring : Edit the file containing the specified tag
  • -w size : Set window size
  • - : (obsolete) suppresses user-interactive feedback
  • -l : Enable lisp editor mode
  • -x : Use encryption when writing files
  • -C : encryption option
  • file : The name(s) of the file(s) to be edited
  • See also

    Notes and References

    1. https://github.com/mhinz/vi-editor-history#ex vi editor history:ex
    2. Web site: A Brief History of Vim:1976 . 2021-06-05 . 2021-06-05 . https://web.archive.org/web/20210605192840/https://buildingvts.com/a-brief-history-of-vim-1476ec4a6eb8#694e . dead .
    3. http://ex-vi.sourceforge.net/ex.html ex manual page
    4. William N. Joy, Ex reference manual, November, 1977
    5. http://www.coulouris.net/cs_history/em_story/ George Coulouris: Bits of History
    6. Book: Salus, Peter H. . Peter H. Salus . The Daemon, the Gnu and the Penguin . . 2005.