Re: stty issue

Go to solution
Super Advisor

stty issue

Hi Gurus,

We have a problem with a certain user on one of our systems with when they type the "@" symbol, it deletes all of the line that they were typing on the command line.

I checked stty -a as this user and see that the following as the probably cause:


This is obviously undesirable and i'm not sure how I go about removing this after looking through the Man Pages. Can anyone assist?
Trusted Contributor

Re: stty issue

not too familiar with all the functions of stty but here is what I found in the man pages which might help??

The command:

stty kill '^X' intr '^C'
sets the delete-line character to ^X (Ctrl-X) and the interrupt
character to ^C. This command is usually found in the .login or
.profile file so that ^X and ^C need not be set by the user at each
login session.

The command:

stty kill '^X' intr '^C' werase '^W'
sets the default values for the delete-line character to ^X (Ctrl-X),
the interrupt character to ^C, and the word erase character to ^W.
Any terminal port opened after this command is issued will see these
new default values for the kill, intr, and werase control characters.
Peter Godron
Honored Contributor

Re: stty issue

you can set the stty behaviour at login by editing the /etc/profile file and adding
lawrenzo information.
Or customise each user in their startup scripts (depending on their shell
.profile ,.cshrc...)

Just be aware that not all users may use the same terminal type.

T G Manikandan
Honored Contributor

Re: stty issue

$stty kill ^U

Also check the profile of this user incase you require this persistent.
Bharat Katkar
Honored Contributor

Re: stty issue


$ stty kill ^U

Should solve your problem. Remeber while ^U is combination of CNTRL key and U key.

Also if you want to set it up for all users better to put it in /etc/profile otherwise you can use individuals .profile file.

You need to know a lot to actually know how little you know
Super Advisor

Re: stty issue

Thanks everyone,

Your ideas of putting this fix into the /etc/profile fixed my issues.

Dani Seely
Valued Contributor

Re: stty issue

Hey Ken,
Define the delete line character to Ctrl-X by doing the following:
# stty kill ^X

Also, if that doesn't work, try:
# stty sane

The second one should definitely do it.
Together We Stand!
Dani Seely
Valued Contributor

Re: stty issue

Sorry, that should fix your immediate problem ... the second problem is preventing this from happening again ...

You should define the delete-line character for all of your users, individually, or better yet, put it in the startup files (edit the profile or login, depending on the shells your users use). The second is a better way to start, as new users added to the system will not have to have their user startup files changed, however, if they define it in their own startup file it will override the system startup file.

That said, if you have problems after setting this in the system startup file then you will know something got changed with the users startup file.

Hope this helps. Good luck, ther's no telling what those crazy users will do!
Together We Stand!
Super Advisor

Re: stty issue

With the backspace key, I've noticed that a lot depends on which shell you are running AND the program you are using (eg telnet vs putty).

ie backspace key for a user works from putty, but not from telnet?

Also, the shell makes a difference. For example, the root user runs the posix shell, but ordinary users use the korn shell. it seems the posix shell handles backspaces better than the korn shell does. Why is this? Is there a way to fix the korn shell so that it maps the backspace key properly (so I don't have to change the default shell for all our users to posix shell)?

for example, if I use the korn shell and telnet from windows, the backspace key doesn't work. But if I change the shell to posix, then the backspace key works.

If I use putty for ssh, then the backspace key works with either shell though?

Is there a way to get the backspace key working no matter what terminal program you are using (telnet vs putty vs rlogin)?


- Andy
Bill Hassell
Honored Contributor

Re: stty issue

The backspace key is defined first by the terminal and then stty defines it's effect. Why is the terminal important? Because there are HUNDREDS of terminals, each one with potentially difference behavior. To see how many terminals are defined in HP/UX, try this:

ls /usr/lib/terminfo/*

It is quite common for some emulators to default to sending the DEL character when you press the backspace key. Putty, like Hypertermianl, Reflection for HP, QCterm and dozens of termnnal emulators, define what to do with special keys. While you might assume that the backspace key on your terminal or your PC will send the ASCII code 0x08, many emulators default to the Tru64/DEC standard of DEL which is code 0x7f and will sometimes be displayed as ^? via the shell.

While many Unix users assume that all terminals are VT100, this is far from the case and a PC is not a terminal!! A PC can be used as a terminal by running a special program which may or may not be a true vt100 emulation. To understand what a 'real' vt100 looks like, visit:

SO take a look at your ssh and Putty client setup to see how to configure special keys like backspace. Once HP-UX sees the backspace character, then the stty setting will work.

Bill Hassell, sysadmin