Operating System - HP-UX
1820478 Members
2920 Online
109624 Solutions
New Discussion юеВ

ctrl + s caused terminal hangs

 
SOLVED
Go to solution
Ngoh Chean Siung
Super Advisor

ctrl + s caused terminal hangs

Hi,

I accidentally press ctrl + s and the terminal that I login just hangs there. Luckily I able to logout after pressing ctrl + d (I think shld be used to logout).

Q1) What is the action after pressing ctrl + s? How to disable this key combination?

Q2) Where can I get a list of all the key combination functionality?

regards
19 REPLIES 19
Patrick Wallek
Honored Contributor

Re: ctrl + s caused terminal hangs

A CTRL-s will stop information from scrolling. A CTRL-q will continue it.
A. Clay Stephenson
Acclaimed Contributor

Re: ctrl + s caused terminal hangs

You are a victim of XON/XOFF handshaking which is used when hardware handshaking of serial devices is not available. Ctrl-S (13h) is an XOFF; Ctrl-Q (11h) is an XON.

Man ascii for the list of ASCII characters but there is no list as such for what you request. The behavior of a tty device is controlled by the termio data associated with the device. You must do a stty -a to see what the control characters are for your specific device.
If it ain't broke, I can fix that.
Arunvijai_4
Honored Contributor

Re: ctrl + s caused terminal hangs

Hello,

Control KeysControl Key stty Name Function Description
CTRL-C intr

Stop current command
CTRL-D eof

End of input
[CTRL-\] or [CTRL-|] quit

Stop current command, if [CTRL-C] doesn't work
CTRL-S stop

Halt output to screen
CTRL-Q

Restart output to screen
DEL or [CTRL-?] erase

Erase last character
CTRL-U kill

Erase entire command line
CTRL-Z susp

Suspend current command

http://www.unix.org.ua/orelly/unix/ksh/ch01_09.htm

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
A. Clay Stephenson
Acclaimed Contributor

Re: ctrl + s caused terminal hangs

Arunvijai's answers, while the default, would get an incorrect mark if I were giving the test because all of those values can be changed "on the fly". The only way to know is to ask the device node itself either through the stty command or an ioctl() call.
If it ain't broke, I can fix that.
Ngoh Chean Siung
Super Advisor

Re: ctrl + s caused terminal hangs

Hi,

# stty -a
speed 9600 baud; line = 0;
rows = 24; columns = 90
min = 1; time = 0;
intr = ^C; quit = ^\; erase = ^H; kill = ^U
eof = ^D; eol = ^@; eol2 ; swtch
stop = ^S; start = ^Q; susp ; dsusp
werase ; lnext
parenb -parodd cs7 -cstopb hupcl -cread -clocal -loblk -crts
-ignbrk brkint ignpar -parmrk -inpck istrip -inlcr -igncr icrnl -iuclc
ixon -ixany ixoff -imaxbel -rtsxoff -ctsxon -ienqak
isig icanon -iexten -xcase echo echoe echok -echonl -noflsh
-echoctl -echoprt -echoke -flusho -pendin
opost -olcuc onlcr -ocrnl -onocr -onlret -ofill -ofdel -tostop

Q1) How to disable ctrl + s & ctrl + q?
Q2) What is the content after parenb used for?

regards.
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: ctrl + s caused terminal hangs

The answer to these questions is as close as a man stty. stty -ixon disables XON/XOFF flow control. parenb means generate a parity bit before sending a character and expect a parity bit when receiving a character.
If it ain't broke, I can fix that.
Ngoh Chean Siung
Super Advisor

Re: ctrl + s caused terminal hangs

Hi,

How to make it permanent and apply to all the login terminals? Because this setting is only take affect on the current login terminal that you are using.

regards.
Arunvijai_4
Honored Contributor

Re: ctrl + s caused terminal hangs

Hello,

You can add this entry to your .profile at $HOME/.profile. It will executed at the time of your login.

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Muthukumar_5
Honored Contributor

Re: ctrl + s caused terminal hangs

Your questions are all related with stty setting. Refer man page of stty.

To make permanent then configure in $HOME/.profile or /etc/profile.

--
Muthu
Easy to suggest when don't know about the problem!
Ngoh Chean Siung
Super Advisor

Re: ctrl + s caused terminal hangs

