16

So when ever I use the up arrow it does not show the history of last command but does ^[[A and down ^[[B I don't know what is this called but also I have $ but running su did not have it.

Using Ubuntu Server 16.04.1

Jeff Schaller
  • 66,199
  • 35
  • 114
  • 250
Ajaydev Singh
  • 325
  • 1
  • 2
  • 12

2 Answers2

28

History is not present in all shells. You need to start a shell with history like bash. To do so, just type the name of the shell, like

bash

or the full path of the executable, like

/bin/bash
5

It appears that your login shell is /bin/sh. On Ubuntu, this is a shell intended for scripting, it doesn't have any comfortable command line edition feature such as history. To get a proper command line shell, change your login shell to bash or zsh:

chsh -s /bin/zsh

or

chsh -s /bin/bash

If that machine has restrictions which prevent you from changing your login shell, you can tell sh to execute bash or zsh when logging in. See how can I use bash as my login shell when my sysadmin refuses to let me change it

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175