Linux Shell History

The 'history' command will display a list of last commands used in the shell (shell history).

Syntax:

Example:

Linux History1

Look at the above snapshot, we have used history -10 (you can use any integer) command, it displays list of last ten commands.

Note: "history -c" clears the list of all the commands from history.

Ctrl + r

The keys 'ctrl+r' executes the last command from history matching the specified characters that you type.

Syntax:

Example:

Linux History2

Look at the above snapshot, we have pressed 'ctrl + r' followed by two characters ca and it has found the last command matching characters 'ca'.