We all know that, BASH stores the commands we entered in the terminal to .bash_history, we can see those commands using history command. Commands in the history can be executed by ! followed by the number, !5 (5th command in the history will get executed). But what if we only need to print the command, instead of executing, we can do it by :p
Ex:1
# !100:p
!100 – 100th command in the history
:p – print the command instead of executing it
Ex:2
# !!:p
!! – last command entered
:p – print the command instead of executing it
|