[SOLVED] "Insert" & "Delete" key returns "~" in a terminal.
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
"Insert" & "Delete" key returns "~" in a terminal.
This is making me nuts because I do a lot of command line stuff.
In a terminal, any terminal (I've tried konsole and xterm), pressing the "Insert" or "Delete" key returns a tilde "~" character. This only happens in my account. If I log in to a different account, in the same terminal, the delete key actually deletes characters and makes editing of commands much easier. I have no idea why it behaves in other accounts and not mine. The dot files are all identical.
For a while this was happening with the "Home", "End", and "Page Up/Down" keys. I blew away my .kde directory and it fixed all except the "Delete" and "Insert" keys. I don't really care about the "Insert" key but I really need "Delete" to function as a delete.
Click here to see the post LQ members have rated as the most helpful post in this thread.
I have experienced similar problems like this, but first, please be clear about which desktop (KDE 3.x, KDE 4.x, etc) you are using, what distribution you are running (Debian, Fedora, etc), and what kind of system you are having the problem on (desktop, laptop, other?).
Sometimes it could be the keyboard you are using. Try switching out keyboards (unless you are on a laptop).
Until you figure out a solution here are some work-arounds you may find useful.
Ctrl+D = delete character under cursor
Alt+D = delete from cursor to end of word
Ctrl+K = kill from cursor to end of line
Ctrl+u = kill from cursor to start of line
Ctrl+_ = undo last deletion
Ctrl+Y = replace last killed text
This only happens in my account. If I log in to a different account, in the same terminal, the delete key actually deletes characters and makes editing of commands much easier. I have no idea why it behaves in other accounts and not mine. The dot files are all identical.
Why not make a new user and either work from that account or copy whatever you cherish to that account, delete your own account, re-make your own account, and copy all your files back.
And impert, I think thats exactly what we want to avoid, but it will still wok.
To me it just seems like the easiest way, but whatever.
Surely if it's not happening in the other accounts, it's got to be to do with a dot file in the account where he has the trouble?
True. Another thing, why is the "dot-hierarchy" in a typical user's home folder so complicated? When problem like this one occurs, I sometimes spend hours trying to find the culprit. It's a good thing I always back up everything.
I had a problem like this just recently with my laptop, the Home and End keys were inserting tildes in the terminal. Theres a simple way to fix it though, assuming it's actually the same problem. First, post the contents of your /etc/inputrc and (if it exists) ~/.inputrc for the account having the problem, then run
Code:
cat
in a terminal exactly like I wrote it there, without any parameters. Now press delete, then enter, then insert, then CTRL+D twice and post the output of that as well. If it's the same problem I was having we'll have it fixed in no time.
Last edited by KDHofAvalon; 04-23-2011 at 12:13 PM.
I had a problem like this just recently with my laptop, the Home and End keys were inserting tildes in the terminal. Theres a simple way to fix it though, assuming it's actually the same problem. First, post the contents of your /etc/inputrc and (if it exists) ~/.inputrc for the account having the problem, then run
Code:
cat
in a terminal exactly like I wrote it there, without any parameters. Now press delete, then enter, then insert, then CTRL+D twice and post the output of that as well. If it's the same problem I was having we'll have it fixed in no time.
That's it. I removed ~/.inputrc and it fixed the problem! thx,
@KDHofAvalon: I have exactly the same problem on Slackware -current with zsh. But I don't have ~/.inputrc. Would you be so kind to share your solution, so that I can try if that helps?
@TobiSGD: Certainly. Slackware's where I had the problem as well.
You should have an '/etc/inputrc' file, even without one in ~, since Slackware installs it by default. DO NOT delete this file as it's referenced at least two times in other default Slackware scripts, once in '/etc/profile' and again... I forget the other one at the moment, sorry.
Anyway the file lists the wrong symbols for the keys that are misbehaving, so you're going to have to edit it. Use my instructions for 'cat' in my last post and press the misbehaving keys one at a time. The result will look something like this:
Wow, I'm bookmarking this. Even though I've never had a problem like this, I am thinking about trying Slackware soon and this is exactly the kind of info I need.
Thanks for your explanation, but sadly, that didn't help me.
This is the content of my /etc/inputrc:
Code:
# /etc/inputrc
# This file configures keyboard input for programs using readline.
# See "man 3 readline" for more examples.
# Configure the system bell. Options are none, visible, and audible.
#set bell-style none
# Enable 8 bit input.
set meta-flag On
set input-meta On
set convert-meta Off
set output-meta On
# Set various nice escape sequences:
"\eOd": backward-word
"\eOc": forward-word
# for linux console
"\e[1~": beginning-of-line
"\e[4~": end-of-line
"\e[5~": beginning-of-history
"\e[6~": end-of-history
"\e[3~": delete-char
"\e[2~": quoted-insert
# for xterm
"\eOH": beginning-of-line
"\eOF": end-of-line
# for freebsd console
"\e[H": beginning-of-line
"\e[F": end-of-line
These keys (with the code the cat command gives) are not working for me in the console, regardless of it is a xterm or a virtual console.
Code:
Delete: ^[[3~
Insert: ^[[2~
Page up: ^[[5~
Page down: ^[[6~
Home: ^[OH on virtual console this is ^[[1~
End: ^[OF on virtual console this is ^[[4~
I am somewhat lost here, because the keys I press are the same that are mentioned in the inputrc, but it is not working.
Okay I just realized the problem. I use bash while you use zsh, which apparently doesn't read '/etc/inputrc'. Alright, then we'll have to convert the key definitions for bindkey and put them in your ~/.zshrc, easy enough just put bindkey at the start and get rid of the colon. Or if you prefer here's a sed one-liner to get them into the right format:
Code:
sed -n 's/^/bindkey /; s/: / /p' /etc/inputrc
Sorry about that, I've never used zsh extensively.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.