参考网址:
查看命令帮助https://blog.csdn.net/Abysscarry/article/details/79700293?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522164560805516780264015079%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fall.%2522%257D&request_id=164560805516780264015079&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2allfirst_rank_ecpm_v1~rank_v31_ecpm-2-79700293.pc_search_result_cache&utm_term=centos7%E5%88%A0%E9%99%A4%E6%8C%87%E5%AE%9Ahistory%E5%91%BD%E4%BB%A4&spm=1018.2226.3001.4187
help history
全部清除命令[root@VM-0-15-centos ~]# help history
history: history [-c] [-d offset] [n] or history -anrw [filename] or history -ps arg [arg…]
Display or manipulate the history list.Display the history list with line numbers, prefixing each modified entry with a `*'. An argument of N lists only the last N entries. Options: -c clear the history list by deleting all of the entries -d offset delete the history entry at offset OFFSET. -a append history lines from this session to the history file -n read all history lines not already read from the history file -r read the history file and append the contents to the history list -w write the current history to the history file and append them to the history list -p perform history expansion on each ARG and display the result without storing it in the history list -s append the ARGs to the history list as a single entry If FILENAME is given, it is used as the history file. Otherwise, if $HISTFILE has a value, that is used, else ~/.bash_history. If the $HISTTIMEFORMAT variable is set and not null, its value is used as a format string for strftime(3) to print the time stamp associated with each displayed history entry. No time stamps are printed otherwise. Exit Status: Returns success unless an invalid option is given or an error occurs.
history -c
说明:
部分删除操作一般我们已知的是history -c 命令,即清除所有历史记录
但是如果服务器用的是公司的,就不好执行这种粗暴的操作了。。
1.*vim ~/.bash_history*
该文件即为历史记录存储文件,我们随意修改
2.修改后再次 history 查看,发现并没有变化。原因:缓存
执行:*history -r*
读取历史文件并将其内容添加到历史记录中,即重置文件里的内容到内存中,完成修改!



