From 4f714f14de4723a341c474eb7d2f543118f4f7cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pedro=20Fonseca=20Dantas?= <67479090+jopefd@users.noreply.github.com> Date: Mon, 5 Jul 2021 16:35:47 -0300 Subject: [PATCH] histexpand: add `!N` and `!?string?` commands (#6051) --- pages/common/histexpand.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) 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`: