Introduction
Probably everyone that uses a Linux OS is familiar with what nano
is. But if you aren't aware, don't worry. Nano is a Unix and Linux operating system command line text editor. What this means is that this is essentially a text editor built into your terminal. How awesome is that!
Of course, it can not be compared to other text editors like VSCode or Sublime Text or vim. Nonetheless, it's still handy and efficient. But unfortunately, most people don't use nano to it's fullest potential. And the reason is being that nano keyboard shortcuts are different than what we are used to.
In this post, we are going to explore the 11 nano shortcuts that you must know. We are going to group the shortcuts in different groups. Let's start with:
Moving around
One of the most challenging thing in nano is moving around. One of the most painful things is when you have to go to the end of a line, and you have to press the right arrow key a million times. Now I know that this sounds super lazy, but imagine when you have to do this to 20 different lines. It's gonna take an annoying amount of time. That's why the movement shortcuts are one of the most important to use in nano. Here are the top ones that you should definitely remember.
- Moves you to the start of the line:
Ctrl+A
- Moves you to the end of the line:
Ctrl+E
- Moves you one page up:
Ctrl+Y
- Moves you to the end of the file:
Ctrl+V
Editing
Another painful thing is when you make an error and have no idea how to undo it. Well in most cases you close the file without saving the changes and start all over. That's why learning the main editing shortcuts is gonna save you quite a lot of time.
- Cut current line into cutbuffer:
Ctrl+K
- Paste contents of cutbuffer:
Ctrl+U
- Undo last action:
Alt+U
- Redo last undone action:
Alt+E
Deleting
And the final group is deleting. Imagine you add a ton of text that you want to be removed immediately. Well, it sure is going to take you a long time to remove if you don't know these shortcuts.
- Delete the word to the left:
Alt+Bsp
- Delete the word to the right:
Ctrl+Del
- Delete current line:
Alt+Del
Conclusion
Not everybody uses Nano, and some prefer vim or emacs. But it is good to know some handy shortcuts which could help you if you ever need to use Nano.
Speaking of text editors, be sure to check out this post on VScode shortcuts for Mac and Windows:
I hope that this helps!