1.命令的用法及参数usage: history [-c] [-d offset] [n] or history -anrw [filename] or history -ps arg [arg...] 参数: n :数字,要列出最近的若干命令列表 -c :将目前的 shell 中的所有 history 内容全部消除 -a :将目前新增的 history 指令新增入 histfiles 中,若没有加 histfiles ,则预设写入 ~/.bash_history -r :将 histfiles 的内容读到目前这个 shell 的 history 记忆中 -w :将目前的 history 记忆内容写入 histfiles
export HISTSIZE=100 # history 命令的记录数量。The number of commands to remember in the command history. The default value is 500.
export HISTFILESIZE=100 # 记录文件的行数。The maximum number of lines contained in the history file. When this variable is assigned a value, the his-tory file is truncated, if necessary, by removing the oldest entries, to contain no more than that number of lines. The default value is 500. The history file is also truncated to this size after writing it when an interactive shell exits.
export HISTIGNORE='ls' # A colon-separated list of patterns used to decide which command lines should be saved on the history list.Each pattern is anchored at the beginning of the line and must match the complete line