cap*_*gon 6 command-line history
我在 proxmox OpenVZ 容器上运行Ubuntu 10.04.4 LTS。
我想它没有历史,因为命令行上的向上箭头给了我 ^[[A
加...
$ history
-sh: history: not found
Run Code Online (Sandbox Code Playgroud)
但是当我尝试安装时我得到了这个。
$ sudo apt-get install history
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Couldn't find package history
Run Code Online (Sandbox Code Playgroud)
我需要安装的正确包名是什么才能使历史记录正常工作?
该history命令是bash 的一个特性。出于某种原因,您的系统可能正在运行dash而不是 bash。也许,您需要将登录 shell 更改为 /bin/bash(应该是默认设置)。在终端中输入以下命令:
chsh -s /bin/bash
Run Code Online (Sandbox Code Playgroud)
然后,注销并登录。
如果你的系统中没有安装bash,你可以通过以下命令安装它:
sudo apt-get install bash
Run Code Online (Sandbox Code Playgroud)
虽然,您可以使用其他 shell,如zsh或tcsh(包括历史记录)。