Shell history

The history command in the Linux shell is a powerful tool to work with the past issued commands.

# show the history of all past commands
$ history
1 git status
2 git branch --list
3 git checkout centered-layout
4 git rebase master
5 netlify dev

To get any command of the history into the prompt, key in the exclamation mark followed by the number of the command in the history:

# bring the first issued command into the command prompt 
$ !1
$ git status

The history can also get searched:

# list all issued commands that contain git
$ history | grep git

And the history can be cleared:

# clear the history
$ history -c
Comments