Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Linux Console Mess Up after Unix Session 2

Status
Not open for further replies.

Tranbo

IS-IT--Management
Apr 14, 2010
75
US
After every SSH session to my Unix Server my ubuntu console key got crazy specially the Delete key it become .~ any no longer work as delete key.

I have to reboot to get the console back.

How do I reset the console key mapping after exit the Unix session without rebooting?
 
Which value of TERM are you using in the SCO session ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
my TERM is linux

Default console in linux no X server. I'm using ubuntu 11.10
 
And you have a properly defined linux terminfo entry in the SCO box ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Yes, I got the terminfo and termcap + profile hack from Brian White update on the Unix Server. All working nicely. Just the glitch with the console after log off.
 
Does stty sane restore it to normal? How about reset?

Annihilannic
[small]tgmlify - code syntax highlighting for your tek-tips posts[/small]
 
Excellent!

stty sane and reset worked!!!!! :)

Thank You for your help.
 
how do I put this to the command scripts so after the session it will reset the terminal back without user intervention?

ssh user@myunixserver

reset


that didn't work as intended.
 
You could define a function wrapper for the ssh command in your .bash_profile or similar, e.g.

Code:
function ssh
{
    /usr/bin/ssh "$@"
    reset
}

However you may want to call it something else and only use it for that particular host, rather than all ssh commands?

Annihilannic
[small]tgmlify - code syntax highlighting for your tek-tips posts[/small]
 
You're freaking genius!

Thanks a lot..it work
 
One minor problem my apps is hard code with CTRL H to back space & erase previous character.

I have eliminate remapping in the profile because the software is not looking there. It is getting the info from terminfo

I need to map the BS to CTRL H ---because in side the apps I can hit the CTRL H and it is working as intended.

I try serveral way but could not producing the "^H" when hit backspace key from the console.

Here is the changed to my terminfo and compile

kbs=\177 --- default
kbs=^H -- infocmp show kbs=\b










 
When you say "remapping in the profile" do you mean changing the stty erase setting?

In any case, you should be able to use stty erase ^v<bksp> (that is Control-V, backspace key) to make the console use whatever key code your backspace key is now sending.

Annihilannic
[small]tgmlify - code syntax highlighting for your tek-tips posts[/small]
 
my backspace key look like this ^? I tried that in the profile didnt work.

try that in the terminfo didnt work either

what it the code for CTRL H if I want map that in my terminfo?
 
^? is common. You should still be able to use that in your profile by entering it using the Control-V, BkSp combination I mentioned earlier (assuming you are editing your .profile in vi).

Annihilannic
[small]tgmlify - code syntax highlighting for your tek-tips posts[/small]
 
My apps is configured for vt100 so it is only understood the esc key

below:

Editing Functions
Name Mnemonic Sequence
Delete character DCH ESC [ Pn P
Insert line IL ESC [ Pn L
Delete line DL ESC [ Pn M


how do I set the backspace to do

Delete character DCH ESC [ Pn P


 
here is the configuration.

/* CTRL-S= /* LEFT ARROW - same as CURSOR-LEFT above.
/* CTRL-D= /* RIGHT ARROW - same as CURSOR-RIGHT above.

CTRL-A=CTRL P /* CTRL/P - FIRST CHARACTER OF PREVIOUS WORD.
CTRL-F=CTRL C /* CTRL/C - FIRST CHARACTER OF NEXT WORD.

CTRL-J=CTRL R /* CTRL/R - Move to end of line.
CTRL-R=CTRL U /* CTRL/U - Move to top of screen.
CTRL-V=CTRL V /* CTRL/V - Move to bottom of screen.

CTRL-H=CTRL H /* Backspace - Delete previous character.
/* CTRL-C= /* PAGE DOWN - same as SHIFT/F16 above.
/* CTRL-G= /* Delete character under cursor - same as
DEL-Char above.

CTRL-Y=CTRL Y /* CTRL/Y - Del current line.
CTRL-P=CTRL W /* CTRL/W - Del previous word on current line.
CTRL-N=CTRL D /* CTRL/D - Del next word on current line.
CTRL-T=CTRL T /* CTRL/T - Erase to end of current line.
CTRL-L=ESC [ L /* SHIFT/F4 - Mark line for copy.
 
Have you tried "CTRL-?=CTRL-H" or "CTRL-H=CTRL-?" in your configuration? I'm not sure which way around the remapping is supposed to work.

I don't think you want to change the "ESC [ Pn P" because it looks like it is a display function rather than an input function; i.e. it tells the application what screen control codes to send to delete a character rather than what codes to expect from the keyboard.

Annihilannic
[small]tgmlify - code syntax highlighting for your tek-tips posts[/small]
 
Yes I tried both option. The left side is what the software is looking for. Right side is the remap.

In all, I'm @ 99% in achieving my goal. My user will need to hit CTRL + H for delete when using the terminal.

Thank-You all for helping and sharing your knowledge enable me to make it possible.



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top