Rerun your last terminal command
Note: I've only used this with iTerm, but it might also work in any standard terminal emulator
- Goto iTerm Preferences -> Keys Tab
- Click the + button at the bottom of the window to add a new key command
- Pick a key combo to use to reuse the last command you entered. I use CMD+R.
- In the dropdown, change the Action to 'Send Hex Code'
- In the box below that, enter this: 0x0C 0x10 0x0d
Et voila!
Written by Mark Anthony Gibbins
Related protips
2 Responses
Why not just use !!
, which works in either bash or zsh?
over 1 year ago
·
A few reasons:
- This works no matter what shell you're using. I use fish myself which doesn't seem to support !! (I may be wrong!)
- Unlike !!, this clears the terminal and then reruns the last command using hex codes for UpArrow and Return so you get a clean view of the last command.
I use it mainly when running tests or repetitive commands where I need a fresh screen every time, plus a simple one touch key combo is always nice!
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Shell
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#