Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 08-11-2009, 08:14 PM   #1
Registered: May 2007
Location: Bulgaria
Distribution: Slackware, SCO Unix
Posts: 62

Rep: Reputation: 20
Map delete key to ctl+c

Im using Slackware 12.2, korn shell with editor VI.
How can I map the delete key to ctl+c on console.

In X, it works with:
stty intr ^H

But in console the delete key is: ^[[3~, and stty do not accept this:
stty intr ^[[3~

Does anybody know, how to do this. It must be set on korn shell with command line mode set to Vi, not Emacs.
Old 08-12-2009, 01:09 PM   #2
David the H.
Bash Guru
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian + kde 4 / 5
Posts: 6,837

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Isn't crtl+c mapped to SIGTERM on most consoles?
Old 08-12-2009, 05:28 PM   #3
Registered: Jul 2009
Location: Illinois, US
Distribution: Fedora 11
Posts: 374

Rep: Reputation: 55
Judging by what he tried to do, he wants delete to cause a SIGINT (not SIGTERM; that's the one kill uses if you don't specify another). OP, shot in the dark here - try `stty intr '^[[3~'`. When you get this working, you'll want to put a switch to run the appropriate one based on the value of $TERM. Like so:
 52 case "$TERM" in
 53     'xterm')
 54     bindkey '^[[H' beginning-of-line
 55     bindkey '^[OH' beginning-of-line
 56     bindkey '^[[F' end-of-line
 57     bindkey '^[OF' end-of-line
 58     bindkey '^[[3~' delete-char
 59     bindkey '^[[6~' end-of-history
 60     bindkey '^[[5~' insert-last-word
 61     ;;
 62     'xterm*')
 63     bindkey '^[OH' beginning-of-line
 64     bindkey '^[OF' end-of-line
 65     bindkey '^[[3~' delete-char
 66     bindkey '^[[6~' end-of-history
 67     bindkey '^[[5~' insert-last-word
 68     ;;
 69     'screen')
 70     bindkey '^[[1~' beginning-of-line
 71     bindkey '^[[4~' end-of-line
 72     bindkey '^[[3~' delete-char
 73     bindkey '^[[6~' end-of-history
 74     bindkey '^[[5~' insert-last-word
 75     ;;
 76     'linux')
 77     bindkey '^[[1~' beginning-of-line
 78     bindkey '^[[4~' end-of-line
 79     bindkey '^[[3~' delete-char
 80     bindkey '^[[6~' end-of-history
 81     bindkey '^[[5~' insert-last-word
 82     ;;
 83 esac


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I map the control key to the caps lock key in Linux? tate1615 Linux - General 4 07-14-2008 02:20 PM
can't map Alt Gr key vito_huang Linux - General 1 04-23-2007 03:11 PM
Smart Key Signature ERRORS! How do I delete this bad key from my computer? Balarabay1 Linux - Software 4 09-27-2006 12:01 PM
Map Mouse Button to Key Parksy Linux - Hardware 0 01-07-2004 09:00 PM
Ksnapshot -- How to map Printscreen key jmke2002 Linux - General 4 08-29-2003 07:58 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:38 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration