History with last n commands

The history command returns the list of the commands executed on the terminal. This can be useful not only at looking at the previous execution but often to rerun the previous commands

The history command return the last n executed command on the terminal/command line prompt.

$ history -10
   1036  ./exercise
   1037  clang exercise.cpp -o exercise
   1038  ./exercise
   1039  g++ -version
   1040  g++ --version
   1041  gcc --version
   1042  /usr/bin/gcc --version
   1043  history 1 | grep g++
   1044  history  | grep g++
   1045  clear
$