I am doing a console progress program in Java which periodically erases old messages and prints new ones. The problem is when the program is run with PuTTy terminal (on Solaris for example) it doesn't erase the old messages so it floods the screen with text. The very problem comes from the erasing since I use backspaces - the backspace character (\b) and PuTTy is set to use different character value for backspace. This could be resolved by changing the configuration setting of PuTTy by changing the Keyboard/Backspace key option - Control-? to Control-H.
I need to know if there is any other reserved character or way for erasing characters in the console, or any way to detect programmatically what the current setting of PuTTy is so the user is not urged to check and change the configuration settings of PuTTy.
I would appreciate any advise or suggestion.
Two very important words: "curses" and "termcaps".
Termcaps is the Terminal Capabilities definition. It provides an abstraction between the user's console hardware and generic screen-mode graphical capabilities so that you don't have to code hardware dependencies into your shell scripts. Actually, I think termcaps has been superseded by a newer system, but if you search for termcaps (or display the man/info page), you'll at least be headed in the right direction.
Curses provides the ability to do text-mode cursor control while remaining hardware independent. Among the facilities that use it are the bash script output commands that do x-y positioning onscreen and the text gui dialog controls.
Every interactive terminal logged into a Linux or Unix server should carry a terminal type definition, which is how the system knows to translate the portable graphics codes to hardware-specific actions such as erase-to-end-of-line. Probably the most popular one is Dec VT-100 emulation. I think there's an option in PuTTy to set that.
An IDE is no substitute for an Intelligent Developer.