You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unless otherwise stated, all commands are executed against a GNU/Linux OS.
History
Re-run the last command
ls
!! # ls
!! -a # You can append to the command: `ls -a`
sudo !! # You can prepend to the previous command: `sudo ls`
sudo !! -a # You can prepend and append to the command: `sudo ls -a`
BASH
ZSH
FiSH
CSH
KSH
Run the most recent command that starts with a specific string
ls -salt
!ls # Will re-run the most recent command that starts with "ls": `ls -salt`
BASH
ZSH
FiSH
CSH
KSH
Run a specific command from history
history # Returns a numbered list of previously executed commands
!77 # Runs command 77 from `history`
BASH
ZSH
FiSH
CSH
KSH
Run a previous command containing a specific string
Can be more useful than using alias in some cases.
docker inspect --format '{{ .NetworkSettings.IPAddress }} :: {{.Name}}' $(docker ps -q) # dips
!? dips # Will re-run the most recent command containing the string, " dips"