You're not using bash
, you're using sh
. What that means depends on your system, on Debian and Ubuntu, /bin/sh
is a symlink to dash
so that's what your default shell is. dash
does not have the functionality you want, you need to switch to another shell like bash
or zsh
. You can do this with the command chsh
:
$ chsh
Password:
Changing the login shell for terdon
Enter the new value, or press ENTER for the default
Login Shell [/bin/sh]: /bin/bash
Now, every new terminal you open will be running bash
and the up arrow should give you the history.
Even on systems where sh
is a link to bash
, the two are not equivalent. As explained in man bash
:
If bash is invoked with the name sh, it tries to mimic the startup
behavior of historical versions of sh as closely as possible, while
conforming to the POSIX standard as well. When invoked as an interac‐
tive login shell, or a non-interactive shell with the --login option,
it first attempts to read and execute commands from /etc/profile and
~/.profile, in that order. The --noprofile option may be used to
inhibit this behavior. When invoked as an interactive shell with the
name sh, bash looks for the variable ENV, expands its value if it is
defined, and uses the expanded value as the name of a file to read and
execute. Since a shell invoked as sh does not attempt to read and exe‐
cute commands from any other startup files, the --rcfile option has no
effect. A non-interactive shell invoked with the name sh does not
attempt to read any other startup files. When invoked as sh, bash
enters posix mode after the startup files are read.
bash
? What doesecho $SHELL
return? Does runninghistory
show you the past commands? If tab doesn't work you have probably changed something. Are youssh
ing into this machine or is your local box?iff
no quick solution currently exists.