Linux – change bash shortcut keys such as Ctrl-C


I am using Kubuntu 10.04. I would like to change some of the standard shortcut keys for bash (terminal).

Here are the shortcuts I would like to set up:

  • CtrlC to copy the selected text in
    the terminal to the clipboard.

  • CtrlV to paste from the clipboard
    into the terminal.

  • CtrlZ to undo the editing on the current line in the terminal.

  • CtrlShiftC (or even better, SuperC) to terminate the command.

  • CtrlShiftZ (or SuperZ) to be the background command.

  • CtrlShiftV (or SuperV) to be the literal insert command (or whatever Ctrlz did before).

How do I make these changes?

BTW, I like the way the terminal works on OS X. The use of the command key makes all the copy/paste commands very consistent (unlike many other things in OS X).

P.S. I read the bash man page and it didn't help. It gave me ideas, but I need specific examples for the above combinations. Thanks.

Best Answer

Those aren't features of bash, they're features of the terminal driver. As such, they're specified by stty(1).

$ stty -a
speed 38400 baud; rows 24; columns 80; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = M-^?; eol2 = M-^?;
swtch = M-^?; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W;
lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 hupcl -cstopb cread -clocal -crtscts
-ignbrk brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff
-iuclc ixany imaxbel iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt
echoctl echoke