The escape sequences are different for each terminal type as a general rule. In the past, each terminal brand used (and published) their own set of escape sequences and they were in generla incompatible.
With time, DEC (Digital Equipment Corporation) imposed their set for several reasons:
- Their terminals where the most extended and popular ones (vt100, vt200, vt220, vt420, etc.)
- All their models shared the same specification.
- PDP-11 and later the VAX mainly where sold with these terminals.
For these reasons, the escape sequences of DEC terminals became an standard and slowly all the software adapted to them.
At the same time, some software tools started to use full screen applications, and addressed the problem of using different terminals. This resulted in the unix environments in a library (curses) that allowed the user to have almost any terminal type with addressable cursor and display features to be possible to use with almost any application. Curses was written to support vi(1) but later, it has been successfuly used in many other programs.
Escape sequences became standarized, and the standard (ANSI X3.64 (ISO 6429)) became a de-facto standard in almost any application that was not designed using the curses library. This standard covers just a subset of the full set of escapes that DEC terminals implement (mainly because the sequences to multiplex several sessions in the same terminal is a patented ---and not published--- set of commands, protected by copyright rules).
ECMA has also standarized escape sequences, as answered in another answer to this question.
But, if you actually want to be completely terminal agnostic, you had better to use some curses-like (e.g. ncurses, which is also opensource) library in order to cope with the large database of terminals that have different and incompatible escape sequences. For example, Hewlett Packard terminals have a completely different language for expressing escape codes, and so, escape sequences for HP terminals are completely different than the ones from DEC.
Look at ANSI wikipedia page for a medium to full list of these escapes, and for other links related to documentation of these escapes.