title | date | summary | categories | |
---|---|---|---|---|
Jumping Around the Command Line |
2018-10-16 22:06:01 +0100 |
A quick tip containing a few useful keyboard shortcuts for command line navigation. |
|
Next time you find yourself pressing the arrow key to move to the end of the command line, stop and remember, there is a quicker way! Here are a few quick shortcuts to make your cursor movement more efficient.
Note: These are written for a Mac - swap out the Cmd button for your OS-specific alternative (e.g. Cmd on Windows). These were tested in Terminal and iTerm2 using a Bash shell. Your mileage may vary for different setups.
Cmd + e
Cmd + a
This gif illustrates these two keyboard shortcuts in action:
Alt + → or Alt + ←
If you're using iTerm2, you may need to configure the "alt" key to work as expected. Check out my blog post about enabling the alt key in iTerm2 for how to do that.
This gif shows using the alt key to move the cursor over whole words:
Bonus tip: how to clear the contents from the viewport of the terminal window.
Cmd + l or just type clear
and press enter.