change bash shortcut keys such as Ctrl-C?

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

This is almost completely solved now. Part of the solution was first brought to my attention by MTK358 over at http://www.linuxquestions.org/questions/linux-software-2/change-bash-shortcut-keys-such-as-ctrl-c-818170/. He pointed out the (rather obvious, much to my embarassment) fact that the copy and paste shortcut keys can easily be changed by the menu settings of konsole. Once I saw this, it took about 1 minute to set up Ctrl-C and Ctrl-V to copy and paste with the terminal.

The other part of the solution should have been clear from the stty man page, but it wasn't (to me). I ended up just experimenting based on various clues, such as those posted above.

I decided which non-numeric key I wanted to replace Ctrl-C as the terminate command. (I used "k"). I never did find any info about how to convey a shift modifier to stty, so I gave up on that. With that decided, all I had to do was enter the following on the command line:

stty intr \^k

I verified that everything worked as desired.

Now I just had to place the single command above (stty intr \^k) in a startup script. I'm not sure which one is the "proper" one. I'd like this change to be system wide and permanent.

Any suggestions as to which script I should place the command in?

And finally, as to the preachy replies, they are unnecessary and unhelpful.


Some of thse can be set using the normal KDE keyboard shortcut mechanism. In Konsole's "Settings" menu, click on "Configure Shortcuts", and you'll get a dialog which you can use to change the key bindings for the functions which are handled by KDE. That will allow you to remap Ctrl+C to copy and Ctrl+V to paste - but keep in mind that once you do that, those key sequences will no longer be passed through to the terminal, so you won't be able to use Ctrl+C to interrupt a program, for example.

Other functions are controlled by the readline library, which you can configure by editing the file ~/.inputrc. To get Ctrl+Z to revert any edits made on the current line, you'd want to add

C-z: revert-line

but that key sequence is probably already trapped by the terminal, so you might have to use stty to unbind it before it'll work. First look for ^Z in the output of stty -a (as shown in Ignacio's answer) and then, for example, if it shows up in susp = ^Z, run

stty susp ^-

to unbind that key mapping.

The other changes you're asking about would have to be done with stty as Ignacio says, since those are terminal functions, but I'm not sure exactly how. The issue is that I don't know whether the terminal recognizes Shift, or if it does, how to convey that information to stty.