On gnu.org site there is GNU Head that can be display on terminal it have XTerm compatible (Normal documented ANSI Codes) but it also contain TTY version (it work on Cygwin, didn't test in XTerm or real terminal).

It contain text like:


it have \x1b then ]Pf767676 and then normal [1;37m which is documented for instance on wikipedia. What is ]Pf767676 and where it's documented?


For Linux console specifically, there is the console_codes(4) manual page. It lists the sequences inherited from VT102, ECMA-48, DEC, and several private ones.

For example, all sequences starting with ESC [ (shorthand CSI) are documented under "ECMA-48 CSI sequences"; they also work the same way on all terminals (or don't work at all).

On the other hand, ESC ] (shorthand OSC) sequences are private to each terminal, and their documentation in this manpage is scattered in various places; ESC ] P is described as:

       ESC ]     OSC      (Should be: Operating  system  command)  ESC  ]  P
                          nrrggbb:  set  palette,  with parameter given in 7
                          hexadecimal digits after the final P :-(.  Here  n
                          is  the  color  (0-15),  and  rrggbb indicates the
                          red/green/blue values (0-255).   ESC  ]  R:  reset

In other words, the sequence ESC ] P f 767676 makes the 15th color in the pallete to be hexadecimal #767676.

  • So in ]Pf767676[1;37m f (15th) change 46 Cyan background (counting from 30) to #767676 or it set color to pick with that 37? – jcubic Jul 22 '13 at 12:07
  • @jcubic: In the Linux console, you directly deal only with an 8-color palette, 0–7 mapping to codes 3037. The other 8 colors are actually used for "bold" versions of the same codes; i.e. 1 + 30 will select the 8th color instead of 0th. Similarly, 1;37 selects the 15th color. (There exist sequences for a true 16-color palette, but they aren't widely supported, and usually not in terminals that allow modifying the palette at all.) – user1686 Jul 22 '13 at 13:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.