Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which signal does ctrl-x send when used in a terminal?

On Linux/Unix there are signals. The CtrlC one (SIGINT) is obvious to me. Now, in some other applications there are signals via CtrlX?! Is that even a signal or does it generate an escape sequence? Is there anything else I can use as something similar to CtrlC ( CtrlV, CtrlX ...)?

If anyone has a clue, im familiar with C more than bash, but answers in both languages are appreciated!

like image 862
imacake Avatar asked Jul 20 '11 15:07

imacake


People also ask

What does Ctrl X do in terminal?

Ctrl x Ctrl x : Alternates the cursor with its old position. (C-x, because x has a crossing shape). One additional usage of Ctrl x is to expand the * when typing a command in the shell.

What kind of signal does Ctrl-C send?

While in a command line such as MS-DOS, Linux, and Unix, Ctrl + C is used to send a SIGINT signal, which cancels or terminates the currently-running program. For example, if a script or program is frozen or stuck in an infinite loop, pressing Ctrl + C cancels that command and returns you to the command line.


2 Answers

To get all the terminal control character assignments:

stty -a 
like image 173
jfg956 Avatar answered Sep 17 '22 05:09

jfg956


There is possibly a misunderstanding. CtrlC does not generate a signal. It is perfectly possible to press CtrlC anywhere, and no bad things will happen (for example in every text editor or word processor, that's the de-facto-standard for "copy").

However, when you run a program in the shell, then your keypresses really go into the shell, not into your program. The shell will forward (almost) everything to your program's stdin, and forward anything coming from stdout to either the terminal or another process or a file (if you used a pipe or redirection).

If the shell sees you press CtrlC, then the shell sends the interrupt signal. But that's really just something the shell does, not something that magically happens because of the key combination.

About CtrlX, you probably meant CtrlZ. This stops a process, and the shell outputs a number which you can use with fg to make it run again.

like image 26
Damon Avatar answered Sep 21 '22 05:09

Damon