LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This 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



Reply
 
Search this Thread
Old 04-21-2011, 04:17 PM   #1
sharky
Member
 
Registered: Oct 2002
Posts: 404

Rep: Reputation: 37
"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.
Old 04-21-2011, 05:14 PM   #2
PhoenixAndThor
Member
 
Registered: Sep 2009
Location: Geogia, USA
Distribution: Ubuntu, Debian, Live CDs
Posts: 213

Rep: Reputation: 38
Question Need more information

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).
 
Old 04-21-2011, 05:57 PM   #3
Telengard
Member
 
Registered: Apr 2007
Location: USA
Distribution: Kubuntu 8.04
Posts: 579
Blog Entries: 8

Rep: Reputation: 147Reputation: 147
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

Many more exist.
 
Old 04-21-2011, 06:27 PM   #4
impert
Member
 
Registered: Feb 2009
Posts: 282

Rep: Reputation: 53
Quote:
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.
 
Old 04-21-2011, 08:00 PM   #5
PhoenixAndThor
Member
 
Registered: Sep 2009
Location: Geogia, USA
Distribution: Ubuntu, Debian, Live CDs
Posts: 213

Rep: Reputation: 38
Thnx Telengard, I didn't know about those keybindings. And impert, I think thats exactly what we want to avoid, but it will still wok.
 
Old 04-22-2011, 06:06 AM   #6
impert
Member
 
Registered: Feb 2009
Posts: 282

Rep: Reputation: 53
Quote:
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?
 
Old 04-23-2011, 01:26 AM   #7
PhoenixAndThor
Member
 
Registered: Sep 2009
Location: Geogia, USA
Distribution: Ubuntu, Debian, Live CDs
Posts: 213

Rep: Reputation: 38
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.
 
Old 04-23-2011, 01:11 PM   #8
KDHofAvalon
Member
 
Registered: Apr 2007
Location: Kansas
Distribution: Slackware
Posts: 47

Rep: Reputation: 27
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 01:13 PM.
 
Old 04-25-2011, 11:29 AM   #9
sharky
Member
 
Registered: Oct 2002
Posts: 404

Original Poster
Rep: Reputation: 37
Quote:
Originally Posted by KDHofAvalon View Post
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,
 
Old 04-25-2011, 03:45 PM   #10
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Main: Gentoo Others: What fits the task
Posts: 15,653
Blog Entries: 2

Rep: Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095
@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?
 
Old 04-26-2011, 01:57 AM   #11
KDHofAvalon
Member
 
Registered: Apr 2007
Location: Kansas
Distribution: Slackware
Posts: 47

Rep: Reputation: 27
@Sharky: You're quite welcome.

@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:
Code:
^[[8~
And a sample from my '/etc/inputrc':
Code:
"\e[1~": beginning-of-line
"\e[4~": end-of-line
"\e[5~": beginning-of-history
"\e[6~": end-of-history
"\e[7~": beginning-of-line
"\e[3~": delete-char
"\e[2~": quoted-insert
Simply replace the number of the proper function with the one you got with 'cat' and you're done.

Hope that helps.

Last edited by KDHofAvalon; 04-26-2011 at 02:00 AM.
 
2 members found this post helpful.
Old 04-26-2011, 02:47 AM   #12
PhoenixAndThor
Member
 
Registered: Sep 2009
Location: Geogia, USA
Distribution: Ubuntu, Debian, Live CDs
Posts: 213

Rep: Reputation: 38
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.
 
Old 04-26-2011, 07:07 AM   #13
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Main: Gentoo Others: What fits the task
Posts: 15,653
Blog Entries: 2

Rep: Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095
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.
 
Old 04-26-2011, 08:30 AM   #14
KDHofAvalon
Member
 
Registered: Apr 2007
Location: Kansas
Distribution: Slackware
Posts: 47

Rep: Reputation: 27
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.
 
Old 04-26-2011, 08:37 AM   #15
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Main: Gentoo Others: What fits the task
Posts: 15,653
Blog Entries: 2

Rep: Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095
That works, thanks for your help.
 
  


Reply

Tags
keybindings, keyboard


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
automount 5.0.3 with auto.smb script yields "key "<name>" not found in map" rbergen Linux - Software 0 01-01-2010 01:27 PM
Command "mail" returns "panic: temporary file seek" kenneho Linux - Software 5 12-23-2008 04:27 AM
net working eth0 eth1 wlan0 "no connection" "no LAN" "no wi-fi" Cayitano Linux - Newbie 5 12-09-2007 08:11 PM
Standard commands give "-bash: open: command not found" even in "su -" and "su root" mibo12 Linux - General 4 11-11-2007 11:18 PM
LXer: Displaying "MyComputer", "Trash", "Network Servers" Icons On A GNOME Desktop LXer Syndicated Linux News 0 04-02-2007 09:31 AM


All times are GMT -5. The time now is 04:59 PM.

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