Bash History – View History for Current Session

bashcommand history

Maybe I'm overlooking something but is there a way to get your current bash history for the current session you are using like

if i run

ssh host
$ pwd
$ ls
$ cd /tmp

I just want to see those 3 commands and nothing else

Best Answer

A slightly roundabout way:

history -a ~/current_history

This will save the current session's unsaved bash history to ~/current_history, which you can then view.

Related Question