10 Keyboard Shortcuts for Text Navigation & Manipulation in the Command Line
We recently covered 12 keyboard shortcuts to help navigate around and manipulate text in Mac OS X, and now we’ll show you a handful of similar tricks for use at the command line. These shortcuts can be used just about anywhere in the Terminal, including the bash prompt.
7 Navigation Shortcuts
Navigate around blocks of texts faster with the following shortcuts:
- Jump to Beginning of Line – Control+A
- Jump to End of Line – Control+E
- Go to Next Line – Control+N
- Go to Previous Line – Control+P
- Delete Previous Word – Control+W
- Delete Line from Cursor to Beginning – Control+U
- Delete Line from Cursor to End – Control+K
Of course you can also use the arrow keys to navigate within text blocks and to place the cursor for using all commands mentioned.
3 Cutting & Pasting Shortcuts for the Command Line
The command line also has it’s own version of cut and paste, called “kill” and “yank”, and you can reuse two previously mentioned commands for this purpose:
- Cut from Cursor to Beginning of Line – Control+U
- Cut from Cursor to End of Line – Control+K
- Paste Previously Cut Text at Cursor – Control+Y
Because the latter two kill and yank commands do not overwrite the clipboard buffer, they can function as a secondary cut & paste command in many GUI based Mac OS X apps as well.
Enjoy this? Check out more command line tips in our archives.
Thanks to Josh who pointed out some these commands in the comments