bash不保留历史

Modified on: Sat, 09 Jun 2018 19:50:23 +0800

我运行Ubuntu 12.04,由于某种原因,bash不保留我的命令历史记录。 ~/.bash_history文件只包含我几个月前输入的3个命令。

我该如何解决这个问题?

修改强>
这是我的.bashrc的相关内容:

# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

# If not running interactively, don't do anything
[ -z "$PS1" ] && return

# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth

# append to the history file, don't overwrite it
shopt -s histappend

# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000
作者:,yohbs

最佳答案

也可能是root:root拥有你的.bash_history( ROOT不应该是所有者,你的用户应该是所有者!),在这种情况下你需要:

$chown user:user .bash_history

当你经常做sudo bash时,这显然可能会神奇地发生!

作者:,mahatmanich

相关问答

添加新评论