I am continuing my foray into learning more about Linux and Unix. Over the last few days, I have learned about some shortcuts on the terminal that have made me think: "I wish I knew this existed long ago." (I'm not sure if the shortcuts I have learned are portable to every terminal, but they work on macOS and should work on Linux too.)
Let's start by navigating the terminal.
Say I have written this command:
Oh no! I forgot the p in https. What should I do?
Fear not, for there is a shortcut that lets me substitute the incorrect text:
This command replaces the text after the first arrow with the text after the second arrow then runs the revised command in your terminal. Now I no longer have to hold the right arrow key on my keyboard to replace the typo at the beginning of a long command.
This next one brings me so much delight. You can hold Alt (Option on Mac) and left click anywhere on the terminal input line to go to that spot. I cannot believe this exists. Again, this makes fixing typos in a command so much easier.
I also learned about some navigation shortcuts. I still need to get these into my head but I am hoping this blog post will help with that (although I'll still need to get used to using them so that these shortcuts become muscle memory).
The navigation shortcuts I learned are:
- Control + A: Go to start of line
- Control + E: Go to end of line
- Control + D: Delete character after the current cursor position.
I am excited that these commands exist. All this time, I have been holding down arrow keys to navigate on the command line. I wonder what other shortcuts the terminal has that I can use!
Comment on this post
Respond to this post by sending a Webmention.
Have a comment? Email me at email@example.com.