Hack 58. Erase duplicates across the whole history using HISTCONTROL
by Ramesh
The ignoredups shown above removes duplicates only if they are consecutive commands. To eliminate duplicates across the whole history, set the HISTCONTROL to erasedups as shown below.
- # export HISTCONTROL=erasedups
- # pwd
- # service httpd stop
- # history | tail -3
- 38 pwd
- 39 service httpd stop
- 40 history | tail -3
- # ls -ltr
- # service httpd stop
- # history | tail -6
- 35 export HISTCONTROL=erasedups
- 36 pwd
- 37 history | tail -3
- 38 ls –ltr
- 39 service httpd stop
- 40 history | tail -6
Note: The previous service httpd stop after pwd got erased
当前内容版权归 Ramesh Natarajan 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 Ramesh Natarajan .