history expansion
Reuse and expand the shell history in sh
, bash
, zsh
, rbash
and ksh
.
=> More information.
- Run the previous command as root (
!!
is replaced by the previous command):
sudo !!
- Run a command with the last argument of the previous command:
{command} !$
- Run a command with the first argument of the previous command:
{command} !^
- Run the Nth command of the history:
!{n}
- Run the command
n
lines back in the history:
!-{n}
- Run the most recent command containing
string
:
!?{string}?
- Run the previous command, replacing
string1
with string2
:
^{string1}^{string2}^
- Perform a history expansion, but print the command that would be run instead of actually running it:
{!-n}:p
Copyright © 2014—present the tldr-pages team and contributors.
This work is licensed under the Creative Commons Attribution 4.0 International License (CC-BY).
=> CC-BY
Proxy Information
- Original URL
- gemini://freeshell.de/tldr/histexpand.gmi
- Status Code
- Success (20)
- Meta
text/gemini;lang=en-GB
- Capsule Response Time
- 110.843751 milliseconds
- Gemini-to-HTML Time
- 0.364718 milliseconds
This content has been proxied by September (3851b).