Copied to clipboard


The command line program "history" is used to display a list of the most recently executed commands in a terminal session.


  • history: List the recently executed command list.
  • history -c 10: Show only the last 10 commands.
  • history -d '2021-01-01': Display commands executed after January 1, 2021.
  • history -a: Show all history, including duplicate commands at the same time.
  • history -w: Display the timestamp and duration of command execution.
  • history -n 5: Show only the last 5 commands.
  • history -r: Reverse display, with the most recently executed command at the top.
  • history -p 1234: Show only commands related to process identifier 1234.
  • history -s 'git': Search by keyword "git".