/e]0;string/a 把窗口和圖標的標題設爲string
/e]1;string/a 把圖標的標題設爲string
/e]2;string/a 把窗口的標題設爲string
注意上述三中情況都是用右方括號,而下面用左方括號
/e[r;cf 把光標移到r行c列的位置
/e[r;cH 同上
/e[nA 把光標向上移動n行
/e[nB 把光標向下移動n行
/e[nC 把光標向前移動n行
/e[nD 把光標向後移動n行
/e[s 保存當前的光標位置
/e[u 恢復已保存的光標位置
/e[2J 清除所有內容,光標置於屏幕左上角
/e[K 清除當前光標直到行尾的所有內容,包括光標下字符
/e[sh 設置終端的模式
/e[sl 恢復終端的模式到以前的狀態(和設置時使用同樣的參數)
/e[code;string;p 重新定義鍵盤上按鍵序列(code是按鍵的掃描碼,string是標誌該字符的新序列)
/e[n;n;...nm 設置以後的顯示模式,包括文本模式和前景色,背景色
文本的模式有下面幾種:
0 取消所有屬性
1 粗體
4 下劃線
5 閃爍
7 反色
8 隱藏
顏色代碼爲(顏色代碼前加3表示前景色,加4表示背景色):
0 黑色
1 紅色
2 綠色
3 黃色
4 藍色
5 紫紅色
6 蘭綠色
7 白色
終端模式s的含義如下
0 40 x 148 x 25 monochrome (text)
1 40 x 148 x 25 color (text)
2 80 x 148 x 25 monochrome (text)
3 80 x 148 x 25 color (text)
4 320 x 148 x 200 4-color (graphics)
5 320 x 148 x 200 monochrome (graphics)
6 640 x 148 x 200 monochrome (graphics)
7 Enables line wrapping
13 320 x 148 x 200 color (graphics)
14 640 x 148 x 200 color (16-color graphics)
15 640 x 148 x 350 monochrome (2-color graphics)
16 640 x 148 x 350 color (16-color graphics)
17 640 x 148 x 480 monochrome (2-color graphics)
18 640 x 148 x 480 color (16-color graphics)
19 320 x 148 x 200 color (256-color graphics)
這些特殊含義的字符串可以用來控制終端的顯示,例如可以生成一些窗口和菜單等。linux下面的curses等庫就是通過這個原理實現的。他們也用於設置termcap或者terminfo。我寫的那個Python遊戲和字符終端下的進度條就是用這種方法。