Hack 58. HISTCONTROL を使用して全履歴に渡って重複を排除する
上で示した ignoredups は連続したコマンドがある場合にのみ重複を排除します。
全履歴に渡って重複を排除するには、以下に示すように HISTCONTROL に erasedups をセットします。
# 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: pwd 後の以前の service httpd stop が排除されました。]