#For Previous Command (for comparison) !-1 repeat whole command !! repeat (shortcut) !:0 command !^ first parameter !:1 first parameter !:1-4 first 4 parameters !$ last parameter !* all parameters !!:s/bash/zsh (or ^bash^zsh) !^:t just file name of first parameter !$:h just path of last parameter !-2$:r just file name without extension of first parameter For last but one command !-2 repeat last but one command !-2^ first parameter last but one command !-2$ last parameter last but one command !-2:2 second parameter of second but last command !-2:s/bash/zsh substitute bash by zsh in the last but one command
Most of them are applicable for bash as well.
Credit: copied from here.