history command in Unix

The history command can be used to determine the log of commands we have typed in the bash shell.

If you want to clear the history of commands, the following option can be used:

history -c

If you want to search for a command in history, we can use the grep command

history | grep cp

The following command will show the last n commands:

history n