Introduction to Nano Editor

Using Nano Editor

Jump to the Beginning or End of file in Nano Editor

Moving around in Nano is easy with the arrow keys. But to quickly jump to the start or the end of a file needs specific keyboard shortcuts.

Ever found yourself in a situation where you scroll endlessly just to get to the beginning or the end of the file in the nano text editor? (pressing up and down arrow keys to get there is even worse).

Worry not! In this tutorial, I will walk you through multiple ways to jump to the beginning and the end of the file in the nano text editor.

Let's start with the jumping to the beginning of the file.

Jump to the beginning of the file in nano

There are two ways you can go to the beginning of the file in the nano text editor:

  • By pressing Ctrl + Home
  • By pressing Alt + \ (that's what I personally use, will tell to why later)
  • By pressing Ctrl + W and Ctrl + Y

I would recommend sticking to one of the above keybindings as the jumping to the end of the file includes similar keys so you can have a better workflow if you stick to one of them.

Using Alt + \ to jump to the beginning of the file

The first step is to open the file using the nano text editor:

nano Filename

Jumping to the beginning of the file is not rocket science, all you have to do is press the Alt + \ button and it will get you to the beginning of the line:

Jump to the beginning of the file in the nano text editor

In the above example, I'm going to random lines multiple times, and when I press the Alt + \ shortcut, it brings me to the beginning of the file.

Using Ctrl + Home to jump to the beginning of the file

If your workflow already utilizes the Home and End buttons, this would be a perfect way for you to jump to the beginning of the file.

Once you find yourself in a situation where you have to go to the beginning of the line, simply press the Ctrl + Home shortcut and that's it!

Using Ctrl + W and Ctrl + Y to get to the beginning of the file

When you press Ctrl + W, it starts the search prompt in the nano text editor which is generally used to find text.

But when you press Ctrl + Y in the search prompt, it will get you to the beginning of the file. Let me summarise this in two simple steps:

  1. Press Ctrl + W to start the search prompt
  2. Press Ctrl + Y to jump to the beginning of the file

Sounds confusing? Here's what you have to do:

Jump to the beginning of the file in the nano text editor using search prompt

Jump to the end of the file in nano

There are 3 ways that you can use to jump to the end of the line in that nano text editor.

  • Using Ctrl + End
  • Using Alt + /
  • First press Ctrl + W and then press Ctrl + V

Saw that? These shorts are only a little different than the ones that I explained to jump to the beginning of the line.

So the thing is if you are comfortable using Alt + \ to jump to the beginning, then you should be using Alt + / to jump to the end of the line and the same goes for the Ctrl shortcuts.

This way, you can remember those shortcuts easily.

Use Alt + / to jump to the end of the line

This is what I personally use as the Home and End buttons are located at the end of the keyboard and I don't want to stretch my fingers just to go to the end of the file.

I assume you already have opened the file with the nano text editor and if not, you can use the nano command in the following manner to do so:

nano Filename

It does not matter on which line you are, just press the Alt + / and it will land you at the end of the file:

Jump to the end of the file in the nano text editor

The above GIF suggests no matter what line or place I was, once I pressed Alt + /, it landed me at the end of the file.

Use Ctrl + End to jump to the end of the file

If you were using Ctrl + Home to get to the beginning of the line, this shortcut will blend perfectly into your workflow.

All you have to do is press the Ctrl + End shortcut and it will get you to the end of the file in the nano text editor.

Press Ctrl + W and then Ctrl + V to get to the end of the file

If you liked using the search prompt to jump to the beginning of the file, then this is what you probably want to use to get to the end of the file.

Simply follow two steps:

  1. Press Ctrl + W to start the search prompt
  2. Press Ctrl + V to get to the end of the file
Jump to the end of the file in the nano text editor using search prompt

There you have it!

Get more out of the nano text editor

If you are just getting started with the nano text editor or you want to learn more about what this tool can do, then you can refer to our beginner's guide to the nano:

Editing Files With Nano in Linux [With Cheat Sheet]
Though Nano is less complicated to use than Vim and Emacs, it doesn’t mean Nano cannot be overwhelming. Learn how to use the Nano text editor.

Confused between nano and vim? refer to the detailed comparison between Nano and Vim and choose what suits the best to your workflow:

Vim vs Nano: What Should You Choose?
Vim and Nano are two popular terminal text editors. How are they different? What’s best for you? Let us find out.

I hope you will find this guide helpful.