Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We have a shell/tty based application that has ~1,000 users. It is running in an environment where X Server is not available. If a user accidently turns on the Scroll Lock, it makes it seem as if the application is frozen because it quits responding to keyboard input. Is there a way to disable the Scroll Lock or remap it to something less intrusive for this use-case?

share|improve this question
You could try fixing the application so it doesn't freeze up when they hit scroll lock... – Paul Tomblin Dec 19 '11 at 17:51
@Paul Tobmlin: It's a third party app. The "freezing" is really just a perception by the user. In reality, it's just waiting for keyboard input, which isn't getting through because the Scroll Lock is on. – poke Dec 19 '11 at 21:20
In other words, they haven't masked out the key modifiers when Scroll Lock is on. That used to be a big problem with X programs - they've wait for a particular key and it wouldn't work if the Caps Lock or Scroll Lock key modifier was present. I've never heard of it happening in a shell/curses app before, but stranger things have happened. – Paul Tomblin Dec 19 '11 at 21:50
@Paul: Scroll Lock tends to trigger software flow control on the console. – Ignacio Vazquez-Abrams Dec 19 '11 at 22:33
You mean like control-S/control-Q? – Paul Tomblin Dec 19 '11 at 22:48
up vote 3 down vote accepted

For a GUI env:

Type xev on the CLI, then click on the Scroll Lock key to see what its keycode is.

Then use xmodmap -e 'keycode <value>=<action>'

Where the value is the keycode number you get from the xev command.

If you want to desable the Scroll Lock, you should leave the <action> as blank. or you can map the <action> to another keycode.

For example, on my Asus EEE 1005P, the Scroll Lock key is map to keycode 78 so i would issue xmodmap -e 'keycode 78=' to disable it.

For a non GUI env:

setkeycodes scancode keycode you get the scancode with the showkey command. And then you need to use loadkeys. And here you can find a guide.

I am don't have any experience with a non GUI env, hence i gave you the links and the general way on how to do it.

share|improve this answer
The application is running in a pure console environment. Will this work if X Server is not running? – poke Dec 19 '11 at 21:17
I am think the xev program is a GUI app, since it opens a small window in my system. But you always can go with the same keybord and the same OS (just with GUI support), and check what the keycode is. – Hanan N. Dec 19 '11 at 21:36
xev is an X windows app. If X isn't running, it won't help you. – Paul Tomblin Dec 19 '11 at 21:48
@poke: I have updated my answer to include a non X env, although i am don't have any experience with it. And i would suggest that you edit your question to explicitly include that you aren't looking for a non X solution, since it doesn't help to understand that from the tty part. – Hanan N. Dec 19 '11 at 21:52
@Hanan H: Thanks. Edited answer. – poke Dec 19 '11 at 22:20

Disable XON/XOFF (^Q/^S) handling by the tty:

stty stop undef
stty start undef
share|improve this answer
Personally I prefer stty -ixon -ixoff. – Endre Szabo Jan 30 '13 at 22:52

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.