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!
If you need a list of signals available on your system, then
signum.h
can be helpful. Below is from Debian 7.3:The terminal assigns special meaning to certain key sequences. This include deleting a character, deleting to the start of line ( CtrlU ), ...
Specifically, when the terminal
ISIG
local mode is enabled:VINTR
(usually CtrlC) generates aSIGINT
(interrupted by user).VQUIT
(usually Ctrl\) generates aSIGQUIT
(like SIGINT, but also dump core).VSUSP
(usually CtrlZ) generates aSIGTSTP
(stop by terminal I/O).VDSUSP
(on some systems, not on Linux) generates aSIGTSTP
when the program tries to read it.The above are configurable. This is documented on the termios(3) manpage.
To get all the terminal control character assignments:
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.From Wikipedia
One additional usage of Ctrlx is to expand the
*
when typing a command in the shell.Say you have:
Pressing Ctrlx and then * will expand
*
to all items in the current directory to something like this:You can also refer to this topic on SuperUser for the usage I described above.