De man bash:
HISTFILE
The name of the file in which command history is saved.
The default value is ~/.bash_history.
If unset, the command history is not saved when a shell exits.
Por lo tanto, la variable HISTFILEcontendrá el nombre de archivo donde se guardará el historial.
$ echo "$HISTFILE"
/home/user/.bash_history
Ahora puede buscar el patrón:
$ grep "vim" "$HISTFILE"
vim foo.text
vim bar.text
vim file.txt
Como señaló @Dennis, si lo desea, puede ejecutar history -apara agregar el historial de comandos de la sesión en ejecución al $HISTFILEarchivo. Básicamente, los comandos se agregarán automáticamente una vez que cierre una sesión, history -aharán lo mismo en ese instante.
Corre help historypara tener más idea sobre el historypropio edificio.