Answers:
我尝试了同样的事情,只是发现偷偷摸摸的Ubuntu ~/.bashrc
默认将这些变量设置为默认值,而不是~/.profile
为非登录shell(例如仅打开终端窗口)执行该变量。更改这些行~/.bashrc
会为我修复:
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000
/etc/bash.bashrc
如果您可以接受,则可以通过书写方式进行修复。见下文。(也许也是失踪者export
)
HISTSIZE
The maximum number of commands to remember on the history list.
If the value is 0,
**commands are not saved** in the history list.
Numeric values less than zero result in
every command being saved on the history list (there is no limit).
因此,对于无限的历史记录列表,请使:
HISTSIZE =(某些数字小于0)
HISTFILESIZE
The maximum number of lines contained in the history file.
When this variable is assigned a value,
the history file is truncated, if necessary,
to contain no more than that number of lines
by removing the oldest entries.
The history file is also truncated to this size after
writing it when a shell exits.
If the value is 0,
**the history file is truncated to zero size.**
Non-numeric values and numeric values less than zero
inhibit truncation.
因此,对于无限.bash_history
历史文件,请执行以下操作:
HISTFILESIZE =(某些数字小于0)
如@Michal Przybylowicz所述,有时在Xubuntu(和Lubuntu)中这些文件似乎被忽略了。如果是这样,您可以改写这些行
export HISTSIZE=10000 export HISTFILESIZE=10000
到/etc/bash.bashrc
。这将全局更改这些环境变量的值。
export HISEFILESIZE=10000
尽管.profile
回声有效,但您似乎没有打错)。万一有人在这里看,应该是HISTFILESIZE