Make Home, End and Delete keys work on FreeBSD

Date: October 7th, 2007
Author: Stefan Batanov

This tutorial will explain you how you can enable Home, End and Delete keys in ssh terminal of FreeBSD.

This configuration is not applicable for Linux distributions as all of them i have seen have these keys working by default.

The default environment for FreeBSD is CSH. You will need to open .cshrc file located in your home directory.

It should like this:

  1. # $FreeBSD: src/etc/csh.cshrc,v 1.3 1999/08/27 23:23:40 peter Exp $
  2. #
  3. # System-wide .cshrc file for csh(1).
  4. [root@onlinehowto ~]$ cat /usr/home/stefan/.cshrc
  5. # $FreeBSD: src/share/skel/dot.cshrc,v 1.13 2001/01/10 17:35:28 archie Exp $
  6. #
  7. # .cshrc – csh resource script, read at beginning of execution by each shell
  8. #
  9. # see also csh(1), environ(7).
  10. #
  11.  
  12. alias h  history 25
  13. alias j  jobs -l
  14. alias la ls -a
  15. alias lf ls -FA
  16. alias ll ls -lA
  17.  
  18. # A righteous umask
  19. umask 22
  20.  
  21. set path = (/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin /usr/local/bin /usr/X11R6/bin $HOME/bin)
  22.  
  23. setenv EDITOR vi
  24. setenv PAGER more
  25. setenv BLOCKSIZE K
  26.  
  27. if ($?prompt) then
  28.  # An interactive shell — set some stuff up
  29.  set filec
  30.  set history = 100
  31.  set savehist = 100
  32.  set mail = (/var/mail/$USER)
  33.  if ( $?tcsh ) then
  34.   bindkey "^W" backward-delete-word
  35.   bindkey -k up history-search-backward
  36.   bindkey -k down history-search-forward
  37.  endif
  38. endif

You need to add few lines in the if clause. Open this file with your favorite editor and after the bindkey lines add the lines bellow. To apply what you have done run this command.

[localhost]# source .cshrc

  1. bindkey "\e[1~" beginning-of-line  # Home
  2. bindkey "\e[7~" beginning-of-line  # Home rxvt
  3. bindkey "\e[2~" overwrite-mode     # Ins
  4. bindkey "\e[3~" delete-char        # Delete
  5. bindkey "\e[4~" end-of-line        # End
  6. bindkey "\e[8~" end-of-line        # End rxvt
VN:F [1.9.18_1163]
Rating: 7.0/10 (1 vote cast)
Make Home, End and Delete keys work on FreeBSD, 7.0 out of 10 based on 1 rating

One Response to “Make Home, End and Delete keys work on FreeBSD”

Leave a Reply