I was interested to see how many commands I executed in the current given day. Solutions for zsh and bash are a little different:


fc -l -i 1 | grep $(date +"%Y-%m-%d") | wc -l
You would think history would have done the trick but I couldn't get the timestamps working in zsh so I had to use fc (I think fc means Fix Command).


Bash is a little easier but you need to make sure you have HISTTIMEFORMAT set so the history command shows timestamps:

export HISTTIMEFORMAT="%Y-%m-%d " history | grep $(date +"%Y-%m-%d") | wc -l

Important! If HISTTIMEFORMAT was not set before then you will need to be patient because your commands before the time that you set the HISTTIMEFORMAT will be timestamped with the time that you set it so it will probably like you have executed more commands than you have today.