The command number in bash specifies the number of commands typed since logging in as that user to whatever terminal you have open. It can be seen in your PS1 with
\#, such as in
export PS1="\! \# \\$"
I would like to reset this number at times. I can reset the history number in bash with
history -c among other things but I cannot figure out how to reset the command number.
I saw someone once with a PS1 that would reset a counter to 0 whenever they typed a command with a nonzero exit status. I thought that was funny, and am trying to recreate it, as I cannot find this online. I would not like to reset the history number since this also prevents me from searching through past commands. edit: I got this functionality without resetting the command number; see here
Is there a way to display the command number in bash without PS1, or to set it somehow?