Hack 57. Eliminate the continuous repeated entry from history using HISTCONTROL
by Ramesh
In the following example pwd was typed three times, when you do history, you can see all the 3 continuous occurrences of it. To eliminate duplicates, set HISTCONTROL to ignoredups as shown below.
- # pwd
- # pwd
- # pwd
- # history | tail -4
- 44 pwd
- 45 pwd
- 46 pwd
- 47 history | tail -4
Note: There are three pwd commands in history, after executing pwd 3 times as shown above
- # export HISTCONTROL=ignoredups
- # pwd
- # pwd
- # pwd
- # history | tail -3
- 56 export HISTCONTROL=ignoredups
- 57 pwd
- 58 history | tail -4
Note: There is only one pwd command in the history, even after executing pwd 3 times as shown above
当前内容版权归 Ramesh Natarajan 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 Ramesh Natarajan .