32

On centos I can skip a word by hitting ctrl + arrow (left or right) in a terminal. When I ssh into a FreeBSD box and I try the same pattern I get:

$ tail -f 20120412.log;5D;5D;5D

(each try = ;5D)

Is there a way to fix this? I am using Ubuntu 12.04 + Terminator.

Thanks in advance.

jdorfman
  • 423

5 Answers5

42

A .inputrc in your home directory will cause ctrl+left to stop working on Ubuntu (for example).

To get everything working, add the following to ~/.inputrc:

# Include system-wide inputrc, which is ignored by default when
# a user has their own .inputrc file.
$include /etc/inputrc
CoolOppo
  • 103
f.kowal
  • 537
3

If You use ZSH, then use this at /etc/zshrc file.

case "${TERM}" in
  cons25*|linux) # plain BSD/Linux console
    bindkey '\e[H'    beginning-of-line   # home 
    bindkey '\e[F'    end-of-line         # end  
    bindkey '\e[5~'   delete-char         # delete
    bindkey '[D'      emacs-backward-word # esc left
    bindkey '[C'      emacs-forward-word  # esc right
    ;;
  *rxvt*) # rxvt derivatives
    bindkey '\e[3~'   delete-char         # delete
    bindkey '\eOc'    forward-word        # ctrl right
    bindkey '\eOd'    backward-word       # ctrl left
    # workaround for screen + urxvt
    bindkey '\e[7~'   beginning-of-line   # home
    bindkey '\e[8~'   end-of-line         # end
    bindkey '^[[1~'   beginning-of-line   # home
    bindkey '^[[4~'   end-of-line         # end
    ;;
  *xterm*) # xterm derivatives
    bindkey '\e[H'    beginning-of-line   # home
    bindkey '\e[F'    end-of-line         # end
    bindkey '\e[3~'   delete-char         # delete
    bindkey '\e[1;5C' forward-word        # ctrl right
    bindkey '\e[1;5D' backward-word       # ctrl left
    # workaround for screen + xterm
    bindkey '\e[1~'   beginning-of-line   # home
    bindkey '\e[4~'   end-of-line         # end
    ;;
  screen)
    bindkey '^[[1~'   beginning-of-line   # home
    bindkey '^[[4~'   end-of-line         # end
    bindkey '\e[3~'   delete-char         # delete
    bindkey '\eOc'    forward-word        # ctrl right
    bindkey '\eOd'    backward-word       # ctrl left
    bindkey '^[[1;5C' forward-word        # ctrl right
    bindkey '^[[1;5D' backward-word       # ctrl left
    ;;
esac
vermaden
  • 47
  • 1
0

For Ctrl+ and Ctrl+→⃪⃪ with sh(1) in FreeBSD 14.0-RELEASE and greater, it seems that the two key combinations:

  • do work remotely (ssh)
  • do not yet work locally (at the computer).

Two commits for the enhancement – two files in the src tree:

  1. sh(1): interactive mode improvement · freebsd/freebsd-src@ef0d94a | https://cgit.freebsd.org/src/commit/?h=releng/14.0&id=ef0d94a3d34c880bd9f86cd842ee01b6075bc1d8
  2. skel: update .shrc as well · freebsd/freebsd-src@5fe9737 | https://cgit.freebsd.org/src/commit/?h=releng/14.0&id=5fe97373486619373e3eeecb25582b5c937a26c5

https://www.freebsd.org/releases/14.0R/relnotes/#userland-config began:

The default shell for the root user is now sh(1), which has many new features for interactive use. d410b585b6f0

0

Looks like you might have the wrong $TERM setting. echo $TERM to find out what your current setting is. Might want to use xterm export TERM=xterm-256color.

kasperd
  • 31,086
-2

The shell you're running on the FreeBSD machine probably doesn't support that control sequence. Without knowing what shell you're running on either end, though, it's hard to say for sure.

wfaulk
  • 6,986