DEV Community

loading...
Cover image for 11 Nano shortcuts that you should know

11 Nano shortcuts that you should know

Bobby Iliev
I am a professional System Administrator with a demonstrated history of working in the internet industry. I am an avid Linux lover and supporter of the open-source movement philosophy.
Originally published at devdojo.com ・2 min read

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
Enter fullscreen mode Exit fullscreen mode
  • Moves you to the end of the line:
Ctrl+E
Enter fullscreen mode Exit fullscreen mode
  • Moves you one page up:
Ctrl+Y
Enter fullscreen mode Exit fullscreen mode
  • Moves you to the end of the file:
Ctrl+V
Enter fullscreen mode Exit fullscreen mode

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 
Enter fullscreen mode Exit fullscreen mode
  • Paste contents of cutbuffer:
Ctrl+U  
Enter fullscreen mode Exit fullscreen mode
  • Undo last action:
Alt+U 
Enter fullscreen mode Exit fullscreen mode
  • Redo last undone action:
Alt+E   
Enter fullscreen mode Exit fullscreen mode

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 
Enter fullscreen mode Exit fullscreen mode
  • Delete the word to the right:
Ctrl+Del    
Enter fullscreen mode Exit fullscreen mode
  • Delete current line:
Alt+Del 
Enter fullscreen mode Exit fullscreen mode

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:

https://devdojo.com/bobbyiliev/top-10-vscode-shortcuts-for-mac-and-windows-to-help-you-be-more-productive

I hope that this helps!

Discussion (0)