Bash doesn't have proper `preexec`. But zsh does: http://zsh.sourceforge.net/Doc/Release/Functions.html And tcsh has `postcmd`: http://www.tcsh.org/tcsh.html/Special_aliases.html