Grimoire-
Command
.es

GNU+Linux command memo

Prevent ZSH history from recording some commands

Empêcher certaines commandes d’être enregistrées dans l’historique de ZSH.

Edit ~/.zshrc to add this function:

function zshaddhistory() {
    [[ $1 != *"rm"* ]] && [[ $1 != *"cd"* ]] && [[ $1 != *"mv"* ]] &&
    [[ $1 != *"wget"* ]] && [[ $1 != *"youtube-dl"* ]] && [[ $1 != *"w3m"* ]]
}

Here we prevent all rm cd mv wget youtube-dl w3m function calls to be recorded in ZSH history .zsh_history.