Write out your history in the source terminal:
history -a
Then load it in your target terminal:
history -r
If you executed nothing in between, the long long command should be the third last command:
!-3
Or you can do history
, note the number of the long long command (say 2365), and do:
!2365
From help history
:
-a append history lines from this session to the history file
-r read the history file and append the contents to the history
list
-w write the current history to the history file
and append them to the history list
You can also use history -n
instead of -r
:
-n read all history lines not already read from the history file
Also see this SO question.