Linux控制台操纵function

有这些WinAPIfunction的Linux控制台(/terminal)等价物:

GetConsoleScreenBufferInfo // for getting cursor position SetConsoleCursorPosition // for setting cursor position SetConsoleWindowInfo // for resizing console window or hiding cursor ReadConsoleOutputCharacter // for reading the character at some position ReadConsoleOutputAttribute // for reading color info of the character at some position WriteConsoleOutputAttribute // for changing color info of the character at some position 

你可以尝试使用NCurses

获取光标位置

 ~$ echo -e "\033[6n" 

调整控制台窗口的大小

 wmctrl -r "Mozilla Firefox" -e <G>,<X>,<Y>,<W>,<H>