Using the history Command
· β 2 min read
1. The history Command The history command lets you view the command history of the current session. When you exit the shell, the command history is saved to the corresponding history file.
For bash, the command history is saved in the ~/.bash_history file; for zsh, it is saved in ~/.zsh_history. You can also use the HISTFILE environment variable to specify the location of the history file: export HISTFILE=/data/ops/bash_history.