Insert the last argument of the previous command in Bash
In Bash and Zsh, press Option+. (Mac), Alt+. (Linux, Windows).
EscF1F2F3F4F5F6F7F8F9F10F11F12PrtScScrLkPause
`1234567890-=deleteInsHomePgUp
TabQWERTYUIOP[]\DelEndPgDn
CapsASDFGHJKL;'return
ShiftZXCVBNM,./Shift↑
fnctrloptcmdcmdopt←↓→
EscF1F2F3F4F5F6F7F8F9F10F11F12PrtScScrLkPause
`1234567890-=BkspInsHomePgUp
TabQWERTYUIOP[]\DelEndPgDn
CapsASDFGHJKL;'Enter
ShiftZXCVBNM,./Shift↑
CtrlSuperAltAltSuperMenuCtrl←↓→
EscF1F2F3F4F5F6F7F8F9F10F11F12PrtScScrLkPause
`1234567890-=BkspInsHomePgUp
TabQWERTYUIOP[]\DelEndPgDn
CapsASDFGHJKL;'Enter
ShiftZXCVBNM,./Shift↑
CtrlWinAltAltWinMenuCtrl←↓→
See it happen Press the shortcut above, or
More Bash shortcuts: history
| Action | Mac | Linux | Windows |
|---|---|---|---|
| Search history backwards | CtrlR | CtrlR | CtrlR |
| Cancel the history search | CtrlG | CtrlG | CtrlG |
| Previous command | CtrlPor↑ | CtrlPor↑ | CtrlPor↑ |
| Next command | CtrlNor↓ | CtrlNor↓ | CtrlNor↓ |
| Run the command and fetch the next from history | CtrlO | CtrlO | CtrlO |