history命令详解
1、manual说明 Display or manipulate the history list 显示或操作命令历史列表 2、概念区分 history list是在内存缓存中的,history file就是在硬盘中的。history list针对当前会话生效。history file 则针对所有会话都生效。当登录系统系统时,系统就会自动将history list中,当退出系统时,history list中的命令就会自动写入到history file中去。 ~/.bash_history 历史列表的默认保存位置 ~/.bash_profile 当前用户的环境变量的设置位置 /etc/profile 系统环境变量的默认设置位置 关于HISTORY的变量: HISTSIZE 命令历史记录的条数 HISTFILE 指定历史文件,默认为~/.bash_history HISTFILESIZE: 命令历史文件记录历史的条数 HISTTIMEFORMAT: HISTTIMEFORMAT=“%F%T” 显示时间 history用法: history [-c] [-d offset] [n] or history -anrw [filename] or history -ps arg [arg...] Display the history list with line numbers,