I'm trying to create a function that will echo the previous to last command from the current terminal. This is the expected output (here I call the desired function f):
$ history 1
history 1
$ f
history 1
Side question: Where does history(1) saves the current terminal's history. I know that when the terminal session ends history is typically saved in $HISTFILE (which is set to ~/.bash_history in my case). But I'd like to know where history(1) keeps the history of the currently running terminal.