Linux reuse command history with shortcuts

Using command line history effectively will boost your productivity.
Here are some tips:

Repeat last executed command:

$ !!

or

$ !-1

Execute command with a key word:

$ !?wc?

It will run most recently executed command with with key word wc.

Execute last executed command that starts with a key word:

$ !wc

It will run most recently executed command that starts with wc

Execute first command in history file:

$ !1

Execute most recent nth command from history:

$ !-n

where n is number.

Execute line number 10 in the history:

$ !n

where n is number, it will execute command in nth line from command line.

-Sany

Advertisements