14

I set up a git repository on my Ubuntu machine as a server, which is on a home network. Then I SSH to this repository on the same computer or from another home computer. Login is fine. However, when I type a partial file or directory name at the terminal, then press tab, the cursor moves toward right on the terminal, without bringing the full file or directory name up as it normally does.

After I exit from the SSH server, the tab key works normally.

Edit:

Also, the , , and keys don't work. When I press any of this, I get these at the terminal:

$ ^[[A^[[D^[[C^[[A

What could be the reason?

Add:

$ env

MAIL=/var/mail/git
USER=git
SSH_CLIENT=10.0.0.250 42342 2222
J2SDKDIR=/usr/lib/jvm/java-8-oracle
J2REDIR=/usr/lib/jvm/java-8-oracle/jre
HOME=/home/git
SSH_TTY=/dev/pts/5
LOGNAME=git
TERM=xterm-256color
XDG_SESSION_ID=93
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin
DERBY_HOME=/usr/lib/jvm/java-8-oracle/db
XDG_RUNTIME_DIR=/run/user/1001
LANG=en_US.UTF-8
SHELL=/bin/sh
PWD=/home/git
JAVA_HOME=/usr/lib/jvm/java-8-oracle
SSH_CONNECTION=10.0.0.250 42342 10.0.0.250 2222
5
  • Please add a little more detail, preferable an example where this is happening.
    – dessert
    Oct 30, 2017 at 7:24
  • @dessert, please see my edit. I had such experience long time ago at some terminals. But rarely happens.
    – martin
    Oct 30, 2017 at 7:30
  • Add the output of env please.
    – muru
    Oct 30, 2017 at 7:38
  • 3
    Maybe related: serverfault.com/questions/196336/…
    – dessert
    Oct 30, 2017 at 7:40
  • Same problem here, using bash. Solution: Install bash-completion Jan 18 at 6:59

2 Answers 2

14

Your current shell is the problem. You're currently using sh as the default shell, as seen in the output of your env command:

SHELL=/bin/sh

To fix your issue, you need to change to another shell that supports those key inputs (such as bash, which I'll use as an example). To do this, you'll need to use the chsh utility (change shell).

Example:

$ which bash
  /bin/bash
$ chsh -c /bin/bash 

This will update the default shell environment for your user (see more here about full usage). You'll need to logout/login or start a new session to load in to the new shell.

Alternatively, you can utilise another shell by locating its path and running from your current shell. As an example, here's me changing from sh to bash:

$ which bash
  /bin/bash
$ /bin/bash

chris@loki:~$ 

Hope this helps!

1
  • 1
    I don't think -c is a valid flag for chsh. Did you mean chsh -s /bin/bash?
    – Jacob Ford
    Jul 6, 2021 at 16:21
6

You might have to run chsh like sudo chsh username -s /bin/bash

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.