17
13

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

zshの履歴削除

Posted at

既に履歴として付いてしまったものは

vim $HISTFILE (=~/.zsh_history)

などと履歴ファイルを直接編集し、普通にエントリを削除するだけでOK。

なお、パスワードを直接コマンドラインで渡すなど事前に予見出来る場合は

setopt HIST_IGNORE_SPACE

と設定した前提で、先頭スペースを付けておけばログには記録されないので安心。

参考

How to remove an entry from the history in ZSH - Stack Overflow

おまけ

oh-my-zshの履歴の部分検索の設定例

.zshrc
source $ZSH/plugins/history-substring-search/history-substring-search.zsh

# bind k and j for VI mode
bindkey -M vicmd 'k' history-substring-search-up
bindkey -M vicmd 'j' history-substring-search-down

詳細はこの辺が参考になりました。
zsh-users/zsh-history-substring-search

17
13
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
17
13

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?