diff --git a/pages/common/histexpand.md b/pages/common/histexpand.md index 61f0fc2b1f..d6642685ce 100644 --- a/pages/common/histexpand.md +++ b/pages/common/histexpand.md @@ -3,11 +3,7 @@ > Reuse and expand the shell history in `sh`, `bash`, `zsh`, `rbash` and `ksh`. > More information: . -- Run the previous command: - -`!!` - -- Run the previous command as root: +- Run the previous command as root (`!!` is replaced by the previous command): `sudo !!` @@ -19,13 +15,17 @@ `{{command}} !^` +- Run the Nth command of the history: + +`!{{n}}` + - Run the command `n` lines back in the history: `!-{{n}}` -- Run the most recent command starting with `string`: +- Run the most recent command containing `string`: -`!{{string}}` +`!?{{string}}?` - Run the previous command, replacing `string1` with `string2`: