# Delete Key



## bratak (Oct 7, 2020)

Hi everyone

I'm a complete Newb with FBSD, and even in Linux I just began about 4 Months ago.
Of course, I still run into simple problems, like the one here:

When I press the "*Del"* key on my keyboard (DELL) or *"Home"* key, I get a *tilde "~"* instead of working keys.

I have a complete fresh 12.x installation of FBSD.

Unfortunately I could not find a working solution so far here in the Forum nor on the Web.
Every time one explains something, I run into other issues, or there is missing a command with the explanati

But I wont let go BSD for now, so hope is to find help here.

Thanks in advance for any help
bratak


----------



## ondra_knezour (Oct 7, 2020)

Solved - Getting delete to remove character under cursor
					

The problem of getting keys like end, home, backspace and delete to perform specific actions is apparently a common one, judging by the number of posts I've seen on the topic. I've tried various things over the years and have probably spend time adding up to days on this problem. I am posting...




					forums.freebsd.org
				











						Delete key
					

The behaviour of the delete key in FreeBSD has always annoyed me so I thought I'd see if anyone else was annoyed with it and what they did... I found this 59323 but am none the wiser. Is there a keyboard map I can change so that pressing Delete actually deletes the current character rather than...




					forums.freebsd.org
				











						Need help with key bindings in .cshrc
					

I want to enable some common key bindings for t/csh on my dedicated server (freebsd 11 rel) but noticed some really weird behavior! Let me explain the situation. My .cshrc follows umask 22 set path = (/sbin /bin /usr/sbin /usr/bin /usr/local/sbin /usr/local/bin $HOME/bin)  setenv  EDITOR vi...




					forums.freebsd.org
				




If those don't help solve it for you, add more details - shell you are using, user (root/other) and method of connection (ie. Putty from Windows, monitor and keyboard, ssh from Linux using xy terminal app...)


----------



## Minbari (Oct 7, 2020)

I presume that You are using the default shell (csh/tcsh). For the *Del*, *Home*, *End*, *Insert* keys to work You need to add the following in your .cshrc/.tcshrc file. e.g:

```
if ($?tcsh && $?prompt) then
        bindkey "\e[1~" beginning-of-line # Home
        bindkey "\e[7~" beginning-of-line # Home rxvt
        bindkey "\e[2~" overwrite-mode    # Ins
        bindkey "\e[3~" delete-char       # Delete
        bindkey "\e[4~" end-of-line       # End
        bindkey "\e[8~" end-of-line       # End rxvt
endif
```


----------



## bratak (Oct 8, 2020)

Minbari said:


> I presume that You are using the default shell (csh/tcsh). For the *Del*, *Home*, *End*, *Insert* keys to work You need to add the following in your .cshrc/.tcshrc file. e.g:
> 
> ```
> if ($?tcsh && $?prompt) then
> ...




Thanks Minbari

Unfortunately, after using this code, something weird happened.
Every time I login, it throws me back to login:


From the  "No such file or  directory" message (3rd last line) I guess, I have a error in the code (handwritten because copy & paste was not working).
So I can't login anymore with root (which was the only user I had setup).

Then I started in "Single User Mode" with the intention, to correct my buggy code.
But the nano editor won't let me save the file: "Error writing .cshrc: Read-only file system

Aaaaand I'm stuck again... to learn something new? ;-)
Since it's a testing environment, its not a "problem", but I really would like to get it to work and use FBSD as my primary environment.

Any Ideas?
tnx

FOLLOWUP 1

I was able to mount the FS in write mode, after google it.
So I was editing the file, to correct my bug and it ended in a nightmare...
Every time I edited a word, or delete a character, or typed something, "it" started "it's" one live.
A character got deleted here, something got inserted there...
So no way for  me to debug the file  and I have no clue what's going on §8-/

However, thanks for your help and I will try it later when I'm in the "experimental" moode again.
bratak


FOLLOWUP 2

OK, I'm stubborn...so after a nice meal, I thought about how to attack this problem again.

1. I installed a new FBSD VM
2. I ssh'd into the FBSD VM via my raspberry pi 
3. Copy & paste the code (that worked from my r-pi shell, but still not directly in the KVM-FBSD VM)
4. Reboot

Done & it works perfectly.

I still have no clue what the problem was with the wired behavior of the nano editing action.
However, now I can start over again and research FBSD further.

Thanks again to all the help here.
bratak


----------



## UnixRocks (Feb 14, 2022)

I've had this irritant for a while with just the [Delete] key on root's shell through several versions of RELEASE. Finally I was irritated enough today to go looking for the answer. This was the first search result I looked at and Minbari's answer was the clue I needed. I knew I needed a bindkey, just did not know the format I needed. Since the only key on this Logitech wireless keyboard that was misbehaving was that one key I just added the bindkey for delete to the .cshrc for root here:

```
if ($?prompt) then
        # An interactive shell -- set some stuff up
        set prompt = "%N@%m:%~ %# "
        set promptchars = "%#"
        set filec
        set history = 1000
        set savehist = (1000 merge)
        set autolist = ambiguous
        # Use history to aid expansion
        set autoexpand
        set autorehash
        set mail = (/var/mail/$USER)
        if ( $?tcsh ) then
                bindkey "^W" backward-delete-word
                bindkey -k up history-search-backward
                bindkey -k down history-search-forward
                bindkey "\e[3~" delete-char       # Delete
        endif
endif
```

To be complete the system in question is running:

```
# freebsd-version -kru
12.3-RELEASE-p1
12.3-RELEASE-p1
12.3-RELEASE-p2
```


----------



## shkhln (Oct 2, 2022)

Are there people for whom the delete key works out of the box with tcsh? Anyone? I understand that jumping through hoops is a time-honored FreeBSD tradition, but requiring users to provide a custom config for the bog-standard 101-key PC keyboard layout is just silly.


----------



## Phishfry (Oct 2, 2022)

Never needed it. Backspace is right there.
But no. It does not work in a tcsh shell command prompt or Xorg terminal window.
Acts as Tilda key.

However under `ee` it does work as delete key.

Dont worry. Getting ready to ditch root tcsh for something else. No big change at all.
(sarcasm)


----------



## shkhln (Oct 2, 2022)

Phishfry said:


> However under `ee` it does work as delete key.


It works with /bin/sh just fine, but that's not the point.


----------

