In the world of Free Software, ex is short for EXtended. It was an advanced version of the ed text editor. Eventually, ex was given a Visual Interface, and thus was created the editor vi. Most versions of vi still have an "ex mode", and this mode can be accessed on most UNIX-like systems using the command "ex". It is used on terminals where you can only view, review, or edit one line at a time. This is called "line editing".
In social relatioships, an ex is someone with whom a person was once associated with. When used as a prefix, ex-, it is used for a variety of different relationships; for example, a member of a musical group might refer to their ex-guitarist. Without the suffix, ex is assumed to refer to an ex-partner or ex-lover.