Linux History Command
history command has loads of hidden features. I can never remember all of them so the main purpose of this article is to me to reference back to when I next forget.
This command will search the history for git
history | grep git
The history can be used by typing a
!. This with a number will run that command from the history. You can find the number of the command you need by searching the history.
This command will run the 100th command in the history.
You can run the last command you run by typing
All the arguments passed to command can be broken down into parts.
0 1 2
So if we run the above command and then cd into
~/Documents we can run.
The above command will evaluate to.
You can also use a range of params by using the pattern
x-y. The will pass a range of params to the command. You can also use the
$ as the last param, also a
* is a shortcut for
notmuch search tag:unread from:firstname.lastname@example.org
You skip adding a command into the history by prefixing the command with a space, this is handy for searching the history so you don’t fill up your history with
history | grep ...