Hi,

May I know what is below option used for?

isig (-isig) Enable (disable) the checking of characters
against the special control characters INTR
and QUIT.

regards.
Arunvijai_4
Honored Contributor

Re: ctrl + s caused terminal hangs

Hello,

isig (-isig) Enable (disable) the checking of characters
against the special control characters INTR
and QUIT.

"isig" is part of local mode flags,

Local mode flags (lflags) affect various and sundry characteristics of terminal processing. Historically the term "local" pertained to new job control features implemented by Jim Kulp on a Pdp 11/70 at IIASA. Later the driver ran on the first VAX at Evans Hall, UC Berkeley, where the job control details were greatly modified but the structure definitions and names remained essentially unchanged. The second interpretation of the ├в l├в in lflag is ├в ├в line discipline flag├в ├в which corresponds to the c_lflag of the termios structure.

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Muthukumar_5
Honored Contributor

Re: ctrl + s caused terminal hangs

It is used to check the action against ctr+c and ctr+d. By default it is like,

isig which handles signal.

--
Muthu
Easy to suggest when don't know about the problem!
Arunvijai_4
Honored Contributor

Re: ctrl + s caused terminal hangs

One more link, http://www.tldp.org/HOWTO/Text-Terminal-HOWTO-18.html#local_mode

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Ngoh Chean Siung
Super Advisor

Re: ctrl + s caused terminal hangs

Hi,

At /etc/profile, there is 1 trap signal command to trap below signal.
1 - sighup (terminal line hangup)
2 - sigint (ctrl + c)
3 - sigquit (ctrl + \)

To trap above signal, the syntax is trap 1 2 3. To disable the signal trap, the syntax is trap "" 1 2 3

Question:
1) At /etc/profile, trap signal is disabled at the beginning and it was enabled before last few lines. What is the impact if I hv syntax stty -isig after trap 1 2 3? All the signals (1 2 3) will be disabled same as the syntax trap "" 1 2 3? You may refer to below /etc/profile for more details.

Below is the content for /etc/profile:
# Ignore HUP, INT, QUIT now.

trap "" 1 2 3
.
.
.

# Leave defaults in user environment.

trap 1 2 3
set -u
trap "echo 'logout'" 0
.
.
.
TERMINAL=`tty`

export TERMINAL

# Pause for users to read motd or any other messages
stty -isig
echo "Tap to continue ... \c"
read ans
stty isig
.
.
.

regards.
A. Clay Stephenson
Acclaimed Contributor

Re: ctrl + s caused terminal hangs

You still don't quite understand. There is no way to make these changes permanent because any application can change them (and hopefully restore them to their values
as they were when the application was started.) For example, suppose the you wanted to disable SIGINT (default is Ctrl-C under HP-UX; under other UNIX flavors -- but it could be any key) inside an application. One method would be to use a signal handler or trap that simply ignores SIGINT so that when , for example, Ctrl-C is pressed, it's simply ignored. However, another approach would be to change the interrupt key to an impossible value such as 377 octal.
If it ain't broke, I can fix that.
Ngoh Chean Siung
Super Advisor

Re: ctrl + s caused terminal hangs

Hi,

I understand what you mean.

But I just want to know whether stty -isig is function same as trap "" 123.

regards.
A. Clay Stephenson
Acclaimed Contributor

Re: ctrl + s caused terminal hangs

No, signal 1 = Hangup, signal 2 = Interrupt, and signal 3 = Quit whereas stty -isig means ignore SIGINT,SIGQUIT, and suspends.

If it ain't broke, I can fix that.
Ngoh Chean Siung
Super Advisor

Re: ctrl + s caused terminal hangs

Hi,

Can I say that stty -isig will disable SIGINT and SIGQUIT which is same as the trap signal for signal 2 = Interrupt and signal 3 = Quit?

regards.
A. Clay Stephenson
Acclaimed Contributor

Re: ctrl + s caused terminal hangs

That much is true; however, you are thinking shell scripts and that is only part of the picture. For example, once a process is started, it can still redefine signal handlers and key functions. The signal handlers are always restored to as they were when the child process started BUT there is no guarantee that the key functions are just as they were. Well written programs will always restore the key functions to the original state BUT ...
If it ain't broke, I can fix that.